News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

[patch] Game crashes while withdrawing convoy

Started by Bernd Gabriel, December 31, 2009, 03:27:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bernd Gabriel

This patch fixes two errors, which accessed a convoi_t object after its self destruction.
Ivansanchez posted this error in the Simutrans Experimental topic http://forum.simutrans.com/index.php?topic=4126.0
The journey is the reward!

Dwachs

is there a specific procedure to trigger a crash?

Does the attached patch also fix the issue? (I did not like the implicit state-change in laden())
Parsley, sage, rosemary, and maggikraut.

Bernd Gabriel

#2
Yes, but the savegame is an experimental 7.1 savegame using pak128.Britain.Exp: Withdraw all 800 convoys from line "Newcastle-Cambridge cattle convoy".

No, your patch still continues to use deleted object data in step() after returning from laden(). step() must return before the line switch(state) accesses state. Therefore laden() should not destroy the object, but return a flag, that the object has to be destroyed, which is done best by setting state to SELF_DESTRUCT.

Hm, I should learn to read...
Your patch will delete the convoy in the next step. You should check the impact of this changed behaviour.
The journey is the reward!

Dwachs

I see. Thank you very mch. Will be included next year:))
Parsley, sage, rosemary, and maggikraut.

prissi

The world needs to step convois backwards then. So I added there a fix too.