From 2f096e131da6f7122ddfeaeda2348aea2b0aef78 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 29 Mar 2012 16:23:02 +0200 Subject: [PATCH] throw exception if water level is attempted to be modified in exterior --- apps/openmw/mwscript/cellextensions.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/openmw/mwscript/cellextensions.cpp b/apps/openmw/mwscript/cellextensions.cpp index dec9e96456..155393f9e6 100644 --- a/apps/openmw/mwscript/cellextensions.cpp +++ b/apps/openmw/mwscript/cellextensions.cpp @@ -159,6 +159,10 @@ namespace MWScript Interpreter::Type_Float level = runtime[0].mFloat; MWWorld::Ptr::CellStore *cell = context.getWorld().getPlayer().getPlayer().getCell(); + + if (!(cell->cell->data.flags & ESM::Cell::Interior)) + throw std::runtime_error("Can't set water level in exterior cell"); + cell->mWaterLevel = level; context.getEnvironment().mWorld->setWaterHeight(cell->mWaterLevel); } @@ -176,6 +180,10 @@ namespace MWScript Interpreter::Type_Float level = runtime[0].mFloat; MWWorld::Ptr::CellStore *cell = context.getWorld().getPlayer().getPlayer().getCell(); + + if (!(cell->cell->data.flags & ESM::Cell::Interior)) + throw std::runtime_error("Can't set water level in exterior cell"); + cell->mWaterLevel +=level; context.getEnvironment().mWorld->setWaterHeight(cell->mWaterLevel); }