Workaround for issue #146

This commit is contained in:
Eduardo Bart 2012-12-03 21:26:58 -02:00
parent f5b3bfda11
commit 5de031fb8b
3 changed files with 6 additions and 1 deletions

View File

@ -338,7 +338,7 @@ void Creature::onAppear()
m_removed = false; m_removed = false;
callLuaField("onAppear"); callLuaField("onAppear");
// walk // walk
} else if(m_oldPosition != m_position && m_oldPosition.isInRange(m_position,1,1)) { } else if(m_oldPosition != m_position && m_oldPosition.isInRange(m_position,1,1) && m_allowAppearWalk) {
walk(m_oldPosition, m_position); walk(m_oldPosition, m_position);
callLuaField("onWalk", m_oldPosition, m_position); callLuaField("onWalk", m_oldPosition, m_position);
// teleport // teleport

View File

@ -100,6 +100,7 @@ public:
void turn(Otc::Direction direction); void turn(Otc::Direction direction);
virtual void walk(const Position& oldPos, const Position& newPos); virtual void walk(const Position& oldPos, const Position& newPos);
virtual void stopWalk(); virtual void stopWalk();
void allowAppearWalk() { m_allowAppearWalk = true; }
bool isWalking() { return m_walking; } bool isWalking() { return m_walking; }
bool isRemoved() { return m_removed; } bool isRemoved() { return m_removed; }
@ -155,6 +156,7 @@ protected:
Timer m_footTimer; Timer m_footTimer;
TilePtr m_walkingTile; TilePtr m_walkingTile;
stdext::boolean<false> m_walking; stdext::boolean<false> m_walking;
stdext::boolean<false> m_allowAppearWalk;
stdext::boolean<false> m_footStepDrawn; stdext::boolean<false> m_footStepDrawn;
ScheduledEventPtr m_walkUpdateEvent; ScheduledEventPtr m_walkUpdateEvent;
EventPtr m_disappearEvent; EventPtr m_disappearEvent;

View File

@ -519,6 +519,9 @@ void ProtocolGame::parseCreatureMove(const InputMessagePtr& msg)
return; return;
} }
CreaturePtr creature = thing->static_self_cast<Creature>();
creature->allowAppearWalk();
g_map.addThing(thing, newPos, -1); g_map.addThing(thing, newPos, -1);
} }