Author: cazfi
Date: Wed Feb  3 00:51:11 2016
New Revision: 31726

URL: http://svn.gna.org/viewcvs/freeciv?rev=31726&view=rev
Log:
Made FC_AI_LAST public under new name FREECIV_AI_MOD_LAST

See bug #24377

Modified:
    trunk/client/client_main.c
    trunk/common/ai.c
    trunk/common/city.h
    trunk/common/player.h
    trunk/common/unit.h
    trunk/common/unittype.h
    trunk/configure.ac
    trunk/gen_headers/freeciv_config.h.in

Modified: trunk/client/client_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/client_main.c?rev=31726&r1=31725&r2=31726&view=diff
==============================================================================
--- trunk/client/client_main.c  (original)
+++ trunk/client/client_main.c  Wed Feb  3 00:51:11 2016
@@ -347,7 +347,7 @@
   /* Ensure that all AIs are initialized to unused state
    * Not using ai_type_iterate as it would stop at
    * current ai type count, ai_type_get_count(), i.e., 0 */
-  for (aii = 0; aii < FC_AI_LAST; aii++) {
+  for (aii = 0; aii < FREECIV_AI_MOD_LAST; aii++) {
     struct ai_type *ai = get_ai_type(aii);
 
     init_ai(ai);

Modified: trunk/common/ai.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/ai.c?rev=31726&r1=31725&r2=31726&view=diff
==============================================================================
--- trunk/common/ai.c   (original)
+++ trunk/common/ai.c   Wed Feb  3 00:51:11 2016
@@ -27,7 +27,7 @@
 #include "ai.h"
 #include "player.h"
 
-static struct ai_type ai_types[FC_AI_LAST];
+static struct ai_type ai_types[FREECIV_AI_MOD_LAST];
 
 static int ai_type_count = 0;
 
@@ -53,16 +53,16 @@
   fc_assert_ret(aitimers == NULL);
   fc_assert_ret(aitimer_plrs == NULL);
 
-  aitimers = fc_calloc(FC_AI_LAST, sizeof(*aitimers));
-  for (i = 0; i < FC_AI_LAST; i++) {
+  aitimers = fc_calloc(FREECIV_AI_MOD_LAST, sizeof(*aitimers));
+  for (i = 0; i < FREECIV_AI_MOD_LAST; i++) {
     struct ai_timer *aitimer = aitimers + i;
     aitimer->count = 0;
     aitimer->timer = NULL;
   }
 
-  aitimer_plrs = fc_calloc(FC_AI_LAST * MAX_NUM_PLAYER_SLOTS,
+  aitimer_plrs = fc_calloc(FREECIV_AI_MOD_LAST * MAX_NUM_PLAYER_SLOTS,
                            sizeof(*aitimer_plrs));
-  for (i = 0; i < FC_AI_LAST * MAX_NUM_PLAYER_SLOTS; i++) {
+  for (i = 0; i < FREECIV_AI_MOD_LAST * MAX_NUM_PLAYER_SLOTS; i++) {
     struct ai_timer *aitimer = aitimer_plrs + i;
     aitimer->count = 0;
     aitimer->timer = NULL;
@@ -77,7 +77,7 @@
   int i,j;
   struct ai_timer *aitimer;
 
-  for (i = 0; i < FC_AI_LAST; i++) {
+  for (i = 0; i < FREECIV_AI_MOD_LAST; i++) {
     struct ai_type *ai = get_ai_type(i);
 
     aitimer = aitimers + i;
@@ -89,7 +89,7 @@
     }
 
     for (j = 0; j < MAX_NUM_PLAYER_SLOTS; j++) {
-      aitimer = aitimer_plrs + j * FC_AI_LAST + i;
+      aitimer = aitimer_plrs + j * FREECIV_AI_MOD_LAST + i;
 
       if (aitimer->timer) {
         log_normal("AI timer stats: [%15.3f] P%03d (AI type: %s)",
@@ -137,7 +137,7 @@
 
   fc_assert_ret_val(aitimer_plrs != NULL, NULL);
 
-  aitimer = aitimer_plrs + (player_index(pplayer) * FC_AI_LAST
+  aitimer = aitimer_plrs + (player_index(pplayer) * FREECIV_AI_MOD_LAST
                             + ai_type_number(pplayer->ai));
 
   if (!aitimer->timer) {
@@ -252,7 +252,7 @@
 ***************************************************************/
 struct ai_type *get_ai_type(int id)
 {
-  fc_assert(id >= 0 && id < FC_AI_LAST);
+  fc_assert(id >= 0 && id < FREECIV_AI_MOD_LAST);
 
   return &ai_types[id];
 }
@@ -272,7 +272,7 @@
 {
   int ainbr = ai - ai_types;
 
-  fc_assert_ret_val(ainbr >= 0 && ainbr < FC_AI_LAST, 0);
+  fc_assert_ret_val(ainbr >= 0 && ainbr < FREECIV_AI_MOD_LAST, 0);
 
   return ainbr;
 }
@@ -296,8 +296,10 @@
 ***************************************************************/
 struct ai_type *ai_type_alloc(void)
 {
-  if (ai_type_count >= FC_AI_LAST) {
-    log_error(_("Too many AI modules. Max is %d."), FC_AI_LAST);
+  if (ai_type_count >= FREECIV_AI_MOD_LAST) {
+    log_error(_("Too many AI modules. Max is %d."),
+              FREECIV_AI_MOD_LAST);
+
     return NULL;
   }
 

Modified: trunk/common/city.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/city.h?rev=31726&r1=31725&r2=31726&view=diff
==============================================================================
--- trunk/common/city.h (original)
+++ trunk/common/city.h Wed Feb  3 00:51:11 2016
@@ -416,7 +416,7 @@
       bool debug;                   /* not saved */
 
       struct adv_city *adv;
-      void *ais[FC_AI_LAST];
+      void *ais[FREECIV_AI_MOD_LAST];
 
       struct vision *vision;
     } server;

Modified: trunk/common/player.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/player.h?rev=31726&r1=31725&r2=31726&view=diff
==============================================================================
--- trunk/common/player.h       (original)
+++ trunk/common/player.h       Wed Feb  3 00:51:11 2016
@@ -320,7 +320,7 @@
 
       struct adv_data *adv;
 
-      void *ais[FC_AI_LAST];
+      void *ais[FREECIV_AI_MOD_LAST];
 
       /* This user is allowed to take over the player. */
       char delegate_to[MAX_LEN_NAME];

Modified: trunk/common/unit.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.h?rev=31726&r1=31725&r2=31726&view=diff
==============================================================================
--- trunk/common/unit.h (original)
+++ trunk/common/unit.h Wed Feb  3 00:51:11 2016
@@ -196,7 +196,7 @@
       bool debug;
 
       struct unit_adv *adv;
-      void *ais[FC_AI_LAST];
+      void *ais[FREECIV_AI_MOD_LAST];
       int birth_turn;
 
       /* ord_map and ord_city are the order index of this unit in tile.units

Modified: trunk/common/unittype.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unittype.h?rev=31726&r1=31725&r2=31726&view=diff
==============================================================================
--- trunk/common/unittype.h     (original)
+++ trunk/common/unittype.h     Wed Feb  3 00:51:11 2016
@@ -528,7 +528,7 @@
     int defense_mp_bonuses[U_LAST];
   } cache;
 
-  void *ais[FC_AI_LAST];
+  void *ais[FREECIV_AI_MOD_LAST];
 };
 
 /* General unit and unit type (matched) routines */

Modified: trunk/configure.ac
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=31726&r1=31725&r2=31726&view=diff
==============================================================================
--- trunk/configure.ac  (original)
+++ trunk/configure.ac  Wed Feb  3 00:51:11 2016
@@ -593,7 +593,7 @@
   dnl Dynamic modules allowed, give slots for them
   fc_ai_last=$fc_ai_last+3
 fi
-AC_DEFINE_UNQUOTED([FC_AI_LAST], [(${fc_ai_last})], [Max number of AI modules])
+AC_DEFINE_UNQUOTED([FREECIV_AI_MOD_LAST], [(${fc_ai_last})], [Max number of AI 
modules])
 
 AC_DEFINE_UNQUOTED([AI_MOD_DEFAULT], ["${default_ai_set}"], [Default ai type 
name])
 

Modified: trunk/gen_headers/freeciv_config.h.in
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/gen_headers/freeciv_config.h.in?rev=31726&r1=31725&r2=31726&view=diff
==============================================================================
--- trunk/gen_headers/freeciv_config.h.in       (original)
+++ trunk/gen_headers/freeciv_config.h.in       Wed Feb  3 00:51:11 2016
@@ -113,4 +113,7 @@
 /* IPv6 Support built in */
 #undef FREECIV_IPV6_SUPPORT
 
+/* Max number of AI modules */
+#undef FREECIV_AI_MOD_LAST
+
 #endif /* FC__FREECIV_CONFIG_H */


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to