Progress updating to cv981/pv973:

* Implemented the new client AND protocol version methods.
* Implemented the new speed laws added in cv980 (http://www.tibia.com/news/?subtopic=newsarchive&id=2251).
* Added more missing bytea to login packets (client version/type and some unknown bytes).
* Fixed the InputMessage::getDouble method.
* Cleaned up some of the const values.
* Started on the pending state features.

TODO:
* Pending game state feature.
* Ensure version compatibility hasn't been compromised.
This commit is contained in:
BeniS
2012-12-29 00:05:45 +13:00
parent 619285069c
commit 44e428bccb
29 changed files with 260 additions and 129 deletions

View File

@@ -89,7 +89,7 @@ std::string InputMessage::getString()
double InputMessage::getDouble()
{
uint8 precision = getU8();
uint32 v = getU32();
int32 v = getU32() - INT_MAX;
return (v / std::pow((float)10, precision));
}

View File

@@ -348,49 +348,57 @@ namespace Otc
};
enum PathFindResult {
PATHFIND_RESULT_OK = 0,
PATHFIND_RESULT_SAME_POSITION,
PATHFIND_RESULT_IMPOSSIBLE,
PATHFIND_RESULT_TOO_FAR,
PATHFIND_RESULT_NO_WAY
PathFineResultOk = 0,
PathFindResultSamePosition,
PathFindResultImpossible,
PathFindResultTooFar,
PathFindResultNoWay
};
enum PathFindFlag {
PATHFIND_ALLOW_NULLTILES = 1,
PATHFIND_ALLOW_CREATURES = 2,
PATHFIND_ALLOW_NONPATHABLE = 4,
PATHFIND_ALLOW_NONWALKABLE = 8
enum PathFindFlags {
PathFindAllowNullTiles = 1,
PathFindAllowCreatures = 2,
PathFindAllowNonPathable = 4,
PathFindAllowNonWalkable = 8
};
enum AutomapFlags
{
MAPMARK_TICK = 0,
MAPMARK_QUESTION,
MAPMARK_EXCLAMATION,
MAPMARK_STAR,
MAPMARK_CROSS,
MAPMARK_TEMPLE,
MAPMARK_KISS,
MAPMARK_SHOVEL,
MAPMARK_SWORD,
MAPMARK_FLAG,
MAPMARK_LOCK,
MAPMARK_BAG,
MAPMARK_SKULL,
MAPMARK_DOLLAR,
MAPMARK_REDNORTH,
MAPMARK_REDSOUTH,
MAPMARK_REDEAST,
MAPMARK_REDWEST,
MAPMARK_GREENNORTH,
MAPMARK_GREENSOUTH
MapMarkTick = 0,
MapMarkQuestion,
MapMarkExclamation,
MapMarkStar,
MapMarkCross,
MapMarkTemple,
MapMarkKiss,
MapMarkShovel,
MapMarkSword,
MapMarkFlag,
MapMarkLock,
MapMarkBag,
MapMarkSkull,
MapMarkDollar,
MapMarkRedNorth,
MapMarkRedSouth,
MapMarkRedEast,
MapMarkRedWest,
MapMarkGreenNorth,
MapMarkGreenSouth
};
enum VipState
{
VIPSTATE_OFFLINE = 0,
VIPSTATE_ONLINE = 1,
VIPSTATE_PENDING = 2
VipStateOffline = 0,
VipStateOnline = 1,
VipStatePending = 2
};
enum SpeedFormula
{
SpeedFormulaA = 0,
SpeedFormulaB,
SpeedFormulaC,
LastSpeedFormula
};
}

View File

@@ -57,6 +57,7 @@ Creature::Creature() : Thing()
m_nameCache.setFont(g_fonts.getFont("verdana-11px-rounded"));
m_nameCache.setAlign(Fw::AlignTopCenter);
m_footStep = 0;
m_speedFormula.fill(-1);
}
void Creature::draw(const Point& dest, float scaleFactor, bool animate, LightView *lightView)
@@ -615,6 +616,19 @@ void Creature::setEmblemTexture(const std::string& filename)
m_emblemTexture = g_textures.getTexture(filename);
}
void Creature::setSpeedFormula(double speedA, double speedB, double speedC)
{
m_speedFormula[Otc::SpeedFormulaA] = speedA;
m_speedFormula[Otc::SpeedFormulaB] = speedB;
m_speedFormula[Otc::SpeedFormulaC] = speedC;
}
bool Creature::hasSpeedFormula()
{
return m_speedFormula[Otc::SpeedFormulaA] != -1 && m_speedFormula[Otc::SpeedFormulaB] != -1
&& m_speedFormula[Otc::SpeedFormulaC] != -1;
}
void Creature::addTimedSquare(uint8 color)
{
m_showTimedSquare = true;
@@ -658,28 +672,43 @@ Point Creature::getDrawOffset()
int Creature::getStepDuration()
{
int speed = m_speed * 2;
int groundSpeed = 0;
Position tilePos = m_lastStepToPosition;
if(!tilePos.isValid())
tilePos = m_position;
const TilePtr& tile = g_map.getTile(tilePos);
if(tile)
if(tile) {
groundSpeed = tile->getGroundSpeed();
if(groundSpeed == 0)
groundSpeed = 150;
}
int interval = 1000;
if(groundSpeed > 0 && m_speed > 0)
interval = (1000 * groundSpeed) / m_speed;
if(groundSpeed > 0 && speed > 0)
interval = 1000 * groundSpeed;
if(g_game.getClientVersion() >= 900)
if(g_game.getFeature(Otc::GameNewSpeedLaw) && hasSpeedFormula()) {
int formulatedSpeed = 1;
if(speed > -m_speedFormula[Otc::SpeedFormulaB]) {
formulatedSpeed = std::max(1, (int)floor((m_speedFormula[Otc::SpeedFormulaA] * log((speed / 2)
+ m_speedFormula[Otc::SpeedFormulaB]) + m_speedFormula[Otc::SpeedFormulaC]) + 0.5));
}
interval = std::floor(interval / (double)formulatedSpeed);
}
else
interval /= speed;
if(g_game.getProtocolVersion() >= 900)
interval = (interval / g_game.getServerBeat()) * g_game.getServerBeat();
interval = std::max(interval, g_game.getServerBeat());
if(m_lastStepDirection == Otc::NorthWest || m_lastStepDirection == Otc::NorthEast ||
m_lastStepDirection == Otc::SouthWest || m_lastStepDirection == Otc::SouthEast)
interval *= 3;
interval = std::max(interval, g_game.getServerBeat());
return interval;
}

View File

@@ -44,7 +44,6 @@ public:
Creature();
virtual void draw(const Point& dest, float scaleFactor, bool animate, LightView *lightView = nullptr);
void internalDrawOutfit(Point dest, float scaleFactor, bool animateWalk, bool animateIdle, Otc::Direction direction, LightView *lightView = nullptr);
@@ -65,6 +64,7 @@ public:
void setShieldTexture(const std::string& filename, bool blink);
void setEmblemTexture(const std::string& filename);
void setPassable(bool passable) { m_passable = passable; }
void setSpeedFormula(double speedA, double speedB, double speedC);
void addTimedSquare(uint8 color);
void removeTimedSquare() { m_showTimedSquare = false; }
@@ -89,6 +89,9 @@ public:
Position getLastStepFromPosition() { return m_lastStepFromPosition; }
Position getLastStepToPosition() { return m_lastStepToPosition; }
float getStepProgress() { return m_walkTimer.ticksElapsed() / getStepDuration(); }
double getSpeedFormula(Otc::SpeedFormula formula) { return m_speedFormula[formula]; }
bool hasSpeedFormula();
std::array<double, Otc::LastSpeedFormula> getSpeedFormulaArray() { return m_speedFormula; }
virtual Point getDisplacement();
virtual int getDisplacementX();
virtual int getDisplacementY();
@@ -148,6 +151,8 @@ protected:
CachedText m_nameCache;
Color m_informationColor;
std::array<double, Otc::LastSpeedFormula> m_speedFormula;
// walk related
int m_walkAnimationPhase;
int m_walkedPixels;

View File

@@ -39,7 +39,7 @@ Game g_game;
Game::Game()
{
resetGameStates();
m_clientVersion = 0;
m_protocolVersion = 0;
}
void Game::terminate()
@@ -118,6 +118,18 @@ void Game::processLoginWait(const std::string& message, int time)
g_lua.callGlobalField("g_game", "onLoginWait", message, time);
}
void Game::processPendingGame()
{
m_localPlayer->setPendingGame(true);
g_lua.callGlobalField("g_game", "onPendingGame");
}
void Game::processEnterGame()
{
m_localPlayer->setPendingGame(false);
g_lua.callGlobalField("g_game", "onEnterGame");
}
void Game::processGameStart()
{
m_online = true;
@@ -432,7 +444,7 @@ void Game::loginWorld(const std::string& account, const std::string& password, c
if(m_protocolGame || isOnline())
stdext::throw_exception("Unable to login into a world while already online or logging.");
if(m_clientVersion == 0)
if(m_protocolVersion == 0)
stdext::throw_exception("Must set a valid game protocol version before logging.");
// reset the new game state
@@ -642,7 +654,7 @@ void Game::look(const ThingPtr& thing)
if(!canPerformGameAction() || !thing)
return;
if(thing->isCreature() && m_clientVersion >= 961)
if(thing->isCreature() && m_protocolVersion >= 961)
m_protocolGame->sendLookCreature(thing->getId());
else
m_protocolGame->sendLook(thing->getPosition(), thing->getId(), thing->getStackpos());
@@ -715,7 +727,7 @@ void Game::useWith(const ItemPtr& item, const ThingPtr& toThing)
if(!pos.isValid()) // virtual item
pos = Position(0xFFFF, 0, 0); // means that is a item in inventory
if(toThing->isCreature() && g_game.getClientVersion() >= 860)
if(toThing->isCreature() && g_game.getProtocolVersion() >= 860)
m_protocolGame->sendUseOnCreature(pos, item->getId(), item->getStackpos(), toThing->getId());
else
m_protocolGame->sendUseItemWith(pos, item->getId(), item->getStackpos(), toThing->getPosition(), toThing->getId(), toThing->getStackpos());
@@ -785,7 +797,7 @@ void Game::attack(CreaturePtr creature)
setAttackingCreature(creature);
if(m_clientVersion >= 963) {
if(m_protocolVersion >= 963) {
if(creature)
m_seq = creature->getId();
} else
@@ -808,7 +820,7 @@ void Game::follow(CreaturePtr creature)
setFollowingCreature(creature);
if(m_clientVersion >= 963) {
if(m_protocolVersion >= 963) {
if(creature)
m_seq = creature->getId();
} else
@@ -1173,15 +1185,15 @@ bool Game::canPerformGameAction()
return m_online && m_localPlayer && !m_dead && m_protocolGame && m_protocolGame->isConnected() && checkBotProtection();
}
void Game::setClientVersion(int version)
void Game::setProtocolVersion(int version)
{
if(m_clientVersion == version)
if(m_protocolVersion == version)
return;
if(isOnline())
stdext::throw_exception("Unable to change client version while online");
stdext::throw_exception("Unable to change protocol version while online");
if(version != 0 && (version < 810 || version > 981))
if(version != 0 && (version < 810 || version > 973))
stdext::throw_exception(stdext::format("Protocol version %d not supported", version));
m_features.reset();
@@ -1233,15 +1245,31 @@ void Game::setClientVersion(int version)
enableFeature(Otc::GameOfflineTrainingTime);
}
if(version >= 980) {
if(version >= 973) {
enableFeature(Otc::GameLoginPending);
enableFeature(Otc::GameNewSpeedLaw);
}
m_clientVersion = version;
m_protocolVersion = version;
Proto::buildMessageModesMap(version);
g_lua.callGlobalField("g_game", "onProtocolVersionChange", version);
}
void Game::setClientVersion(int version)
{
if(m_clientVersion == version)
return;
if(isOnline())
stdext::throw_exception("Unable to change client version while online");
if(version != 0 && (version < 981 || version > 981))
stdext::throw_exception(stdext::format("Client version %d not supported", version));
m_clientVersion = version;
g_lua.callGlobalField("g_game", "onClientVersionChange", version);
}

View File

@@ -59,6 +59,9 @@ protected:
void processLoginAdvice(const std::string& message);
void processLoginWait(const std::string& message, int time);
void processPendingGame();
void processEnterGame();
void processGameStart();
void processGameEnd();
void processDeath(int penality);
@@ -248,6 +251,9 @@ public:
void setFeature(Otc::GameFeature feature, bool enabled) { m_features.set(feature, enabled); }
bool getFeature(Otc::GameFeature feature) { return m_features.test(feature); }
void setProtocolVersion(int version);
int getProtocolVersion() { return m_protocolVersion; }
void setClientVersion(int version);
int getClientVersion() { return m_clientVersion; }
@@ -308,6 +314,7 @@ private:
std::string m_worldName;
std::bitset<Otc::LastGameFeature> m_features;
ScheduledEventPtr m_pingEvent;
int m_protocolVersion;
int m_clientVersion;
};

View File

@@ -216,7 +216,7 @@ int Item::getSubType()
{
if(isSplash() || isFluidContainer())
return m_countOrSubType;
if(g_game.getClientVersion() >= 900)
if(g_game.getProtocolVersion() >= 900)
return 0;
return 1;
}

View File

@@ -28,12 +28,6 @@
LocalPlayer::LocalPlayer()
{
m_preWalking = false;
m_lastPrewalkDone = true;
m_autoWalking = false;
m_known = false;
m_premium = false;
m_states = 0;
m_vocation = 0;
m_walkLockExpiration = 0;

View File

@@ -53,6 +53,7 @@ public:
void setSoul(double soul);
void setStamina(double stamina);
void setKnown(bool known) { m_known = known; }
void setPendingGame(bool pending) { m_pending = pending; }
void setInventoryItem(Otc::InventorySlot inventory, const ItemPtr& item);
void setVocation(int vocation);
void setPremium(bool premium);
@@ -92,6 +93,7 @@ public:
bool isPreWalking() { return m_preWalking; }
bool isAutoWalking() { return m_autoWalking; }
bool isPremium() { return m_premium; }
bool isPendingGame() { return m_pending; }
LocalPlayerPtr asLocalPlayer() { return static_self_cast<LocalPlayer>(); }
bool isLocalPlayer() { return true; }
@@ -113,27 +115,30 @@ protected:
private:
// walk related
bool m_preWalking;
bool m_lastPrewalkDone;
bool m_autoWalking;
bool m_premium;
Position m_lastPrewalkDestionation;
ItemPtr m_inventoryItems[Otc::LastInventorySlot];
ScheduledEventPtr m_autoWalkEndEvent;
stdext::boolean<false> m_waitingWalkPong;
Timer m_walkPingTimer;
Timer m_idleTimer;
Position m_lastPrewalkDestionation;
ScheduledEventPtr m_autoWalkEndEvent;
ticks_t m_walkLockExpiration;
int m_lastWalkPing;
stdext::boolean<false> m_preWalking;
stdext::boolean<true> m_lastPrewalkDone;
stdext::boolean<false> m_autoWalking;
stdext::boolean<false> m_waitingWalkPong;
stdext::boolean<false> m_premium;
stdext::boolean<false> m_known;
stdext::boolean<false> m_pending;
ItemPtr m_inventoryItems[Otc::LastInventorySlot];
Timer m_idleTimer;
std::array<int, Otc::LastSkill> m_skillsLevel;
std::array<int, Otc::LastSkill> m_skillsBaseLevel;
std::array<int, Otc::LastSkill> m_skillsLevelPercent;
std::vector<int> m_spells;
bool m_known;
int m_states;
int m_vocation;
ticks_t m_walkLockExpiration;
double m_health;
double m_maxHealth;

View File

@@ -220,6 +220,8 @@ void OTClient::registerLuaFunctions()
g_lua.bindSingletonFunction("g_game", "getServerBeat", &Game::getServerBeat, &g_game);
g_lua.bindSingletonFunction("g_game", "getLocalPlayer", &Game::getLocalPlayer, &g_game);
g_lua.bindSingletonFunction("g_game", "getProtocolGame", &Game::getProtocolGame, &g_game);
g_lua.bindSingletonFunction("g_game", "getProtocolVersion", &Game::getProtocolVersion, &g_game);
g_lua.bindSingletonFunction("g_game", "setProtocolVersion", &Game::setProtocolVersion, &g_game);
g_lua.bindSingletonFunction("g_game", "getClientVersion", &Game::getClientVersion, &g_game);
g_lua.bindSingletonFunction("g_game", "setClientVersion", &Game::setClientVersion, &g_game);
g_lua.bindSingletonFunction("g_game", "getCharacterName", &Game::getCharacterName, &g_game);

View File

@@ -459,20 +459,20 @@ std::tuple<std::vector<Otc::Direction>, Otc::PathFindResult> Map::findPath(const
std::vector<Otc::Direction>& dirs = std::get<0>(ret);
Otc::PathFindResult& result = std::get<1>(ret);
result = Otc::PATHFIND_RESULT_NO_WAY;
result = Otc::PathFindResultNoWay;
if(startPos == goalPos) {
result = Otc::PATHFIND_RESULT_SAME_POSITION;
result = Otc::PathFindResultSamePosition;
return ret;
}
if(startPos.z != goalPos.z) {
result = Otc::PATHFIND_RESULT_IMPOSSIBLE;
result = Otc::PathFindResultImpossible;
return ret;
}
if(startPos.distance(goalPos) > maxSteps) {
result = Otc::PATHFIND_RESULT_TOO_FAR;
result = Otc::PathFindResultTooFar;
return ret;
}
@@ -486,7 +486,7 @@ std::tuple<std::vector<Otc::Direction>, Otc::PathFindResult> Map::findPath(const
while(currentNode) {
// too far
if(currentNode->steps >= maxSteps) {
result = Otc::PATHFIND_RESULT_TOO_FAR;
result = Otc::PathFindResultTooFar;
break;
}
@@ -507,14 +507,14 @@ std::tuple<std::vector<Otc::Direction>, Otc::PathFindResult> Map::findPath(const
const TilePtr& tile = getTile(neighborPos);
if(neighborPos != goalPos) {
if(!(flags & Otc::PATHFIND_ALLOW_NULLTILES) && !tile)
if(!(flags & Otc::PathFindAllowNullTiles) && !tile)
continue;
if(tile) {
if(!(flags & Otc::PATHFIND_ALLOW_CREATURES) && tile->hasCreature())
if(!(flags & Otc::PathFindAllowCreatures) && tile->hasCreature())
continue;
if(!(flags & Otc::PATHFIND_ALLOW_NONPATHABLE) && !tile->isPathable())
if(!(flags & Otc::PathFindAllowNonPathable) && !tile->isPathable())
continue;
if(!(flags & Otc::PATHFIND_ALLOW_NONWALKABLE) && !tile->isWalkable())
if(!(flags & Otc::PathFindAllowNonWalkable) && !tile->isWalkable())
continue;
}
}
@@ -568,7 +568,7 @@ std::tuple<std::vector<Otc::Direction>, Otc::PathFindResult> Map::findPath(const
}
dirs.pop_back();
std::reverse(dirs.begin(), dirs.end());
result = Otc::PATHFIND_RESULT_OK;
result = Otc::PathFineResultOk;
}
for(auto it : nodes)

View File

@@ -473,7 +473,7 @@ void Map::saveOtcm(const std::string& fileName)
// version 1 header
fin->addString("OTCM 1.0"); // map description
fin->addU32(g_things.getDatSignature());
fin->addU16(g_game.getClientVersion());
fin->addU16(g_game.getProtocolVersion());
fin->addString(g_game.getWorldName());
// go back and rewrite where the map data starts

View File

@@ -56,7 +56,7 @@ void ProtocolGame::onRecv(const InputMessagePtr& inputMessage)
if(m_firstRecv) {
m_firstRecv = false;
if(g_game.getClientVersion() > 810) {
if(g_game.getProtocolVersion() > 810) {
int size = inputMessage->getU16();
if(size != inputMessage->getUnreadSize()) {
g_logger.traceError("invalid message size");

View File

@@ -342,6 +342,7 @@ void ProtocolGame::parseInitGame(const InputMessagePtr& msg)
double speedA = msg->getDouble();
double speedB = msg->getDouble();
double speedC = msg->getDouble();
m_localPlayer->setSpeedFormula(speedA, speedB, speedC);
}
bool canReportBugs = msg->getU8();
@@ -353,11 +354,13 @@ void ProtocolGame::parseInitGame(const InputMessagePtr& msg)
void ProtocolGame::parsePendingGame(const InputMessagePtr& msg)
{
//set player to pending game state
g_game.processPendingGame();
}
void ProtocolGame::parseEnterGame(const InputMessagePtr& msg)
{
//set player to entered game state
g_game.processEnterGame();
}
void ProtocolGame::parseGMActions(const InputMessagePtr& msg)
@@ -366,7 +369,7 @@ void ProtocolGame::parseGMActions(const InputMessagePtr& msg)
int numViolationReasons;
if(g_game.getClientVersion() >= 854)
if(g_game.getProtocolVersion() >= 854)
numViolationReasons = 20;
else
numViolationReasons = 32;
@@ -489,7 +492,7 @@ void ProtocolGame::parseTileAddThing(const InputMessagePtr& msg)
Position pos = getPosition(msg);
int stackPos = -1;
if(g_game.getClientVersion() >= 854)
if(g_game.getProtocolVersion() >= 854)
stackPos = msg->getU8();
ThingPtr thing = getThing(msg);
@@ -617,7 +620,7 @@ void ProtocolGame::parseOpenNpcTrade(const InputMessagePtr& msg)
int listCount;
if(g_game.getClientVersion() >= 900)
if(g_game.getProtocolVersion() >= 900)
listCount = msg->getU16();
else
listCount = msg->getU8();
@@ -644,7 +647,7 @@ void ProtocolGame::parsePlayerGoods(const InputMessagePtr& msg)
std::vector<std::tuple<ItemPtr, int>> goods;
int money;
if(g_game.getClientVersion() >= 980)
if(g_game.getProtocolVersion() >= 973)
money = msg->getU64();
else
money = msg->getU32();
@@ -993,7 +996,7 @@ void ProtocolGame::parsePlayerState(const InputMessagePtr& msg)
void ProtocolGame::parsePlayerCancelAttack(const InputMessagePtr& msg)
{
uint seq = 0;
if(g_game.getClientVersion() >= 860)
if(g_game.getProtocolVersion() >= 860)
seq = msg->getU32();
g_game.processAttackCancel(seq);
@@ -1295,7 +1298,7 @@ void ProtocolGame::parseVipAdd(const InputMessagePtr& msg)
id = msg->getU32();
name = g_game.formatCreatureName(msg->getString());
if(g_game.getClientVersion() >= 963) {
if(g_game.getProtocolVersion() >= 963) {
desc = msg->getString();
markId = msg->getU32();
notifyLogin = msg->getU8();
@@ -1614,7 +1617,7 @@ CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type)
uint id = msg->getU32();
int creatureType;
if(g_game.getClientVersion() >= 910)
if(g_game.getProtocolVersion() >= 910)
creatureType = msg->getU8();
else {
if(id >= Proto::PlayerStartId && id < Proto::PlayerEndId)
@@ -1670,7 +1673,7 @@ CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type)
if(g_game.getFeature(Otc::GameCreatureEmblems) && !known)
emblem = msg->getU8();
if(g_game.getClientVersion() >= 854)
if(g_game.getProtocolVersion() >= 854)
unpass = msg->getU8();
if(creature) {
@@ -1699,7 +1702,7 @@ CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type)
if(creature)
creature->turn(direction);
if(g_game.getClientVersion() >= 953) {
if(g_game.getProtocolVersion() >= 953) {
bool unpass = msg->getU8();
if(creature)

View File

@@ -51,7 +51,12 @@ void ProtocolGame::sendLoginPacket(uint challangeTimestamp, uint8 challangeRando
msg->addU8(Proto::ClientEnterGame);
msg->addU16(g_lua.callGlobalField<int>("g_game", "getOsType"));
msg->addU16(g_game.getClientVersion());
msg->addU16(g_game.getProtocolVersion());
if(g_game.getProtocolVersion() >= 971) {
msg->addU32(g_game.getClientVersion());
msg->addU8(0); // clientType
}
int paddingBytes = 128;
msg->addU8(0); // first RSA byte must be 0
@@ -588,7 +593,7 @@ void ProtocolGame::sendShareExperience(bool active)
msg->addU8(Proto::ClientShareExperience);
msg->addU8(active ? 0x01 : 0x00);
if(g_game.getClientVersion() < 910)
if(g_game.getProtocolVersion() < 910)
msg->addU8(0);
send(msg);

View File

@@ -189,7 +189,7 @@ void Tile::addThing(const ThingPtr& thing, int stackPos)
append = (priority <= 3);
// newer protocols does not store creatures in reverse order
if(g_game.getClientVersion() >= 854 && priority == 4)
if(g_game.getProtocolVersion() >= 854 && priority == 4)
append = !append;
}