Browse Source

Fix disband group with depopped bot crash

Fix #272
Image 3 years ago
parent
commit
45d38d4845
2 changed files with 10 additions and 5 deletions
  1. 7 5
      EQ2/source/WorldServer/Bots/Bot.cpp
  2. 3 0
      EQ2/source/WorldServer/zoneserver.cpp

+ 7 - 5
EQ2/source/WorldServer/Bots/Bot.cpp

@@ -33,7 +33,6 @@ Bot::Bot() : NPC() {
 }
 
 Bot::~Bot() {
-
 }
 
 void Bot::GiveItem(int32 item_id) {
@@ -603,7 +602,7 @@ bool Bot::ShouldMelee() {
 	return ret;
 }
 
-void Bot::Camp() {
+void Bot::Camp(bool immediate) {
 	// Copy from COMMAND_GROUP_LEAVE
 	GroupMemberInfo* gmi = GetGroupMemberInfo();
 	if (gmi) {
@@ -617,9 +616,12 @@ void Bot::Camp() {
 		}
 	}
 
-	GetZone()->PlayAnimation(this, 538);
-	SetVisualState(540);
-	GetZone()->Despawn(this, 5000);
+	if(!immediate)
+	{
+		GetZone()->PlayAnimation(this, 538);
+		SetVisualState(540);
+		GetZone()->Despawn(this, 5000);
+	}
 
 	if (!GetOwner())
 		return;

+ 3 - 0
EQ2/source/WorldServer/zoneserver.cpp

@@ -719,6 +719,9 @@ void ZoneServer::ProcessDepop(bool respawns_allowed, bool repop) {
 		for (itr = spawn_list.begin(); itr != spawn_list.end(); itr++) {
 			spawn = itr->second;
 			if(spawn && !spawn->IsPlayer()){
+				if(spawn->IsBot())
+				((Bot*)spawn)->Camp(true);
+
 				SendRemoveSpawn(client, spawn, packet);
 			}
 		}