PDA

View Full Version : #spawnfix command shutting down zone


Shadowrun[EQ]
06-19-2003, 07:15 AM
don't know if I'm compiling wrong or what, but everytime i use the spawn fix command it shuts down my zone.exe. I don't know what else to post for imformation.

Wolfman
06-19-2003, 09:39 AM
Does it crash for every NPC? or just certian ones? I'll thuroughly test it this weekend and see what I can find. My previous tests showed everything was ok. However, I only tested it with about 20 mobs in one zone.

Bigpull
06-19-2003, 10:10 AM
For the short attention span crowd, YES it is broken.

Wolfman, it's mostly hitting the same npc twice.

Current implementation in my local tree,
fixes a memleak, target errors, checks for dupes, and despawns the npc.
The big problem comes from us altering the spawn2 and not reloading it into the zones cache. Once all the npc's are gone or in thier correct position you need to #shutdown(static) or leave(dynamic) the zone, I'll look into spliting the cacheing out into a seperate function we can call from zone->Repop().

#if 0
// Corrupts zone data
// test with a #repop after a #spawnfix
else if (strcasecmp(sep->arg[0], "#spawnfix") == 0) {
if (!target||!target->IsNPC()) {
Message(0, "Error: #spawnfix: No Target.");
}
else {
int32 tmp = 0;
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT id from spawn2 where zone='%s' AND x='%f' AND y='%f' AND heading='%f'", zone->GetShortName(), target->GetX(), target->GetY(), target->GetHeading()), errbuf, &result)) {
if (mysql_num_rows(result) == 1) {
row = mysql_fetch_row(result);
delete[] query;
mysql_free_result(result);
tmp = atoi(row[0]);
if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET x='%f', y='%f', z='%f', heading='%f' WHERE id='%i'",this->GetX(), this->GetY(), this->GetZ(), this->GetHeading(),tmp), errbuf, 0)){
Message(0, "Updating coordinates successful.");
delete[] query;
target->Depop(false);
}
else {
Message(0, "Update failed, UPDATE command error!");
delete[] query;
mysql_free_result(result);
}
}
else {
delete[] query;
mysql_free_result(result);
Message(0, "Update failed, duplicate spawns detected!");
}
}
else {
delete[] query;
mysql_free_result(result);
Message(0, "Update failed, SELECT command error!");
}
}
}
#endif

Wolfman
06-19-2003, 12:13 PM
You rule Bigpull :)