- bool CWorldServer::LoadMobGroups() {
- if(GServer->Config.SpawnType == 0)
- {
- Log(MSG_LOAD, "MobGroups data " );
- vector<CMobGroup*> mobGroups;
- MYSQL_ROW row;
- bool flag = true;
- char* tmp = NULL;
- MYSQL_RES *result = DB->QStore("SELECT id, map, x, y, range, respawntime, `limit`, tacticalpoints, moblist FROM list_mobgroups");
- if (result == NULL) return false;
- while (row = mysql_fetch_row(result))
- {
- CMobGroup* thisgroup = new (nothrow) CMobGroup;
- if (thisgroup == NULL) {
- Log(MSG_ERROR, "Error allocating memory");
- DB->QFree();
- return false;
- }
- thisgroup->id = atoi(row[0]);
- thisgroup->map = atoi(row[1]);
- thisgroup->point.x = atof(row[2]);
- thisgroup->point.y = atof(row[3]);
- thisgroup->range = atoi(row[4]);
- thisgroup->respawntime = atoi(row[5]);
- thisgroup->limit = atoi(row[6]);
- thisgroup->tacticalpoints = atoi(row[7]);
- char* mobList = row[8];
- thisgroup->lastRespawnTime = clock();
- thisgroup->active = 0;
- thisgroup->basicKills = 0;
- thisgroup->curTac = 0;
- thisgroup->curBasic = 0;
- thisgroup->basicMobs.clear();
- thisgroup->tacMobs.clear();
- // Fill in basic/tac mobs
- tmp = strtok(mobList, ",|");
- while (tmp != NULL) {
- int mobId = atoi(tmp);
- tmp = strtok(NULL, ",|");
- if (tmp == NULL) {
- Log(MSG_ERROR, "MobGroup %i is invalid", thisgroup->id);
- flag = false;
- break;
- }
- int amount = atoi(tmp);
- tmp = strtok(NULL, ",|");
- if (tmp == NULL) {
- Log(MSG_ERROR, "MobGroup %i is invalid", thisgroup->id);
- flag = false;
- break;
- }
- int tactical = atoi(tmp);
- CMob *thismob = new (nothrow) CMob;
- if (thismob == NULL) {
- Log(MSG_ERROR, "Error allocating memory");
- DB->QFree();
- return false;
- }
- thismob->amount = amount;
- thismob->tactical = (unsigned int)tactical/2;
- thismob->mobId = mobId;
- thismob->thisnpc = GetNPCDataByID( thismob->mobId );
- thismob->mapdrop = GetDropData( thisgroup->map ); //hmm. We don't even use these drops anymore
- thismob->mobdrop = GetDropData( thismob->thisnpc->dropid );
- if (thismob->thisnpc == NULL) {
- Log(MSG_WARNING, "Invalid mobId - Mob %i will not be added", atoi(row[0]));
- delete thismob;
- continue;
- }
- if (thismob->tactical)
- thisgroup->tacMobs.push_back(thismob);
- else
- thisgroup->basicMobs.push_back(thismob);
- tmp = strtok(NULL, ",|");
- }
- if (!flag) {
- delete thisgroup;
- continue;
- }
- MapList.Index[thisgroup->map]->MobGroupList.push_back(thisgroup);
- mobGroups.push_back(thisgroup);
- }
- DB->QFree( );
- }
- return true;
- }
Did you also edit the structure definitions in CNPCdata ?
if you didn't then those members will not exist.
That will most definitely cause a crash at that point.
As it happens, in later versions i have dropped newnpc->side and newnpc->sidechance altogether since the side drops are controlled from the AIP code.