Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#10862) global observing and allowtake
Home

[Freeciv-Dev] (PR#10862) global observing and allowtake

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10862) global observing and allowtake
From: "Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 3 Nov 2004 19:01:27 -0800
Reply-to: rt@xxxxxxxxxxx

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

if allowtake does not have 'd' (which happens to be how pubserver is set up
right now), then you can create a global observer (and maybe attach to it
once?) but actually observing is impossible unless you change allowtake.

The attached patch adds the 'O' and 'o' characters to allowtake which
allows or restricts people from globally observing.

-mike

? .swp
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.152.2.1
diff -u -r1.152.2.1 game.h
--- common/game.h       11 Oct 2004 20:30:03 -0000      1.152.2.1
+++ common/game.h       4 Nov 2004 02:37:06 -0000
@@ -478,7 +478,7 @@
 #define GAME_OLD_DEFAULT_SKILL_LEVEL 5  /* normal; for old save games */
 
 #define GAME_DEFAULT_DEMOGRAPHY      "NASRLPEMOqrb"
-#define GAME_DEFAULT_ALLOW_TAKE      "HAhad"
+#define GAME_DEFAULT_ALLOW_TAKE      "HAhadOo"
 
 #define GAME_DEFAULT_COMPRESS_LEVEL 6    /* if we have compression */
 #define GAME_MIN_COMPRESS_LEVEL     0
Index: server/settings.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settings.c,v
retrieving revision 1.5.2.4
diff -u -r1.5.2.4 settings.c
--- server/settings.c   21 Oct 2004 15:39:36 -0000      1.5.2.4
+++ server/settings.c   4 Nov 2004 02:37:07 -0000
@@ -109,7 +109,7 @@
 
   for (i = 0; i < len; i++) {
     /* Check to see if the character is a primary label. */
-    if (strchr("HhAadb", value[i])) {
+    if (strchr("HhAadbOo", value[i])) {
       havecharacter_state = TRUE;
       continue;
     }
@@ -852,6 +852,7 @@
                 "letters. This only affects future uses of the take or "
                 "observe command; it is not retroactive. The characters "
                "and their meanings are:\n"
+                "    o,O = Global observer\n"
                 "    b   = Barbarian players\n"
                 "    d   = Dead players\n"
                 "    a,A = AI players\n"
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.354.2.6
diff -u -r1.354.2.6 stdinhand.c
--- server/stdinhand.c  23 Oct 2004 20:02:55 -0000      1.354.2.6
+++ server/stdinhand.c  4 Nov 2004 02:37:08 -0000
@@ -2453,7 +2453,19 @@
 {
   const char *allow;
 
-  if (is_barbarian(pplayer)) {
+  if (pplayer->is_observer) {
+    if (!(allow = strchr(game.allow_take, (game.is_new_game ? 'O' : 'o')))) {
+      if (will_obs) {
+        mystrlcpy(msg, _("Sorry, one can't observe globally in this game."),
+                  MAX_LEN_MSG);
+      } else {
+        mystrlcpy(msg, _("Sorry, you can't take a global observer. Observe "
+                         "it instead."),
+                  MAX_LEN_MSG);
+      }
+      return FALSE;
+    }
+  } else if (is_barbarian(pplayer)) {
     if (!(allow = strchr(game.allow_take, 'b'))) {
       if (will_obs) {
         mystrlcpy(msg, _("Sorry, one can't observe barbarians in this game."),
@@ -2605,7 +2617,8 @@
       }
 
       pplayer = &game.players[game.nplayers];
-      server_player_init(pplayer, server_state == RUN_GAME_STATE);
+      server_player_init(pplayer, 
+                         (server_state == RUN_GAME_STATE) || 
!game.is_new_game);
       sz_strlcpy(pplayer->name, OBSERVER_NAME);
       sz_strlcpy(pplayer->username, ANON_USER_NAME);
 
@@ -2617,7 +2630,7 @@
       pplayer->is_alive = FALSE;
       pplayer->was_created = FALSE;
 
-      if (server_state == RUN_GAME_STATE) {
+      if ((server_state == RUN_GAME_STATE) || !game.is_new_game) {
         pplayer->nation = OBSERVER_NATION;
         init_tech(pplayer, 0);
         map_know_and_see_all(pplayer);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10862) global observing and allowtake, Mike Kaufman <=