fix teleport incompability with some servers

This commit is contained in:
Eduardo Bart 2012-04-28 23:02:50 -03:00
parent 008fa85635
commit dc0ade2bd0
1 changed files with 7 additions and 16 deletions

View File

@ -278,27 +278,18 @@ void Map::removeCreatureById(uint32 id)
void Map::setCentralPosition(const Position& centralPosition) void Map::setCentralPosition(const Position& centralPosition)
{ {
bool teleported = !m_centralPosition.isInRange(centralPosition, 1, 1);
m_centralPosition = centralPosition; m_centralPosition = centralPosition;
// remove all creatures when teleporting, the server will resend them again
if(teleported) {
for(const auto& pair : m_knownCreatures) {
const CreaturePtr& creature = pair.second;
removeThing(creature);
}
// remove creatures from tiles that we are not aware anymore // remove creatures from tiles that we are not aware anymore
} else { for(const auto& pair : m_knownCreatures) {
for(const auto& pair : m_knownCreatures) { const CreaturePtr& creature = pair.second;
const CreaturePtr& creature = pair.second; if(creature) {
if(creature) { if(!isAwareOfPosition(creature->getPosition())) {
if(!isAwareOfPosition(creature->getPosition())) { removeThing(creature);
removeThing(creature);
}
} }
else
logTraceError("invalid creature");
} }
else
logTraceError("invalid creature");
} }
} }