[ANNONCE] GNUfo v 0.2 [ BUG FIXE V 0.3 ]

Charles Vidal wrote:

David Snopek wrote:

After about 30 seconds of play I get either a floating-point exception
or a segfault. I ran ufo through gdb a couple times and the segfault
comes from SDLSprite::Draw().
It doesn’t give me a line number so
’this’ might me uninitialized?
I’ll work on it.
I have worked on this bug :).
I think it’s something like that :
for(Node = head; Node != NULL; Node = Node->m_Next)
if (WhatHappens()==1) {
// If Node == NULL the continue make Node=Node->m_Next and core dump
if (Node==NULL) break;
if (ShouldRemove()==1) { …

Why do I have make this WhatHappen and ShouldRemove ?
To don’t rewrite the loop , and overload only the WhatHappens method
and ShouldRemove in object herited.

if Node is modify in WhatHappens or ShouldRemove return 1 ,
then Node could be NULL and then core dump.

Hum, I don’t know why I don’t make something like that:
for(Node = head; Node != NULL; Node = Node->m_Next)
if (WhatHappens()==1) {
SDLSprite *Tmp;
Tmp = Node->m_Next; DelSprite(Node); Node = Tmp;
if (Node==NULL) break;
else continue;

charles vidal