diff --git a/src/CNShardServer.cpp b/src/CNShardServer.cpp index 3677f3a..3097e62 100644 --- a/src/CNShardServer.cpp +++ b/src/CNShardServer.cpp @@ -31,7 +31,8 @@ void CNShardServer::handlePacket(CNSocket* sock, CNPacketData* data) { else if (settings::VERBOSITY > 0) std::cerr << "OpenFusion: SHARD UNIMPLM ERR. PacketType: " << Defines::p2str(CL2FE, data->type) << " (" << data->type << ")" << std::endl; - PlayerManager::players[sock].lastHeartbeat = getTime(); + if (PlayerManager::players.find(sock) != PlayerManager::players.end()) + PlayerManager::players[sock].lastHeartbeat = getTime(); } void CNShardServer::keepAliveTimer(CNServer* serv, time_t currTime) { diff --git a/src/MobManager.cpp b/src/MobManager.cpp index ed2c4f6..e78d64a 100644 --- a/src/MobManager.cpp +++ b/src/MobManager.cpp @@ -578,12 +578,12 @@ void MobManager::roamingStep(Mob *mob, time_t currTime) { } void MobManager::retreatStep(Mob *mob, time_t currTime) { - // distance between spawn point and current location if (mob->nextMovement != 0 && currTime < mob->nextMovement) return; mob->nextMovement = currTime + 500; + // distance between spawn point and current location int distance = hypot(mob->appearanceData.iX - mob->roamX, mob->appearanceData.iY - mob->roamY); //if (distance > mob->data["m_iIdleRange"]) {