The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: ny911 on November 27, 2014, 03:46:29 PM

Title: [r7371] scenario - halt.accepts_good
Post by: ny911 on November 27, 2014, 03:46:29 PM

    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.
Title: Re: [r7371] scenario - halt.accepts_good
Post by: prissi on November 27, 2014, 10:48:34 PM
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.
Title: Re: [r7371] scenario - halt.accepts_good
Post by: ny911 on November 30, 2014, 02:45:33 PM
tested in r7386, works/run with "NONE" and didn't crash, thanks