News:

SimuTranslator
Make Simutrans speak your language.

[r7371] scenario - halt.accepts_good

Started by ny911, November 27, 2014, 03:46:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ny911


    local halt = square_x( 16, 16 ).get_player_halt( player_x( 0 ) )
    local good = good_desc_x( "Passagiere" )
    return "Accepts good = " + halt.accepts_good( good )


Well the code above works fine as long as you didn't enter a wrong pakset good name for "good_desc_x()"  (be sure it is a string and the right language for the pakset and a plyer=0 station at x,y) . Having a wrong good name like "passagier", "Passanger", "Pax", ... this didn't stops the script with an error, it will crash the simutrans engine (and partly the total system!!!) one line later at "halt.accepts_good( good )", without an usefull information in the log file.

A simple check in the method "halt.accepts_good()"  to return a normal script error would be great as long the method "good_desc_x()" didn't catch the wrong name and returns an error.

prissi

Sorry, I really had troubles to dechiffer the macro madness (#defined defining templates that contains macros ... ). Hence I am all for returning NONE as ware for unknown names. No halt should enable those anyway.

ny911

tested in r7386, works/run with "NONE" and didn't crash, thanks