The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Dwachs on November 01, 2013, 11:49:06 AM

Title: Patch: citycar calc current speed
Post by: Dwachs on November 01, 2013, 11:49:06 AM
Here is a small patch to  stadtauto_t::calc_current_speed: it saves calls to welt->lookup.

Where does this magic speed of 48 come from (if the car has to make a turn). The patch removes this, but could kept as well.
Title: Re: Patch: citycar calc current speed
Post by: prissi on November 01, 2013, 03:03:37 PM
Since city car have now way to find out, if they are stuck or not, they use the speed to indicate it. Due to the simple acceleration system, they take out speed after curves quickly, hence this empirical value. May need to be checked in regard to the wide variety of paksets and speeds.
Title: Re: Patch: citycar calc current speed
Post by: Dwachs on November 02, 2013, 08:31:57 AM
This value (48) seems to be used as current_speed when a citycar starts driving. There are no checks whether current_speed is equal to 48.

It seems to have no side effects if in calc_current_speed the speed is not set to 48 if the citycar makes a turn.
Title: Re: Patch: citycar calc current speed
Post by: prissi on November 02, 2013, 10:03:15 AM
You are right, the special numbers are not needed, as there is a timer since a while. I forgot about this sorry. Please submit.
Title: Re: Patch: citycar calc current speed
Post by: Dwachs on November 02, 2013, 05:18:11 PM
in r6879