[Fix] Fix crash from lingering spawn2 reference in NPCs.

This commit is contained in:
Zimp
2025-07-18 23:25:28 -05:00
parent b8884d6572
commit b79030310b
7 changed files with 28 additions and 21 deletions
+3 -3
View File
@@ -188,7 +188,7 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
}
auto target = c->GetTarget()->CastToNPC();
auto spawn2 = target->respawn2;
auto spawn2 = target->GetSpawn();
if (!spawn2) {
c->Message(Chat::White, "Failed to delete spawn because NPC has no Spawn2.");
return;
@@ -297,7 +297,7 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
}
auto target = c->GetTarget()->CastToNPC();
auto spawn2 = target->respawn2;
auto spawn2 = target->GetSpawn();
if (!spawn2) {
c->Message(Chat::White, "Failed to edit respawn because NPC has no Spawn2.");
return;
@@ -434,7 +434,7 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
}
auto target = c->GetTarget()->CastToNPC();
auto spawn2 = target->respawn2;
auto spawn2 = target->GetSpawn();
if (!spawn2) {
c->Message(Chat::White, "Failed to move spawn because NPC has no Spawn2.");
return;
+1 -1
View File
@@ -8,7 +8,7 @@ void command_spawnfix(Client* c, const Seperator* sep)
}
auto target = c->GetTarget()->CastToNPC();
auto spawn2 = target->respawn2;
auto spawn2 = target->GetSpawn();
if (!spawn2) {
c->Message(Chat::White, "Failed to fix spawn, the spawn must not exist in the database.");
+1 -1
View File
@@ -5,7 +5,7 @@ void command_wpadd(Client *c, const Seperator *sep)
int type1 = 0, type2 = 0, pause = 0; // Defaults for a new grid
Mob *target = c->GetTarget();
if (target && target->IsNPC()) {
Spawn2 *s2info = target->CastToNPC()->respawn2;
Spawn2 *s2info = target->CastToNPC()->GetSpawn();
if (s2info == nullptr) {
c->Message(
Chat::White,