forked from teamnwah/openmw-tes3coop
Add isInCell checks to PlaceAt and PlaceItem (Fixes #2873)
Avoids the game crashing when a script calls these functions before the player has been moved to the starting location.
This commit is contained in:
parent
34f48d63f3
commit
a699b4128a
1 changed files with 7 additions and 0 deletions
|
@ -458,6 +458,10 @@ namespace MWScript
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
|
|
||||||
|
if (!player.isInCell())
|
||||||
|
throw std::runtime_error("player not in a cell");
|
||||||
|
|
||||||
MWWorld::CellStore* store = NULL;
|
MWWorld::CellStore* store = NULL;
|
||||||
if (player.getCell()->isExterior())
|
if (player.getCell()->isExterior())
|
||||||
{
|
{
|
||||||
|
@ -505,6 +509,9 @@ namespace MWScript
|
||||||
if (count<0)
|
if (count<0)
|
||||||
throw std::runtime_error ("count must be non-negative");
|
throw std::runtime_error ("count must be non-negative");
|
||||||
|
|
||||||
|
if (!actor.isInCell())
|
||||||
|
throw std::runtime_error ("actor is not in a cell");
|
||||||
|
|
||||||
for (int i=0; i<count; ++i)
|
for (int i=0; i<count; ++i)
|
||||||
{
|
{
|
||||||
ESM::Position ipos = actor.getRefData().getPosition();
|
ESM::Position ipos = actor.getRefData().getPosition();
|
||||||
|
|
Loading…
Reference in a new issue