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..