The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: z9999 on September 17, 2008, 04:31:16 PM

Title: r2022 - very old games which have wrong month cause crash
Post by: z9999 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 (http://archive.forum.simutrans.com/topic/08015.0/index.html) 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);
Title: Re: r2022 - very old games which have wrong month cause crash
Post by: prissi on September 19, 2008, 08:48:14 PM
Thank you.
Title: [solved]Re: r2022 - very old games which have wrong month cause crash
Post by: z9999 on September 20, 2008, 12:44:36 PM
Solved in r2029. Thank you.