From 5de031fb8b99648eaeeec09801ea2ba9f3e99a2f Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Mon, 3 Dec 2012 21:26:58 -0200 Subject: [PATCH] Workaround for issue #146 --- src/otclient/creature.cpp | 2 +- src/otclient/creature.h | 2 ++ src/otclient/protocolgameparse.cpp | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/otclient/creature.cpp b/src/otclient/creature.cpp index 9553557b..e0da44e9 100644 --- a/src/otclient/creature.cpp +++ b/src/otclient/creature.cpp @@ -338,7 +338,7 @@ void Creature::onAppear() m_removed = false; callLuaField("onAppear"); // 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); callLuaField("onWalk", m_oldPosition, m_position); // teleport diff --git a/src/otclient/creature.h b/src/otclient/creature.h index 97de4436..0b8402b4 100644 --- a/src/otclient/creature.h +++ b/src/otclient/creature.h @@ -100,6 +100,7 @@ public: void turn(Otc::Direction direction); virtual void walk(const Position& oldPos, const Position& newPos); virtual void stopWalk(); + void allowAppearWalk() { m_allowAppearWalk = true; } bool isWalking() { return m_walking; } bool isRemoved() { return m_removed; } @@ -155,6 +156,7 @@ protected: Timer m_footTimer; TilePtr m_walkingTile; stdext::boolean m_walking; + stdext::boolean m_allowAppearWalk; stdext::boolean m_footStepDrawn; ScheduledEventPtr m_walkUpdateEvent; EventPtr m_disappearEvent; diff --git a/src/otclient/protocolgameparse.cpp b/src/otclient/protocolgameparse.cpp index 25bfc9c3..dd8e06dc 100644 --- a/src/otclient/protocolgameparse.cpp +++ b/src/otclient/protocolgameparse.cpp @@ -519,6 +519,9 @@ void ProtocolGame::parseCreatureMove(const InputMessagePtr& msg) return; } + CreaturePtr creature = thing->static_self_cast(); + creature->allowAppearWalk(); + g_map.addThing(thing, newPos, -1); }