#12229 stopped updating motion_counter for non-engine parts of trains, and in doing so accidentally followed the spec for NewGRF var 46, which breaks NewGRFs that used to... accidentally work.
Make var 46 return motion_counter of the first engine, regardless of self or parent scope. This means var 46 is always in sync with the head engine, and avoids further changes to when motion_counter is updated.
(cherry picked from commit 9539b02455f672e11f3ac32302a00cffa5507770)
3 weeks ago
20 changed files with 93 additions and 72 deletions
SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE,stdstr_fmt("Temporary save file does not have expected file size: "PRINTF_SIZE" != "PRINTF_SIZE,(size_t)st.st_size,save_size));
}
#if defined(_WIN32)
/* Renaming over an existing file is not supported on Windows, manually unlink the target filename first */
unlink(this->target_name.c_str());
#endif
if(!FioRenameFile(this->temp_name,this->target_name))SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE,"Failed to rename temporary save file to target name");
this->temp_name.clear();// Now no need to unlink temporary name