Skip to content

Commit

Permalink
[11329] Fix crash in ChatHandler::HandleNpcDeleteCommand() - correctl…
Browse files Browse the repository at this point in the history
…y despawn TemporarySummon objects by using TemporarySummon::UnSummon() function.

Signed-off-by: Ambal <pogrebniak@gala.net>
  • Loading branch information
Ambal committed Apr 11, 2011
1 parent bf1eb8e commit 3819d50
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions src/game/Level2.cpp
Expand Up @@ -41,6 +41,7 @@
#include <iostream>
#include <fstream>
#include <map>
#include "TemporarySummon.h"

#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand

Expand Down Expand Up @@ -1818,9 +1819,17 @@ bool ChatHandler::HandleNpcDeleteCommand(char* args)
}

// Delete the creature
unit->CombatStop();
unit->DeleteFromDB();
unit->AddObjectToRemoveList();
if(!unit->IsTemporarySummon())
{
unit->CombatStop();
unit->DeleteFromDB();
unit->AddObjectToRemoveList();
}
else
{
TemporarySummon * pSummon = static_cast<TemporarySummon* >(unit);
pSummon->UnSummon();
}

SendSysMessage(LANG_COMMAND_DELCREATMESSAGE);

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11328"
#define REVISION_NR "11329"
#endif // __REVISION_NR_H__

0 comments on commit 3819d50

Please sign in to comment.