News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

r2022 - very old games which have wrong month cause crash

Started by z9999, September 17, 2008, 04:31:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

z9999

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);


z9999