Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bots

Development::Bots Forum for bots.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 05-30-2015, 01:10 PM
rencro
Hill Giant
 
Join Date: Sep 2008
Location: So. California
Posts: 219
Default

Still crashes on last bot members death.

Ex: Me and my single bot in a 2 person group, bot dies, CRASH.

Group's memory has already been deleted in this case once coming back from:

Code:
// delete from group data
					RemoveBotFromGroup(this, g);
So when this gets processed:

Code:
					// if group members exist below this one, move
					// them all up one slot in the group list
					int j = i+1;
					for(; j<MAX_GROUP_MEMBERS; j++) {
						if(g->members[j]) {
							g->members[j-1] = g->members[j];
							strcpy(g->membername[j-1], g->members[j]->GetCleanName());
							g->membername[j][0] = '\0';
							memset(g->membername[j], 0, 64);
							g->members[j] = nullptr;
						}
					}
It crashes, as I mentioned, that memory is gone.

Looks like it just needed your change moved up in the code: as in

Code:
diff --git a/zone/bot.cpp b/zone/bot.cpp
index ebc5f47..f382272 100644
--- a/zone/bot.cpp
+++ b/zone/bot.cpp
@@ -5897,6 +5897,11 @@ bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillUseTypes att
 					// delete from group data
 					RemoveBotFromGroup(this, g);
 
+					//Make sure group still exists if it doesnt they were already updated in RemoveBotFromGroup
+					g = GetGroup();
+					if (!g)
+						break;
+
 					// if group members exist below this one, move
 					// them all up one slot in the group list
 					int j = i+1;
@@ -5910,11 +5915,6 @@ bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillUseTypes att
 						}
 					}
 					
-					//Make sure group still exists if it doesnt they were already updated in RemoveBotFromGroup
-					g = GetGroup();
-					if (!g)
-						break;
-					
 					// update the client group
 					EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct));
 					GroupJoin_Struct* gu = (GroupJoin_Struct*)outapp->pBuffer;
And then I dont crash in this situation.

Thanks..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:10 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3