Log in

View Full Version : 5.5DR1 Character Creation bug


tofuwarrior
02-23-2004, 01:06 PM
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:

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:

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:


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 (

samandhi
02-23-2004, 03:43 PM
After this.. I was able to create characters properly. I still can't zone into the game without crashing the client though ( Have you installed dx9? SOE is going to dx9 as of the 18th patch....

tofuwarrior
02-23-2004, 11:45 PM
I think I have DX9... I will confirm that later today.

Edit: Yep.. I have DX 9.0b

netmazk
02-26-2004, 05:15 PM
Just wanted to repport that I'm having the same problem, with world dying after character creation. I tried the fix you posted above, tofuwarrior, but it didn't seem to help. Hopefull I'll have some time to poke at this over the weekend

edit: here's where it dies on me: (linux 2.4.25)

Name approval request for:Netmazk race:6 class:11
Character creation request from netmazk LS#3213 (x.x.x.x:3853) :
Name: Netmazk
Race: 6 Class: 11 Gender: 0 Deity: 206 Start zone: 5
STR STA AGI DEX WIS INT CHA Total
60 65 90 90 83 134 60 582
Face: 3 Eye colors: 0 0
Hairstyle: 0 Haircolor: 0
Beard: 0 Beardcolor: 0
Validating char creation info...
Found 0 errors in character creation request

[2] Segmentation fault ./world

tofuwarrior
02-27-2004, 04:54 AM
That is more or less exactly what happened to me before I made the fix I mentioned. I'm working under Windows though so perhaps there is some MySQL difference -or- you might have a different DB than I'm using.

I got the NPCMOVDB and applied the patches from Shawn 319's site.

You can also simply avoid the problem by commenting out a database check for starting locations and use the hard-coded ones that are used if it doesnt find anythign in the database.

Dranyam
03-04-2004, 08:54 AM
I was having the exact same problem and tofuwarrior's solution in his first post fixed this for me. Thanks, tofuwarrior.