Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] Re: (PR#10716) is_observer entry needed for savegame
Home

[Freeciv-Dev] Re: (PR#10716) is_observer entry needed for savegame

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#10716) is_observer entry needed for savegame
From: "Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 3 Nov 2004 19:57:08 -0800
Reply-to: rt@xxxxxxxxxxx

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

making sure that we don't save a player who is a global observer is
actually quite hard to get right.

So we go back to the simple and easy solution. save is_observer to the
savegame. Compatibility with old savegames is ok, a game can tolerate two
observers.

-mike

Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.197.2.5
diff -u -r1.197.2.5 savegame.c
--- server/savegame.c   29 Oct 2004 12:33:57 -0000      1.197.2.5
+++ server/savegame.c   4 Nov 2004 03:51:01 -0000
@@ -1713,6 +1713,8 @@
   plr->nturns_idle=0;
   plr->is_male=secfile_lookup_bool_default(file, TRUE, "player%d.is_male", 
plrno);
   plr->is_alive=secfile_lookup_bool(file, "player%d.is_alive", plrno);
+  plr->is_observer=secfile_lookup_bool_default(file, FALSE, 
+                                               "player%d.is_observer", plrno);
   plr->ai.control = secfile_lookup_bool(file, "player%d.ai.control", plrno);
   for (i = 0; i < MAX_NUM_PLAYERS; i++) {
     plr->ai.love[i]
@@ -2436,6 +2438,7 @@
 
   secfile_insert_bool(file, plr->is_male, "player%d.is_male", plrno);
   secfile_insert_bool(file, plr->is_alive, "player%d.is_alive", plrno);
+  secfile_insert_bool(file, plr->is_observer, "player%d.is_observer", plrno);
   secfile_insert_bool(file, plr->ai.control, "player%d.ai.control", plrno);
   for (i = 0; i < MAX_NUM_PLAYERS; i++) {
     secfile_insert_int(file, plr->ai.love[i],

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#10716) is_observer entry needed for savegame, Mike Kaufman <=