[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] Re: Map view progress ...

From: Julien Laumonier
Subject: Re: [Adonthell-devel] Re: Map view progress ...
Date: Wed, 09 Jul 2008 22:18:35 -0700
User-agent: Thunderbird (X11/20080522)

Kai Sterker wrote:
Second, I have weird things going on with the controls. Moving left or
right works, but as soon as I move up or down, the character starts
walking in the opposite direction with no way to stop or change
direction again.

I've tested this on my work laptop and get the same behavior. That
rules out SDL. A second test with the 0.4 alpha 2 release wasn't
affected, but a diff between the two didn't reveal anything that would
have been obvious. Seems to be a case for the debugger ...

Not sure if it is the same bug but i get a close related bug with
worldtest with DEBUG_COLLISION on gcc 4.3. After moving the character,
it cannot be stopped and seems to walk in a random direction, but not
each time ! After hours of intensive debugging, I found that the member
CurrentDir of the class character has not the same address for reading
and for writing !! This behavior seems to appear because the reading
part is in the header file and the writing part is in the .cc file. It
could be a gcc bug but I didn't test with an other version. However, I
checked why this behavior appears and it seems that when DEBUG_COLLISION
is set, a new member (Image in the moving class) is used and seems to be
not correctly handled. I am not sure about that but maybe you should
check the resize() method which seems not to reallocate the data itself
but just the position and size members. Consequently, when data is
writen, CurrentDir could be erased.

In summary, I suggest many ways of dealing with this strange behavior :
1) Do not use DEBUG_COLLISION_ : not very useful but quick
2) Move the current_dir() method in the file : correct the
behavior but not the reasons
3) Check the moving class or the resize method or any related thing.

I tested with gcc 4.3 on i386 and X86_64, and the random behavior always
appears. Maybe it is not visible with an other version of gcc because of
an other organization of the class members.

Another aspect on the map_view class is the initialization of the
members. Args and Schedule should be initialized to NULL. Otherwise it
could result in a segfault during the set_schedule() method.

Hope this help

Julien Laumonier

reply via email to

[Prev in Thread] Current Thread [Next in Thread]