Complete.Org: Mailing Lists: Archives: freeciv-dev: August 1999:
[Freeciv-Dev] [Fwd: turn-blocking game play patch]
Home

[Freeciv-Dev] [Fwd: turn-blocking game play patch]

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "freeciv-dev@xxxxxxxxxxx" <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] [Fwd: turn-blocking game play patch]
From: Gary Moyer <garymoyer@xxxxxxxx>
Date: Mon, 23 Aug 1999 12:19:10 -0700

> Well with much guidance from all of you I've re-worked the turn-blocking
> (was synchronous game play) patch.  Hopefully everyone will be happy
> with this.
>
> Here's a summary of the changes:
>
> 1) added turnblock member to the game structure
> 2) modified check_for_full_turn_done(): if turnblock is enabled return 1
> iff all players have completed their turn
> 3) added turnblock to save/restore game
> 4) added message at login describing which players still have to
> complete their turn
> 5) added turnblock visibility in game options from civclient
>
> Special thanks to David Pfitzner for all the help (and yes you were
> absolutely right about check_for_full_turn_done() ;).
>
> Unless I hear otherwise I'll assume these changes are golden.
>
> -- Gary
--- game.h      1999/08/22 06:33:07     1.1
+++ game.h      1999/08/22 06:33:58
@@ -92,6 +92,7 @@
     int nav;                   /* AI convenience: tech_req for first
                                   non-trireme ferryboat */
   } rtech;
+  int turnblock; /* eg turn-blocking game play */
 };
 
 struct lvldat {
--- packets.c   1999/08/22 06:47:44     1.1
+++ packets.c   1999/08/22 06:48:45
@@ -907,6 +907,7 @@
   cptr=get_int8(cptr, &pinfo->rtech.cathedral_plus);
   cptr=get_int8(cptr, &pinfo->rtech.cathedral_minus);
   cptr=get_int8(cptr, &pinfo->rtech.colosseum_plus);
+  cptr=get_int8(cptr, &pinfo->turnblock);
 
   remove_packet_from_buffer(&pc->buffer);
   return pinfo;
--- packets.h   1999/08/22 06:45:23     1.1
+++ packets.h   1999/08/22 06:46:03
@@ -484,6 +484,7 @@
     int cathedral_minus;
     int colosseum_plus;
   } rtech;
+  int turnblock;
 };
 
 /*********************************************************
--- civserver.c 1999/08/18 18:13:34     1.1
+++ civserver.c 1999/08/23 06:46:43
@@ -128,6 +128,7 @@
 
 int rand_init=0;
 
+
 /**************************************************************************
 ...
 **************************************************************************/
@@ -456,7 +457,7 @@
 
     freelog(LOG_DEBUG, "sniffingpackets");
     while(sniff_packets()==1);
-    
+
     for(i=0;i<game.nplayers;i++)
       connection_do_buffer(game.players[i].conn);
     freelog(LOG_DEBUG, "Autosettlers");
@@ -1077,11 +1078,18 @@
 {
   int i;
 
-  for(i=0; i<game.nplayers; i++)
-    if(game.players[i].conn && game.players[i].is_alive && 
-       !game.players[i].turn_done) {
-      return 0;
+  for(i=0; i<game.nplayers; i++) {
+    if (game.turnblock) {
+      if (!game.players[i].ai.control && game.players[i].is_alive &&
+          !game.players[i].turn_done)
+        return 0;
+    } else {
+      if(game.players[i].conn && game.players[i].is_alive && 
+         !game.players[i].turn_done) {
+        return 0;
+      }
     }
+  }
   force_end_of_sniff=1;
   return 1;
 }
@@ -1205,6 +1213,26 @@
     notify_player(pplayer, "Welcome to the %s Server",
                  FREECIV_NAME_VERSION);
   }
+
+  /* tell who we're waiting on to end the game turn */
+  if (game.turnblock) {
+    for(i=0; i<game.nplayers;++i) {
+      if (game.players[i].is_alive &&
+          !game.players[i].ai.control &&
+          !game.players[i].turn_done) {
+
+         /* skip current player */
+         if (&game.players[i] == pplayer) {
+           continue;
+         }
+
+         notify_player(pplayer,
+                       "turn-blocking game play: waiting on %s to finish 
turn...",
+                       game.players[i].name);
+      }
+    }
+  }
+
   if (server_state==RUN_GAME_STATE) {
     /* if the game is running, players can just view the Players menu?  --dwp 
*/
     return;
--- gamehand.c  1999/08/22 06:49:46     1.1
+++ gamehand.c  1999/08/23 06:07:07
@@ -171,6 +171,7 @@
   ginfo.rtech.cathedral_plus = game.rtech.cathedral_plus;
   ginfo.rtech.cathedral_minus = game.rtech.cathedral_minus;
   ginfo.rtech.colosseum_plus = game.rtech.colosseum_plus;
+  ginfo.turnblock = game.turnblock;
 
   for(o=0; o<game.nplayers; o++)           /* dests */
     if(!dest || &game.players[o]==dest) {
@@ -304,6 +305,8 @@
                                               "game.diplchance");
   game.aqueductloss = secfile_lookup_int_default(file, game.aqueductloss,
                                                 "game.aqueductloss");
+  game.turnblock = secfile_lookup_int_default(file,game.turnblock,
+                         "game.turnblock");
   
   if(has_capability("unirandom", savefile_options)) {
     game.randseed = secfile_lookup_int(file, "game.randseed");
@@ -491,6 +494,7 @@
   secfile_insert_int(file, game.diplchance, "game.diplchance");
   secfile_insert_int(file, game.aqueductloss, "game.aqueductloss");
   secfile_insert_int(file, game.randseed, "game.randseed");
+  secfile_insert_int(file, game.turnblock, "game.turnblock");
   secfile_insert_str(file, game.ruleset.techs, "game.ruleset.techs");
   secfile_insert_str(file, game.ruleset.units, "game.ruleset.units");
   secfile_insert_str(file, game.ruleset.buildings, "game.ruleset.buildings");
--- stdinhand.c 1999/08/19 02:25:08     1.1
+++ stdinhand.c 1999/08/22 06:43:34
@@ -466,6 +466,13 @@
     "  Only applies if the game log feature is enabled (with the -g command 
line\n"
     "  option).  Levels: 0=no logging, 20=standard logging, 30=detailed 
logging,\n"
     "  40=debuging logging." },
+
+  { "turnblock", &game.turnblock,
+       SSET_META, SSET_TO_CLIENT,
+       0,1,0,
+       "Turn-blocking game play mode",
+       "  If this is set to 1 the game turn is not advanced until\n"
+       "  all players have finished their turn."},
   
   { NULL, NULL,
     SSET_LAST, SSET_SERVER_ONLY,
--- packhand.c  1999/08/23 06:19:52     1.1
+++ packhand.c  1999/08/23 06:20:31
@@ -601,6 +601,7 @@
 
   game.aqueduct_size = pinfo->aqueduct_size;
   game.sewer_size = pinfo->sewer_size;
+  game.turnblock = pinfo->turnblock;
   game.rtech.get_bonus_tech = pinfo->rtech.get_bonus_tech;
   game.rtech.boat_fast = pinfo->rtech.boat_fast;
   game.rtech.cathedral_plus = pinfo->rtech.cathedral_plus;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] [Fwd: turn-blocking game play patch], Gary Moyer <=