Hello!

I started modifying the code to have actions sent over network replayed
at the exact time they have been sent (most of the code was already
there thanks to drayan). The patch in attachement does this, but i can't
commit it since it adds a really weird bug that I have no clue how to solve..

If someone would like to give it a try, here is an extract of a gdb session
that shows it:

(gdb) break action_handler.cpp:631
(break inside ActionHandler::NewAction)

(gdb) r

(start a single player game)
[...]

Breakpoint 1, ActionHandler::NewAction (this=0x998f208, a=0x9accb38, 
    repeat_to_network=true) at include/action_handler.cpp:631
631       queue.push_back(a);
(gdb) n
633       SDL_UnlockMutex(mutex);
(gdb) print a->GetTimestamp()
$1 = 0
(gdb) print queue.back()->GetTimestamp()
Cannot evaluate function -- may be inlined
(gdb) print queue.size()
$2 = 1
(gdb) print queue.front()->GetTimestamp()
$3 = 162320416
(gdb) print queue.front()
$4 = (Action *&) @0x9acd310: 0x9accb38
(gdb) print a
$5 = (Action *) 0x9accb38

The explanation: the first action added to queue have a different timestamp
when the GetTimestamp() is called on 'a' and when it's called on 
queue.front(). This when, queue.front() == a .

The bug doesn't (seems to) happen when the patch is not applied. I have
tried a make clean/make ;), and i reproduced on a gentoo and a mandriva
with gcc v4.1.2.

Tell me if you can find something.
Thanks

Lodesi

-- 
_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à