Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] Re: (PR#9499) We should call sanity_check after loading a
Home

[Freeciv-Dev] Re: (PR#9499) We should call sanity_check after loading a

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#9499) We should call sanity_check after loading a game
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Mon, 26 Jul 2004 01:47:11 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9499 >

> > With this patch it will be much easier to distinguish between
> > incompatible savegames and "real" bugs.
> >
> > --
> > mateusz
> 
> >
> > +  sanity_check();
> > +
> It isn't so easy.
> If the savegame contains no map server crashes.
This patch fixes it
--
mateusz

Tylko w freeciv: savegame.c
diff -ur -Xdiff_ignore freeorig/server/sanitycheck.c 
freeciv/server/sanitycheck.c
--- freeorig/server/sanitycheck.c       2004-07-13 23:54:17.000000000 +0200
+++ freeciv/server/sanitycheck.c        2004-07-26 10:37:55.000000000 +0200
@@ -367,12 +367,14 @@
 **************************************************************************/
 void sanity_check(void)
 {
-  check_specials();
-  check_fow();
+  if (!map_is_empty()) {
+    check_specials();
+    check_map();
+    check_cities();
+    check_units();
+    check_fow();
+  }
   check_misc();
-  check_map();
-  check_cities();
-  check_units();
   check_players();
 }
 
diff -ur -Xdiff_ignore freeorig/server/stdinhand.c freeciv/server/stdinhand.c
--- freeorig/server/stdinhand.c 2004-07-26 09:46:14.000000000 +0200
+++ freeciv/server/stdinhand.c  2004-07-26 10:30:35.000000000 +0200
@@ -55,6 +55,7 @@
 #include "plrhand.h"
 #include "report.h"
 #include "ruleset.h"
+#include "sanitycheck.h"
 #include "savegame.h"
 #include "sernet.h"
 #include "srv_main.h"
@@ -4140,6 +4141,8 @@
           read_timer_seconds_free(loadtimer),
           read_timer_seconds_free(uloadtimer));
 
+  sanity_check();
+
   /* attach connections to players. currently, this applies only 
    * to connections that have the correct username. Any attachments
    * made before the game load are unattached. */
Tylko w freeciv/server: x.gz



[Prev in Thread] Current Thread [Next in Thread]