Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2005:
[Freeciv-Dev] (PR#12257) Do not call building eval code twice
Home

[Freeciv-Dev] (PR#12257) Do not call building eval code twice

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12257) Do not call building eval code twice
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 14 Feb 2005 17:14:42 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12257 >

The buildings evaluation code is one of the most CPU intensive in Freeciv.
Yet we call it twice for all AIs, when we don't need to. This patch fixes
this.

  - Per

Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.223
diff -u -r1.223 srv_main.c
--- server/srv_main.c   14 Feb 2005 22:52:41 -0000      1.223
+++ server/srv_main.c   15 Feb 2005 01:12:33 -0000
@@ -519,7 +519,9 @@
            pplayer->player_no, pplayer->name);
     /* human players also need this for building advice */
     ai_data_phase_init(pplayer, is_new_phase);
-    ai_manage_buildings(pplayer);
+    if (!pplayer->ai.control) {
+      ai_manage_buildings(pplayer); /* building advisor */
+    }
   } players_iterate_end;
 
   players_iterate(pplayer) {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12257) Do not call building eval code twice, Per I. Mathisen <=