Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#9928) new type Specialist_type_id
Home

[Freeciv-Dev] (PR#9928) new type Specialist_type_id

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9928) new type Specialist_type_id
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 3 Sep 2004 15:58:30 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch adds a

   typedef enum specialist_type Specialist_type_id;

to fc_types.h.  This is a small step toward gen-specialists.

(Note that the naming of these types is inconsistent.  We have 
Impr_Type_id but Terrain_type_id.  I chose the latter for this type, 
becuase it's right next to the Terrain_type_id typedef.  What should we 
be using here?)

jason

Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.44
diff -u -r1.44 citydlg_common.c
--- client/citydlg_common.c     1 Sep 2004 03:16:47 -0000       1.44
+++ client/citydlg_common.c     3 Sep 2004 22:55:43 -0000
@@ -422,7 +422,7 @@
 void city_rotate_specialist(struct city *pcity, int citizen_index)
 {
   struct citizen_type citizens[MAX_CITY_SIZE];
-  enum specialist_type from, to;
+  Specialist_type_id from, to;
 
   if (citizen_index < 0 || citizen_index >= pcity->size) {
     return;
@@ -573,8 +573,8 @@
 /**************************************************************************
   Change a specialist in the given city.  Return the request ID.
 **************************************************************************/
-int city_change_specialist(struct city *pcity, enum specialist_type from,
-                          enum specialist_type to)
+int city_change_specialist(struct city *pcity, Specialist_type_id from,
+                          Specialist_type_id to)
 {
   return dsend_packet_city_change_specialist(&aconnection, pcity->id, from,
                                             to);
Index: client/citydlg_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.h,v
retrieving revision 1.24
diff -u -r1.24 citydlg_common.h
--- client/citydlg_common.h     3 Sep 2004 04:22:36 -0000       1.24
+++ client/citydlg_common.h     3 Sep 2004 22:55:43 -0000
@@ -18,7 +18,7 @@
 
 #include "shared.h"            /* bool type */
 
-#include "city.h"              /* enum specialist_type */
+#include "city.h"              /* Specialist_type_id */
 #include "fc_types.h"
 
 struct canvas;
@@ -32,7 +32,7 @@
     CITIZEN_ANGRY,
     CITIZEN_LAST
   } type;
-  enum specialist_type spec_type;
+  Specialist_type_id spec_type;
 };
 
 int get_citydlg_canvas_width(void);
@@ -67,8 +67,8 @@
 bool city_can_buy(const struct city *pcity);
 int city_sell_improvement(struct city *pcity, Impr_Type_id sell_id);
 int city_buy_production(struct city *pcity);
-int city_change_specialist(struct city *pcity, enum specialist_type from,
-                          enum specialist_type to);
+int city_change_specialist(struct city *pcity, Specialist_type_id from,
+                          Specialist_type_id to);
 int city_toggle_worker(struct city *pcity, int city_x, int city_y);
 int city_rename(struct city *pcity, const char *name);
 
Index: client/gui-mui/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/citydlg.c,v
retrieving revision 1.80
diff -u -r1.80 citydlg.c
--- client/gui-mui/citydlg.c    20 Jul 2004 16:27:07 -0000      1.80
+++ client/gui-mui/citydlg.c    3 Sep 2004 22:55:44 -0000
@@ -1028,7 +1028,7 @@
 static void city_citizen(struct city_citizen_msg *msg)
 {
   struct city_dialog *pdialog = msg->pdialog;
-  enum specialist_type from = msg->type, to;
+  Specialist_type_id from = msg->type, to;
 
   switch (from)  {
   case CITIZEN_ELVIS:
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.240
diff -u -r1.240 city.c
--- common/city.c       1 Sep 2004 19:45:19 -0000       1.240
+++ common/city.c       3 Sep 2004 22:55:45 -0000
@@ -516,7 +516,7 @@
   Returns TRUE iff if the given city can use this kind of specialist.
 ****************************************************************************/
 bool city_can_use_specialist(const struct city *pcity,
-                            enum specialist_type type)
+                            Specialist_type_id type)
 {
   return pcity->size >= game.rgame.specialists[type].min_size;
 }
Index: common/city.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.h,v
retrieving revision 1.158
diff -u -r1.158 city.h
--- common/city.h       3 Sep 2004 04:22:36 -0000       1.158
+++ common/city.h       3 Sep 2004 22:55:45 -0000
@@ -363,7 +363,8 @@
 bool can_build_unit(const struct city *pcity, Unit_Type_id id);
 bool can_build_unit_direct(const struct city *pcity, Unit_Type_id id);
 bool can_eventually_build_unit(const struct city *pcity, Unit_Type_id id);
-bool city_can_use_specialist(const struct city *pcity, enum specialist_type 
type);
+bool city_can_use_specialist(const struct city *pcity,
+                            Specialist_type_id type);
 bool city_got_building(const struct city *pcity,  Impr_Type_id id); 
 bool city_affected_by_wonder(const struct city *pcity, Impr_Type_id id);
 bool city_got_effect(const struct city *pcity, Impr_Type_id id);
Index: common/fc_types.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/fc_types.h,v
retrieving revision 1.5
diff -u -r1.5 fc_types.h
--- common/fc_types.h   3 Sep 2004 04:22:37 -0000       1.5
+++ common/fc_types.h   3 Sep 2004 22:55:45 -0000
@@ -20,6 +20,7 @@
 
 typedef signed short Continent_id;
 typedef enum tile_terrain_type Terrain_type_id;
+typedef enum specialist_type Specialist_type_id;
 
 /* TODO: Remove this enum and make this an integer when gen-eff is done. */
 typedef enum {
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.45
diff -u -r1.45 packets.def
--- common/packets.def  3 Sep 2004 03:56:58 -0000       1.45
+++ common/packets.def  3 Sep 2004 22:55:46 -0000
@@ -165,7 +165,7 @@
 type EVENT             = sint16(enum event_type)
 type TERRAIN           = sint16(Terrain_type_id)
 type SPECIAL           = uint16(enum tile_special_type)
-type SPECIALIST                = uint8(enum specialist_type)
+type SPECIALIST                = uint8(Specialist_type_id)
 type DIPLOMAT_ACTION   = uint8(enum diplomat_actions)
 type CMDLEVEL          = uint8(enum cmdlevel_id)
 type PLACE_TYPE                = uint8(enum spaceship_place_type)
Index: common/aicore/cm.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.c,v
retrieving revision 1.39
diff -u -r1.39 cm.c
--- common/aicore/cm.c  24 Jul 2004 03:43:35 -0000      1.39
+++ common/aicore/cm.c  3 Sep 2004 22:55:46 -0000
@@ -513,7 +513,7 @@
  Wraps the array access to cache2.secondary_stats.
 *****************************************************************************/
 static struct secondary_stat *get_secondary_stat(int trade, int specialists,
-                                                enum specialist_type
+                                                Specialist_type_id
                                                 specialist_type)
 {
   freelog(LOG_DEBUG, "second: trade=%d spec=%d type=%d", trade, specialists,
Index: server/cityhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityhand.c,v
retrieving revision 1.134
diff -u -r1.134 cityhand.c
--- server/cityhand.c   28 Aug 2004 19:15:39 -0000      1.134
+++ server/cityhand.c   3 Sep 2004 22:55:46 -0000
@@ -63,8 +63,8 @@
 ...
 **************************************************************************/
 void handle_city_change_specialist(struct player *pplayer, int city_id,
-                                  enum specialist_type from,
-                                  enum specialist_type to)
+                                  Specialist_type_id from,
+                                  Specialist_type_id to)
 {
   struct city *pcity = player_find_city_by_id(pplayer, city_id);
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9928) new type Specialist_type_id, Jason Short <=