PDA

View Full Version : Having Issues with EVENT_GROUP_CHANGE


bad_captain
12-29-2010, 04:06 PM
After my home server died, I set up a new temporary server where I had to install everything from scratch. I copied the database over, and am running the latest code as of last night (with Bots). Every time I zone or log out, the zone I was in crashes when it is being destroyed. I finally got debugging set up and the call stack contains the following: Zone::RemoveAllMobs(), Bot::~Bot(), Bot::RemoveBotFromGroup(), Group::DelMember(), Mob::SetGrouped(), Parser::Event(EVENT_GROUP_CHANGE), Parser::EventCommon(EVENT_GROUP_CHANGE), then a couple string functions, then some _debug functions, where it finally says that there is a null pointer. At least as far as DelMember and, SetGrouped, Mob* is not null, and I believe Mob* being passed into Event and EventCommon is not null as well.

This is the line of code that's being called:
parse->Event(EVENT_GROUP_CHANGE, 0, "", (NPC*)NULL, this->CastToClient()); where 'this' is my character.

MySQL 5.0, Perl 5.10.1 build 1007 or 1008, EqEmu Rev 1786, SoD client

I had been running Rev 1751, which also includes the EVENT_GROUP_CHANGE, which was added in Rev 1735 and wasn't having any problems, so I'm not sure what is different.

At first I thought it was some custom code I had added, but I ran base EqEMU code and the problem persists.

Anyone have any ideas what I'm missing?

blackdragonsdg
12-29-2010, 05:56 PM
Try sourcing in all the small updates from 1672 to your current emulator revision. Revision 1751 of the database does not contain those updates for some reason or another.

bad_captain
12-30-2010, 01:27 AM
Okay, did a little more testing. All sql updates sourced in at least as far back as Rev 1510.

This only seems to come up when I am using botgroups. If I only have bots in my group, no problem. If I have bots grouped outside mine, I get crashes on zone exit. I will take a look at my db schema for botgroups, but I'm pretty sure nothing has changed with them recently, as things were working at least around Rev 1721. (I may have been mistaken that things were working as of Rev 1751, as I was having server crashes due to hardware problems, and may have never made it to zone out. I will have to check my logs to see if there's anything in there.

So, anyway, my issue appears to be botgroups and the EVENT_GROUP_CHANGE.

Derision
12-30-2010, 08:16 AM
The crash appears to be due to the fact that when Mob::SetGrouped is called for a bot, it casts the Mob to a Client before calling Parser::Event, which is obviously not valid.

The quick fix would appear to be only call EVENT_GROUP_CHANGE for clients:

Index: mob.cpp
================================================== =================
--- mob.cpp (revision 1786)
+++ mob.cpp (working copy)
@@ -4125,7 +4125,9 @@
israidgrouped = false;
}
isgrouped = v;
- parse->Event(EVENT_GROUP_CHANGE, 0, "", (NPC*)NULL, this->CastToClient());
+
+ if(IsClient())
+ parse->Event(EVENT_GROUP_CHANGE, 0, "", (NPC*)NULL, this);
}

void Mob::SetRaidGrouped(bool v)
@@ -4135,7 +4137,9 @@
isgrouped = false;
}
israidgrouped = v;
- parse->Event(EVENT_GROUP_CHANGE, 0, "", (NPC*)NULL, this->CastToClient());
+
+ if(IsClient())
+ parse->Event(EVENT_GROUP_CHANGE, 0, "", (NPC*)NULL, this);
}

sint16 Mob::GetCriticalChanceBonus(int16 skill, bool aa_bonus)

bad_captain
12-30-2010, 09:14 AM
Thanks, Derision. I'll try this out and let you know if I have any problems.

bad_captain
12-31-2010, 01:22 AM
This seems to work, however I was wondering if you actually need to do the check for being a client, or if you could just not cast to client, as parse->Event is just looking for a mob pointer, not specifically a client pointer. I haven't looked at what EVENT_GROUP_CHANGE is used for, and it may be something that would be desired to function with bots. Who knows. Anyway, by adding the check for being a client, I no longer crash when zoning.

But, now I have a different problem. Instead of creating another thread, I'll add it here. I doubt this is related, but after zoning with my bots twice (from PoK to the Nexus and back), I crash after I tried to use #mystats, which I can reproduce. I do not have Caryatis' changes from today (or whenever he added the color to the HP/Mana), but everything up to that. I was given an error message from VS stating that there was corruption of the stack near class_name, blah blah, and in the call stack, it listed Zone!boot_NPC, then Zone!FailWithMessage, then some other stuff that wasn't useful because I didn't do a good job of creating my debugging info. I am rebuilding my stuff to try and debug this further, but wanted to post it here in case anyone has seen this before.

My one issue is time.... I usually get only one shot a night to test things out by the time I load up VS, build and deploy, start my server, load EQ, attach my debugger, log in, crash it, log out, try and debug, etc, I've wasted almost an hour. Oh, well, I'll try and figure it out tomorrow night.

trevius
12-31-2010, 10:11 AM
The EVENT_GROUP_CHANGE triggers when a client joins or leaves a group or raid. It isn't a heavily useful event, but it might be something that a server with Bots could find use for on occasion. Though, since it only goes to player.pl, I don't know if a bot would even show up or not.

Also, here is another mention of corrupt stack with #mystats:
http://www.eqemulator.org/forums/showthread.php?p=195751#post195751