1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-01 09:09:41 +00:00

Remove duplicated code.

This commit is contained in:
dteviot 2015-07-12 17:14:48 +12:00
parent 0b089a5564
commit 22059d68f6

View file

@ -225,8 +225,6 @@ namespace MWMechanics
storage.mPathFinder.checkPathCompleted(pos.pos[0], pos.pos[1], DESTINATION_TOLERANCE)) storage.mPathFinder.checkPathCompleted(pos.pos[0], pos.pos[1], DESTINATION_TOLERANCE))
{ {
stopWalking(actor, storage); stopWalking(actor, storage);
moveNow = false;
walking = false;
chooseAction = true; chooseAction = true;
mHasReturnPosition = false; mHasReturnPosition = false;
} }
@ -329,17 +327,8 @@ namespace MWMechanics
{ {
// End package if duration is complete or mid-night hits: // End package if duration is complete or mid-night hits:
MWWorld::TimeStamp currentTime = world->getTimeStamp(); MWWorld::TimeStamp currentTime = world->getTimeStamp();
if(currentTime.getHour() >= mStartTime.getHour() + mDuration) if((currentTime.getHour() >= mStartTime.getHour() + mDuration) ||
{ (int(currentTime.getHour()) == 0 && currentTime.getDay() != mStartTime.getDay()))
if(!mRepeat)
{
stopWalking(actor, storage);
return true;
}
else
mStartTime = currentTime;
}
else if(int(currentTime.getHour()) == 0 && currentTime.getDay() != mStartTime.getDay())
{ {
if(!mRepeat) if(!mRepeat)
{ {
@ -447,8 +436,6 @@ namespace MWMechanics
mObstacleCheck.clear(); mObstacleCheck.clear();
stopWalking(actor, storage); stopWalking(actor, storage);
storage.mMoveNow = false;
storage.mWalking = false;
storage.mChooseAction = true; storage.mChooseAction = true;
mStuckCount = 0; mStuckCount = 0;
} }
@ -494,8 +481,6 @@ namespace MWMechanics
if (storage.mWalking) if (storage.mWalking)
{ {
stopWalking(actor, storage); stopWalking(actor, storage);
storage.mMoveNow = false;
storage.mWalking = false;
mObstacleCheck.clear(); mObstacleCheck.clear();
storage.mIdleNow = true; storage.mIdleNow = true;
getRandomIdle(storage.mPlayedIdle); getRandomIdle(storage.mPlayedIdle);
@ -601,6 +586,8 @@ namespace MWMechanics
{ {
storage.mPathFinder.clearPath(); storage.mPathFinder.clearPath();
actor.getClass().getMovementSettings(actor).mPosition[1] = 0; actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
storage.mMoveNow = false;
storage.mWalking = false;
} }
void AiWander::playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect) void AiWander::playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect)