fix teleport incompability with some servers
This commit is contained in:
parent
008fa85635
commit
dc0ade2bd0
|
@ -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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue