mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Crash] Fix spawn race condition shown by #repop (#2455)
* Troubleshooting * Debugging * Debugging * Debugging * Debugging * Remove debug line * Revert back to GetRawNPCTypeName
This commit is contained in:
parent
74dfc1ae3c
commit
714fb032e9
@ -4257,10 +4257,12 @@ bool EntityList::LimitCheckName(const char *npc_name)
|
||||
{
|
||||
auto it = npc_list.begin();
|
||||
while (it != npc_list.end()) {
|
||||
NPC* npc = it->second;
|
||||
if (npc)
|
||||
if (strcasecmp(npc_name, npc->GetRawNPCTypeName()) == 0)
|
||||
NPC *npc = it->second;
|
||||
if (npc) {
|
||||
if (strcasecmp(npc_name, npc->GetRawNPCTypeName()) == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
++it;
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -4,9 +4,9 @@ void command_repop(Client *c, const Seperator *sep)
|
||||
{
|
||||
int arguments = sep->argnum;
|
||||
if (!arguments) {
|
||||
entity_list.ClearAreas();
|
||||
c->Message(Chat::White, "Zone depopped, repopping now.");
|
||||
zone->Repop();
|
||||
zone->spawn2_timer.Trigger();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -15,11 +15,10 @@ void command_repop(Client *c, const Seperator *sep)
|
||||
if (is_force) {
|
||||
zone->ClearSpawnTimers();
|
||||
c->Message(Chat::White, "Zone depopped, forcefully repopping now.");
|
||||
} else {
|
||||
} else {
|
||||
c->Message(Chat::White, "Zone depopped, repopping now.");
|
||||
}
|
||||
|
||||
zone->Repop();
|
||||
zone->spawn2_timer.Trigger();
|
||||
}
|
||||
|
||||
|
||||
@ -205,6 +205,11 @@ bool Spawn2::Process() {
|
||||
return (true);
|
||||
}
|
||||
|
||||
if (tmp->npc_id == 0) {
|
||||
LogError("NPC type did not load for npc_id [{}]", npcid);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tmp->unique_spawn_by_name) {
|
||||
if (!entity_list.LimitCheckName(tmp->name)) {
|
||||
LogSpawns("Spawn2 [{}]: Spawn group [{}] yeilded NPC type [{}], which is unique and one already exists", spawn2_id, spawngroup_id_, npcid);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user