Improve ResetActors command (bug #4723)

pull/541/head
Andrei Kortunov 6 years ago
parent c1473d5375
commit e8b3ae8706

@ -7,6 +7,7 @@
Bug #4714: Crash upon game load in the repair menu while the "Your repair failed!" message is active Bug #4714: Crash upon game load in the repair menu while the "Your repair failed!" message is active
Bug #4715: "Cannot get class of an empty object" exception after pressing ESC in the dialogue mode Bug #4715: "Cannot get class of an empty object" exception after pressing ESC in the dialogue mode
Bug #4720: Inventory avatar has shield with two-handed weapon during [un]equipping animation Bug #4720: Inventory avatar has shield with two-handed weapon during [un]equipping animation
Bug #4723: ResetActors command works incorrectly
Feature #2229: Improve pathfinding AI Feature #2229: Improve pathfinding AI
Feature #3442: Default values for fallbacks from ini file Feature #3442: Default values for fallbacks from ini file
Feature #4673: Weapon sheathing Feature #4673: Weapon sheathing

@ -330,6 +330,17 @@ namespace MWWorld
visitor.merge(); visitor.merge();
} }
bool CellStore::movedHere(const MWWorld::Ptr& ptr) const
{
if (ptr.isEmpty())
return false;
if (mMovedHere.find(ptr.getBase()) != mMovedHere.end())
return true;
return false;
}
CellStore::CellStore (const ESM::Cell *cell, const MWWorld::ESMStore& esmStore, std::vector<ESM::ESMReader>& readerList) CellStore::CellStore (const ESM::Cell *cell, const MWWorld::ESMStore& esmStore, std::vector<ESM::ESMReader>& readerList)
: mStore(esmStore), mReader(readerList), mCell (cell), mState (State_Unloaded), mHasState (false), mLastRespawn(0,0) : mStore(esmStore), mReader(readerList), mCell (cell), mState (State_Unloaded), mHasState (false), mLastRespawn(0,0)
{ {

@ -233,6 +233,8 @@ namespace MWWorld
float getWaterLevel() const; float getWaterLevel() const;
bool movedHere(const MWWorld::Ptr& ptr) const;
void setWaterLevel (float level); void setWaterLevel (float level);
void setFog (ESM::FogState* fog); void setFog (ESM::FogState* fog);

@ -3698,10 +3698,13 @@ namespace MWWorld
{ {
if (ptr.getClass().isActor() && ptr.getCellRef().hasContentFile()) if (ptr.getClass().isActor() && ptr.getCellRef().hasContentFile())
{ {
if (ptr.getCell()->movedHere(ptr))
return true;
const ESM::Position& origPos = ptr.getCellRef().getPosition(); const ESM::Position& origPos = ptr.getCellRef().getPosition();
MWBase::Environment::get().getWorld()->moveObject(ptr, origPos.pos[0], origPos.pos[1], origPos.pos[2]); MWBase::Environment::get().getWorld()->moveObject(ptr, origPos.pos[0], origPos.pos[1], origPos.pos[2]);
MWBase::Environment::get().getWorld()->rotateObject(ptr, origPos.rot[0], origPos.rot[1], origPos.rot[2]); MWBase::Environment::get().getWorld()->rotateObject(ptr, origPos.rot[0], origPos.rot[1], origPos.rot[2]);
ptr.getClass().adjustPosition(ptr, false); ptr.getClass().adjustPosition(ptr, true);
} }
return true; return true;
} }

Loading…
Cancel
Save