mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-16 17:02:28 +00:00
[Quest API] Fix EVENT_TIMER crash when entity is no longer available (#2986)
* [Quest API] Fix EVENT_TIMER crash when entity is no longer available * Update questmgr.cpp
This commit is contained in:
parent
f39155952f
commit
04fdc54522
@ -88,19 +88,28 @@ void QuestManager::Process() {
|
||||
end = QTimerList.end();
|
||||
while (cur != end) {
|
||||
if (cur->Timer_.Enabled() && cur->Timer_.Check()) {
|
||||
if(entity_list.IsMobInZone(cur->mob)) {
|
||||
if(cur->mob->IsNPC()) {
|
||||
if (cur->mob && entity_list.IsMobInZone(cur->mob)) {
|
||||
if (cur->mob->IsNPC()) {
|
||||
if (parse->HasQuestSub(cur->mob->GetNPCTypeID(), EVENT_TIMER)) {
|
||||
parse->EventNPC(EVENT_TIMER, cur->mob->CastToNPC(), nullptr, cur->name, 0);
|
||||
}
|
||||
} else if (cur->mob->IsEncounter()) {
|
||||
parse->EventEncounter(EVENT_TIMER, cur->mob->CastToEncounter()->GetEncounterName(), cur->name, 0, nullptr);
|
||||
} else if (cur->mob->IsClient()) {
|
||||
}
|
||||
else if (cur->mob->IsEncounter()) {
|
||||
parse->EventEncounter(
|
||||
EVENT_TIMER,
|
||||
cur->mob->CastToEncounter()->GetEncounterName(),
|
||||
cur->name,
|
||||
0,
|
||||
nullptr
|
||||
);
|
||||
}
|
||||
else if (cur->mob->IsClient()) {
|
||||
if (parse->PlayerHasQuestSub(EVENT_TIMER)) {
|
||||
//this is inheriently unsafe if we ever make it so more than npc/client start timers
|
||||
parse->EventPlayer(EVENT_TIMER, cur->mob->CastToClient(), cur->name, 0);
|
||||
}
|
||||
} else if (cur->mob->IsBot()) {
|
||||
}
|
||||
else if (cur->mob->IsBot()) {
|
||||
if (parse->BotHasQuestSub(EVENT_TIMER)) {
|
||||
parse->EventBot(EVENT_TIMER, cur->mob->CastToBot(), nullptr, cur->name, 0);
|
||||
}
|
||||
@ -109,12 +118,15 @@ void QuestManager::Process() {
|
||||
//we MUST reset our iterator since the quest could have removed/added any
|
||||
//number of timers... worst case we have to check a bunch of timers twice
|
||||
cur = QTimerList.begin();
|
||||
end = QTimerList.end(); //dunno if this is needed, cant hurt...
|
||||
} else {
|
||||
end = QTimerList.end(); //dunno if this is needed, cant hurt...
|
||||
}
|
||||
else {
|
||||
cur = QTimerList.erase(cur);
|
||||
}
|
||||
} else
|
||||
}
|
||||
else {
|
||||
++cur;
|
||||
}
|
||||
}
|
||||
|
||||
auto cur_iter = STimerList.begin();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user