Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2001:
[Freeciv-Dev] PATCH: build stuff before goto
Home

[Freeciv-Dev] PATCH: build stuff before goto

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] PATCH: build stuff before goto
From: zamar-fc@xxxxxxxxxxxxxxxxxxx (Joona Kiiski)
Date: Thu, 15 Mar 2001 12:04:20 +0200 (EET)
Reply-to: zamar-fc@xxxxxxxxxxxxxxxxxxx


Cities are now handled before units for all players.

Fixes bug you could use goto to conquer empty city before new stuff was
built in city. (more like civ2 behaviour, i think...)

--
Zamar
diff -Nur -Xdiff_ignore cvs/server/plrhand.c p2/server/plrhand.c
--- cvs/server/plrhand.c        Mon Mar 12 12:37:14 2001
+++ p2/server/plrhand.c Mon Mar 12 22:49:00 2001
@@ -158,16 +158,21 @@
 /**************************************************************************
 Main update loop, for each player at end of turn.
 **************************************************************************/
-void update_player_activities(struct player *pplayer) 
+void update_player_activities1(struct player *pplayer)
 {
   if (pplayer->ai.control) {
     ai_do_last_activities(pplayer); /* why was this AFTER aliveness? */
   }
   great_library(pplayer);
   update_revolution(pplayer);
+  /* Moved here to be before executing goto. */
+  update_city_activities(pplayer); 
+}
+
+void update_player_activities2(struct player *pplayer) 
+{
   player_restore_units(pplayer); /*note: restoring move point moved
                                   to update_unit_activities*/
-  update_city_activities(pplayer);
 #ifdef CITIES_PROVIDE_RESEARCH
   if (city_list_size(&pplayer->cities)) /* has to be below the above for 
got_tech */ 
     update_tech(pplayer, city_list_size(&pplayer->cities));
diff -Nur -Xdiff_ignore cvs/server/plrhand.h p2/server/plrhand.h
--- cvs/server/plrhand.h        Wed Feb 28 10:47:11 2001
+++ p2/server/plrhand.h Mon Mar 12 22:53:25 2001
@@ -26,7 +26,8 @@
 void server_player_init(struct player *pplayer, int initmap);
 void server_remove_player(struct player *pplayer);
 void begin_player_turn(struct player *pplayer);
-void update_player_activities(struct player *pplayer);
+void update_player_activities1(struct player *pplayer);
+void update_player_activities2(struct player *pplayer);
 
 void handle_player_revolution(struct player *pplayer);
 void handle_player_rates(struct player *pplayer, 
diff -Nur -Xdiff_ignore cvs/server/srv_main.c p2/server/srv_main.c
--- cvs/server/srv_main.c       Mon Mar 12 12:37:14 2001
+++ p2/server/srv_main.c        Mon Mar 12 22:47:41 2001
@@ -727,16 +727,25 @@
   int i;
 
   nocity_send = 1;
+
+  for(i=0; i<game.nplayers; i++) {
+    struct player *pplayer = shuffled_player(i);
+    freelog(LOG_DEBUG, "updating player activities1 for #%d (%s)", 
+        i, pplayer->name);
+    update_player_activities1(pplayer);
+    flush_packets();
+  }
+       
   for(i=0; i<game.nplayers; i++) {
     struct player *pplayer = shuffled_player(i);
-    freelog(LOG_DEBUG, "updating player activities for #%d (%s)",
-                 i, pplayer->name);
-    update_player_activities(pplayer);
+    freelog(LOG_DEBUG, "updating player activities2 for #%d (%s)",
+      i, pplayer->name);
+    update_player_activities2(pplayer);
          /* ai unit activity has been moved UP -- Syela */
 
     flush_packets();
-        /* update_player_activities calls update_unit_activities which
-           causes *major* network traffic */
+    /* update_player_activities calls update_unit_activities which
+       causes *major* network traffic */
     pplayer->turn_done=0;
   }
   nocity_send = 0;



[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] PATCH: build stuff before goto, Joona Kiiski <=