Skip to main content
Topic: r2022 - very old games which have wrong month cause crash (Read 4011 times) previous topic - next topic

r2022 - very old games which have wrong month cause crash

simutrans r2022 GDI

Very old games (86.00, 86.05) seem to have wrong month value in save game.
As a result of this change in r1912...
- some games cause crash when loading (r1983 and after version), or date back (r1912-r1982)
- some games jump to the future, for example, from 04/2001 to 01/2072

Quote
Call stack:
004441A0  sim1983.exe:004441A0  translator::lang_info::translate(char const*) const  translator.cc:34
   ...
   {
   if (text    == NULL) return "(null)";
>   if (text[0] == '\0') return text;
   const char* trans = texts.get(text);
   return trans != NULL ? trans : text;

Patch attached.

Quote
Index: simworld.cc
===================================================================
--- simworld.cc   (r2022)
+++ simworld.cc   (copy)
@@ -3136,6 +3136,8 @@
    if(file->get_version()<86006) {
       letztes_jahr += umgebung_t::starting_year;
    }
+   // old game might have wrong month
+   letzter_monat %= 12;
    // set the current month count
    setze_ticks_bits_per_tag(einstellungen->gib_bits_per_month());
    current_month = letzter_monat + (letztes_jahr*12);

Re: r2022 - very old games which have wrong month cause crash

Reply #1
Thank you.

[solved]Re: r2022 - very old games which have wrong month cause crash

Reply #2
Solved in r2029. Thank you.