2
« on: July 26, 2004, 07:48:17 pm »
Heres a quickfix. I only just recently downloaded and compiled the source and haven\'t been able to do much testing. I\'ve got as far as the character creation screen now, but apparently i need to download some missing graphic files.
Replace function with,
const char *psResultRow::operator[](const char *fieldname)
{
CS_ASSERT(fieldname);
CS_ASSERT(max); // trying to access when no fields returned in row! probably empty resultset.
CS_ASSERT(MAX_TABLE_FIELDS > max); // if assert on startup, increase MAX_TABLE_FIELDS.
int i;
// If not stored, store or all field names.
if( !fields )
{
for (i=0 ; i < max ; i++)
{
if(( fields = mysql_fetch_field (rs)) != NULL) {
strcpy(field_buffer, fields->name);
} else CS_ASSERT(0);
}
}
// search for specified field name in temp buffer.
for ( i=0 ; i < max ; i++ )
{
if (!strcasecmp(field_buffer,fieldname))
{
return rr;
}
}
printf(\"Could not find field %s!. Exiting.\\n\",fieldname);
CS_ASSERT(false);
return \"\"; // Illegal name.
}
Add the lines below to dal.h
#define MAX_TABLE_FIELDS 100
char field_buffer[MAX_TABLE_FIELDS][60]; <-- put in public section
It would probably be to make field_buffer private and add some handlers or better yet replace arrays with something more efficient.