09 Oct, 2012, Miker wrote in the 1st comment:
Votes: 0
I have recently just converted my SWFotE 2.0 base to C++. It compiles and runs smoothly except for a crash when a player looks in the same room as another player. If I comment out the function call in question, the MUD will run just fine.

The offending section of code is:
void show_char_to_char( CHAR_DATA *list, CHAR_DATA *ch )
{
CHAR_DATA *rch;
for( rch = list; rch; rch = rch->next_in_room ) /* RIGHT HERE!!! */
{


Some GDB output:
808        for( rch = list; rch; rch = rch->next_in_room )
(gdb) print list->name
$1 = 0x89de6b8 "Drozel"
(gdb) print ch->name
$2 = 0xffff0424 <Address 0xffff0424 out of bounds>
(gdb) print rch->name
Cannot access memory at address 0x3b315caf


Where it calls show_char_to_char, list and ch point to character "Drozel". So somewhere between the call and the function, something happens to ch. However, if I were to convert this code back to regular C, then it compiles and runs fine. Any ideas? Need more information?
10 Oct, 2012, quixadhal wrote in the 2nd comment:
Votes: 0
When you say "converted" to C++, I assume you mean "made able to compile with a C++ compiler", since nothing in the above code snippets is C++ specific in any way?

Does it crash on the first iteration of the loop, or after it's done "stuff" to the structures in question? Since ch->name is out of bounds, but rch is cannot access, perhaps you changed a struct to a class somewhere, and forgot to change the visibility to public? If I remember right, C++ treats all members of a struct as public, but a class defaults to private.

I'd suggest waking up the stack and seeing if ch is still valid in the frame before show_char_to_char, so you know if something was changed as you walked the list, or if it was a local variable that got moved.
11 Oct, 2012, Miker wrote in the 3rd comment:
Votes: 0
There's a bug somewhere in the color code. I replaced it with my custom color code which is actual C++ code so now there's no problem.
0.0/3