View Single Post
  #1  
Old 02-23-2004, 01:06 PM
tofuwarrior
Fire Beetle
 
Join Date: Feb 2004
Posts: 19
Default 5.5DR1 Character Creation bug

I found worlddebug.exe blowing up on me during character creation and I narrowed it down to a bug in database.cpp

The problem is in:

bool Database::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc)

The original code looked like this:
Code:
if((rows = mysql_num_rows(result)) == 1) row = mysql_fetch_row(result);
if(result) mysql_free_result(result);	

if(row)
{         
	LogFile->write(EQEMuLog::Status, "Found starting location in start_zones");
	in_pp->x = atoi(row[0]); 
	in_pp->y = atoi(row[1]); 
	in_pp->z = atoi(row[2]); 
	in_pp->zone_id = atoi(row[3]); 
	in_pp->bind_zone_id = atoi(row[4]); 
}
The problem with this was that, on my system anyway, when mysql_free_result was called... row was no longer a valid pointer but it was also not 0. For this reason, the first atoi call caused the system to crash.

I modifed this section to this:
Code:
rows = mysql_num_rows(result);

LogFile->write(EQEMuLog::Status, "Rows returned %d\n",rows);

if(rows == 1) row = mysql_fetch_row(result);
	
if(row)
{         
	LogFile->write(EQEMuLog::Status, "Found starting location in start_zones... ");
	in_pp->x = atoi(row[0]); 
	in_pp->y = atoi(row[1]); 
	in_pp->z = atoi(row[2]); 
	in_pp->zone_id = atoi(row[3]); 
	in_pp->bind_zone_id = atoi(row[4]); 
	LogFile->write(EQEMuLog::Status, "success! \n");
}
and I moved the mysql_free_result to the end:

Code:
	
if(result) mysql_free_result(result);

if(in_pp->x == 0 && in_pp->y == 0 && in_pp->z == 0)	database.GetSafePoints(in_pp->zone_id, &in_pp->x, &in_pp->y, &in_pp->z);

if(in_pp->bind_x == 0 && in_pp->bind_y == 0 && in_pp->bind_z == 0) database.GetSafePoints(in_pp->bind_zone_id, &in_pp->bind_x, &in_pp->bind_y, &in_pp->bind_z);

LogFile->write(EQEMuLog::Status, "Returning True from GetStartZone\n");
return true;
}
After this.. I was able to create characters properly. I still can't zone into the game without crashing the client though (
Reply With Quote