News:

SimuTranslator
Make Simutrans speak your language.

Citycar speed increases every time the map is saved

Started by ceeac, September 05, 2020, 01:46:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ceeac

At the end of private_car_t::rdwr (line 462) there is this piece of code:

// do not start with zero speed!
current_speed ++;

This increases the speed of all private cars, even when saving the game while paused. It is therefore possible to make private cars "teleport" to the beginning of the next tile by pausing the game, saving it a large number of times, then un-pausing again :)

Is the code actually required? If yes, the code should probably be changed to something like this:

if (file->is_loading()) {
current_speed = max(current_speed, 1);
}


Fixing this bug will also make sure that save files are byte-equal when saving the game twice in a row while paused (That is how I found the bug in the first place.)

Dwachs

Funny! These particular lines are at least 14 years old.

I think these two lines can be deleted. If speed is zero, it will be corrected in sync_step.
Parsley, sage, rosemary, and maggikraut.

prissi