Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#9942) planned unit movement
Home

[Freeciv-Dev] (PR#9942) planned unit movement

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: lakatoszoltan@xxxxxxxxxx
Subject: [Freeciv-Dev] (PR#9942) planned unit movement
From: "Guest" <rt-guest@xxxxxxxxxxx>
Date: Tue, 5 Oct 2004 21:13:44 -0700
Reply-to: rt@xxxxxxxxxxx

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

 
 
diff -r -u -b freeciv-cvs-Oct-01/common/game.c 
freeciv-cvs-Oct-01-mod/common/game.c
--- freeciv-cvs-Oct-01/common/game.c    2004-09-29 07:18:59.000000000 +0200
+++ freeciv-cvs-Oct-01-mod/common/game.c        2004-10-04 12:02:51.000000000 
+0200
@@ -215,6 +215,7 @@
   game.max_players  = GAME_DEFAULT_MAX_PLAYERS;
   game.aifill      = GAME_DEFAULT_AIFILL;
   game.nplayers=0;
+  game.movement_model = GAME_DEFAULT_MOVEMENT_MODEL;
   game.researchcost = GAME_DEFAULT_RESEARCHCOST;
   game.diplcost    = GAME_DEFAULT_DIPLCOST;
   game.diplchance  = GAME_DEFAULT_DIPLCHANCE;
diff -r -u -b freeciv-cvs-Oct-01/common/game.h 
freeciv-cvs-Oct-01-mod/common/game.h
--- freeciv-cvs-Oct-01/common/game.h    2004-09-16 07:17:58.000000000 +0200
+++ freeciv-cvs-Oct-01-mod/common/game.h        2004-10-04 12:04:24.000000000 
+0200
@@ -80,6 +80,7 @@
   int end_year;
   int year;
   int turn;
+  int movement_model; /* unit and player step order */
   int researchcost; /* Multiplier on cost of new research */
   int diplcost, freecost, conquercost;
   int diplchance;
@@ -505,6 +506,10 @@
 #define GAME_MIN_REVOLUTION_LENGTH 0
 #define GAME_MAX_REVOLUTION_LENGTH 10
 
+#define GAME_DEFAULT_MOVEMENT_MODEL 1
+#define GAME_MIN_MOVEMENT_MODEL 1
+#define GAME_MAX_MOVEMENT_MODEL 2
+
 #define GAME_START_YEAR -4000
 
 #define specialist_type_iterate(sp)                                        \
diff -r -u -b freeciv-cvs-Oct-01/server/savegame.c 
freeciv-cvs-Oct-01-mod/server/savegame.c
--- freeciv-cvs-Oct-01/server/savegame.c        2004-09-29 07:19:22.000000000 
+0200
+++ freeciv-cvs-Oct-01-mod/server/savegame.c    2004-10-04 12:17:21.000000000 
+0200
@@ -2985,6 +2985,8 @@
        game.diplchance = 100 - (10 * (game.diplchance - 1));
       }
     }
+        game.movement_model = secfile_lookup_int_default(file, 
game.movement_model,
+                                                  "game.movement_model");
     game.aqueductloss = secfile_lookup_int_default(file, game.aqueductloss,
                                                   "game.aqueductloss");
     game.killcitizen = secfile_lookup_int_default(file, game.killcitizen,
@@ -3447,6 +3449,7 @@
   secfile_insert_bool(file, game.spacerace, "game.spacerace");
   secfile_insert_bool(file, game.auto_ai_toggle, "game.auto_ai_toggle");
   secfile_insert_int(file, game.diplchance, "game.diplchance");
+  secfile_insert_int(file, game.movement_model, "game.movement_model");
   secfile_insert_int(file, game.aqueductloss, "game.aqueductloss");
   secfile_insert_int(file, game.killcitizen, "game.killcitizen");
   secfile_insert_bool(file, game.turnblock, "game.turnblock");
diff -r -u -b freeciv-cvs-Oct-01/server/settings.c 
freeciv-cvs-Oct-01-mod/server/settings.c
--- freeciv-cvs-Oct-01/server/settings.c        2004-09-21 07:20:15.000000000 
+0200
+++ freeciv-cvs-Oct-01-mod/server/settings.c    2004-10-04 13:01:24.000000000 
+0200
@@ -569,6 +569,15 @@
             "percentage chance to be destroyed."), NULL, 
          GAME_MIN_RAZECHANCE, GAME_MAX_RAZECHANCE, GAME_DEFAULT_RAZECHANCE)
 
+  GEN_INT("movementmodel", game.movement_model,
+         SSET_RULES, SSET_MILITARY, SSET_RARE, SSET_TO_CLIENT,
+         N_("Unit movement model used"),
+         N_("1 = standard, all player steps real time\n"
+            "2 = planned, players can make goto planes,\n"
+                 "and units step only at the end of turn"), NULL,
+         GAME_MIN_MOVEMENT_MODEL, GAME_MAX_MOVEMENT_MODEL,
+         GAME_DEFAULT_MOVEMENT_MODEL)
+
   GEN_INT("civstyle", game.civstyle,
          SSET_RULES, SSET_MILITARY, SSET_RARE, SSET_TO_CLIENT,
          N_("Style of Civ rules"),
diff -r -u -b freeciv-cvs-Oct-01/server/unithand.c 
freeciv-cvs-Oct-01-mod/server/unithand.c
--- freeciv-cvs-Oct-01/server/unithand.c        2004-10-02 07:19:23.000000000 
+0200
+++ freeciv-cvs-Oct-01-mod/server/unithand.c    2004-10-04 22:36:50.000000000 
+0200
@@ -538,6 +538,10 @@
   struct unit *punit = player_find_unit_by_id(pplayer, unit_id);
   struct tile *ptile = map_pos_to_tile(x, y);
 
+  if (game.movement_model == 2) {
+    return;
+  }
+
   if (!ptile || !punit) {
     return;
   }
@@ -1581,6 +1585,9 @@
     return;
   }
 
+  if (game.movement_model == 2) {
+    punit->moves_left = 0;
+  }
 
   for (i = 0; i < packet->length; i++) {
     switch (packet->orders[i]) {
diff -r -u -b freeciv-cvs-Oct-01/server/unittools.c 
freeciv-cvs-Oct-01-mod/server/unittools.c
--- freeciv-cvs-Oct-01/server/unittools.c       2004-09-29 07:19:23.000000000 
+0200
+++ freeciv-cvs-Oct-01-mod/server/unittools.c   2004-10-07 07:12:49.000000000 
+0200
@@ -780,7 +780,15 @@
        punit->ai.passenger != 0 || !pplayer->ai.control)) {
 /* autosettlers otherwise waste time; idling them breaks assignment */
 /* Stalling infantry on GOTO so I can see where they're GOing TO. -- Syela */
-      (void) do_unit_goto(punit, GOTO_MOVE_ANY, TRUE);
+        if (do_unit_goto(punit, GOTO_MOVE_ANY, TRUE) == GR_DIED) {
+                   return;
+        }
+
+                 if (game.movement_model == 2) {
+/* If ACTIVITY_GOTO exists at all... --Zoli */
+          unit_restore_movepoints(pplayer, punit);
+          send_unit_info(NULL, punit);
+        }
     }
     return;
   }
@@ -790,6 +798,11 @@
       /* Unit died. */
       return;
     }
+
+    if (game.movement_model == 2) {
+/* Restore unit flash and show movepoints in client --Zoli */
+      unit_restore_movepoints(pplayer, punit);
+    }
   }
 
   send_unit_info(NULL, punit);

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