News:

SimuTranslator
Make Simutrans speak your language.

r7572: core dump on pressing of unassigned key

Started by captain crunch, September 04, 2015, 11:32:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

captain crunch

Since r7572 simutrans dumps core when I press an unassigned key.
In previous versions the help window popped up to show which key does what.
Last line of debug log is:

Message: interaction_t::interactive_event():    Keyboard event with code 257 '?'
sim: boden/wege/weg.cc:98: static weg_t* weg_t::alloc(waytype_t): Assertion `0' failed.



Ters

I don't think you've pressed an unassigned key, because the only way I can see this crash is when a tool has been activated.

Most likely, this comes from tool_build_way_t::get_besch, which seems to have some dubious code. If wegbauer_t::get_besch() returns NULL, it then parses default_param as an integer representing a way type. Next it ands that number with 63, meaning that the number can be anything from 0 through 63. Then it indexes an array with the resulting number, but the array is only 17 elements long, so there is a risk of going out of bounds. If the array lookup returns NULL, it then tries to create a way of the particular way type (the unanded value) to see what gets created, then remembers that and deletes the way again. The crash probably happens because the way type (parsed from default_param) doesn't represent a valid way type, so that the attempt to create a way fails.

Dwachs

should be fixed with r7579, kind of duct-tape fix.
Parsley, sage, rosemary, and maggikraut.

jamespetts

May I suggest a better fix for this as here? This is my version of the fix from Experimental, but I believe that the relevant parts of the code are the same.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Dwachs

This is a fix to a different issue: the default way could be not available for time line games. Thanks for the reminder. I committed a fix in r7580
Parsley, sage, rosemary, and maggikraut.