Skip to content

Commit a2ed6be

Browse files
authored
[Bug Fix] Zero out currentnpcid whenever spawn is reset. (#4763)
1 parent c33ac40 commit a2ed6be

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

zone/spawn2.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,15 @@ void Spawn2::LoadGrid(int start_wp) {
356356
void Spawn2::Reset() {
357357
timer.Start(resetTimer());
358358
npcthis = nullptr;
359+
currentnpcid = 0;
359360
LogSpawns("Spawn2 [{}]: Spawn reset, repop in [{}] ms", spawn2_id, timer.GetRemainingTime());
360361
}
361362

362363
void Spawn2::Depop() {
363364
timer.Disable();
364365
LogSpawns("Spawn2 [{}]: Spawn reset, repop disabled", spawn2_id);
365366
npcthis = nullptr;
367+
currentnpcid = 0;
366368
}
367369

368370
void Spawn2::Repop(uint32 delay) {
@@ -374,6 +376,7 @@ void Spawn2::Repop(uint32 delay) {
374376
timer.Start(delay);
375377
}
376378
npcthis = nullptr;
379+
currentnpcid = 0;
377380
}
378381

379382
void Spawn2::ForceDespawn()
@@ -392,12 +395,14 @@ void Spawn2::ForceDespawn()
392395
npcthis->Depop(true);
393396
IsDespawned = true;
394397
npcthis = nullptr;
398+
currentnpcid = 0;
395399
return;
396400
}
397401
else
398402
{
399403
npcthis->Depop(false);
400404
npcthis = nullptr;
405+
currentnpcid = 0;
401406
}
402407
}
403408
}
@@ -429,6 +434,7 @@ void Spawn2::DeathReset(bool realdeath)
429434

430435
//zero out our NPC since he is now gone
431436
npcthis = nullptr;
437+
currentnpcid = 0;
432438

433439
if(realdeath) { killcount++; }
434440

@@ -643,6 +649,7 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
643649
LogSpawns("Spawn2 [{}]: Our npcthis is currently not null. The zone thinks it is [{}]. Forcing a depop", spawn2_id, npcthis->GetName());
644650
npcthis->Depop(false); //remove the current mob
645651
npcthis = nullptr;
652+
currentnpcid = 0;
646653
}
647654
if(new_state) { // only get repawn timer remaining when the SpawnCondition is enabled.
648655
timer_remaining = database.GetSpawnTimeLeft(spawn2_id,zone->GetInstanceID());

0 commit comments

Comments
 (0)