mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
throw exception if water level is attempted to be modified in exterior
This commit is contained in:
parent
5a19d4ec45
commit
2f096e131d
@ -159,6 +159,10 @@ namespace MWScript
|
|||||||
Interpreter::Type_Float level = runtime[0].mFloat;
|
Interpreter::Type_Float level = runtime[0].mFloat;
|
||||||
|
|
||||||
MWWorld::Ptr::CellStore *cell = context.getWorld().getPlayer().getPlayer().getCell();
|
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;
|
cell->mWaterLevel = level;
|
||||||
context.getEnvironment().mWorld->setWaterHeight(cell->mWaterLevel);
|
context.getEnvironment().mWorld->setWaterHeight(cell->mWaterLevel);
|
||||||
}
|
}
|
||||||
@ -176,6 +180,10 @@ namespace MWScript
|
|||||||
Interpreter::Type_Float level = runtime[0].mFloat;
|
Interpreter::Type_Float level = runtime[0].mFloat;
|
||||||
|
|
||||||
MWWorld::Ptr::CellStore *cell = context.getWorld().getPlayer().getPlayer().getCell();
|
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;
|
cell->mWaterLevel +=level;
|
||||||
context.getEnvironment().mWorld->setWaterHeight(cell->mWaterLevel);
|
context.getEnvironment().mWorld->setWaterHeight(cell->mWaterLevel);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user