The International Simutrans Forum

 

Author Topic: r2022 - very old games which have wrong month cause crash  (Read 3019 times)

0 Members and 1 Guest are viewing this topic.

Offline z9999

  • Devotees (Inactive)
  • *
  • Posts: 848
r2022 - very old games which have wrong month cause crash
« on: September 17, 2008, 04:31:16 PM »
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);

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10820
  • Languages: De,EN,JP
Re: r2022 - very old games which have wrong month cause crash
« Reply #1 on: September 19, 2008, 08:48:14 PM »
Thank you.

Offline z9999

  • Devotees (Inactive)
  • *
  • Posts: 848
[solved]Re: r2022 - very old games which have wrong month cause crash
« Reply #2 on: September 20, 2008, 12:44:36 PM »
Solved in r2029. Thank you.