Tired of this GLM warning (and we dont even use glm rotate grr) also reworked how I approached that peq entity process crash after thinking about it a bit

This commit is contained in:
KimLS 2014-09-25 14:54:40 -07:00
parent aa021addc1
commit c57292a9dd
2 changed files with 31 additions and 22 deletions

View File

@ -289,6 +289,7 @@ ADD_DEFINITIONS(-DLOG_LEVEL_DEBUG=${EQEMU_LOG_LEVEL_DEBUG})
ADD_DEFINITIONS(-DLOG_LEVEL_QUEST=${EQEMU_LOG_LEVEL_QUEST})
ADD_DEFINITIONS(-DLOG_LEVEL_COMMANDS=${EQEMU_LOG_LEVEL_COMMANDS})
ADD_DEFINITIONS(-DLOG_LEVEL_CRASH=${EQEMU_LOG_LEVEL_CRASH})
ADD_DEFINITIONS(-DGLM_FORCE_RADIANS)
IF(EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS)
ADD_DEFINITIONS(-DRETRANSMIT_ACKED_PACKETS=true)

View File

@ -490,22 +490,36 @@ void EntityList::MobProcess()
#endif
auto it = mob_list.begin();
while (it != mob_list.end()) {
if (!it->second) {
++it;
continue;
}
if (!it->second->Process()) {
uint16 id = it->first;
Mob *mob = it->second;
uint16 tempid = it->first;
if (mob->IsNPC()) {
entity_list.RemoveNPC(mob->CastToNPC()->GetID());
} else if (mob->IsMerc()) {
entity_list.RemoveMerc(mob->CastToMerc()->GetID());
#ifdef BOTS
} else if (mob->IsBot()) {
entity_list.RemoveBot(mob->CastToBot()->GetID());
#endif
size_t sz = mob_list.size();
bool p_val = mob->Process();
size_t a_sz = mob_list.size();
if(a_sz > sz) {
//increased size can potentially screw with iterators so reset it to current value
//if buckets are re-orderered we may skip a process here and there but since
//process happens so often it shouldn't matter much
it = mob_list.find(id);
++it;
} else {
++it;
}
if(!p_val) {
if(mob->IsNPC()) {
entity_list.RemoveNPC(id);
}
else if(mob->IsMerc()) {
entity_list.RemoveMerc(id);
#ifdef BOTS
}
else if(mob->IsBot()) {
entity_list.RemoveBot(id);
#endif
}
else {
#ifdef _WINDOWS
struct in_addr in;
in.s_addr = mob->CastToClient()->GetIP();
@ -513,25 +527,19 @@ void EntityList::MobProcess()
#endif
zone->StartShutdownTimer();
Group *g = GetGroupByMob(mob);
if (g) {
if(g) {
LogFile->write(EQEMuLog::Error, "About to delete a client still in a group.");
g->DelMember(mob);
}
Raid *r = entity_list.GetRaidByClient(mob->CastToClient());
if (r) {
if(r) {
LogFile->write(EQEMuLog::Error, "About to delete a client still in a raid.");
r->MemberZoned(mob->CastToClient());
}
entity_list.RemoveClient(mob->GetID());
entity_list.RemoveClient(id);
}
if(entity_list.RemoveMob(tempid)) {
it = mob_list.begin();
} else {
++it;
}
} else {
++it;
entity_list.RemoveMob(id);
}
}
}