Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11725) Constifying common/city
Home

[Freeciv-Dev] (PR#11725) Constifying common/city

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11725) Constifying common/city
From: "Frédéric Brière" <fbriere@xxxxxxxxxxx>
Date: Wed, 29 Dec 2004 22:22:26 -0800
Reply-to: bugs@xxxxxxxxxxx

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

And here's for common/city.[ch].


-- 
             Frédéric Brière    <*>    fbriere@xxxxxxxxxxx

 =>  <fbriere@xxxxxxxxxx> IS NO MORE:  <http://www.abacomsucks.com>  <=

Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.296
diff -u -r1.296 city.c
--- common/city.c       28 Dec 2004 19:09:27 -0000      1.296
+++ common/city.c       30 Dec 2004 04:40:42 -0000
@@ -814,7 +814,7 @@
   coordinates.  punit is the founding unit, which may be NULL in some
   cases (e.g., cities from huts).
 **************************************************************************/
-bool city_can_be_built_here(const struct tile *ptile, struct unit *punit)
+bool city_can_be_built_here(const struct tile *ptile, const struct unit *punit)
 {
   if (terrain_has_flag(ptile->terrain, TER_NO_CITIES)) {
     /* No cities on this terrain. */
@@ -1159,7 +1159,7 @@
 /**************************************************************************
 ...
 **************************************************************************/
-int citygov_free_happy(const struct city *pcity, struct government *gov)
+int citygov_free_happy(const struct city *pcity, const struct government *gov)
 {
   if (gov->free_happy == G_CITY_SIZE_FREE) {
     return pcity->size;
@@ -1179,7 +1179,7 @@
 /**************************************************************************
 ...
 **************************************************************************/
-int get_player_city_style(struct player *plr)
+int get_player_city_style(const struct player *plr)
 {
   int replace, style, prev;
 
@@ -1379,7 +1379,7 @@
  is there an enemy city on this tile?
 **************************************************************************/
 struct city *is_enemy_city_tile(const struct tile *ptile,
-                               struct player *pplayer)
+                               const struct player *pplayer)
 {
   struct city *pcity = ptile->city;
 
@@ -1393,7 +1393,7 @@
  is there an friendly city on this tile?
 **************************************************************************/
 struct city *is_allied_city_tile(const struct tile *ptile,
-                                struct player *pplayer)
+                                const struct player *pplayer)
 {
   struct city *pcity = ptile->city;
 
@@ -1407,7 +1407,7 @@
  is there an enemy city on this tile?
 **************************************************************************/
 struct city *is_non_attack_city_tile(const struct tile *ptile,
-                                    struct player *pplayer)
+                                    const struct player *pplayer)
 {
   struct city *pcity = ptile->city;
 
@@ -1421,7 +1421,7 @@
  is there an non_allied city on this tile?
 **************************************************************************/
 struct city *is_non_allied_city_tile(const struct tile *ptile,
-                                    struct player *pplayer)
+                                    const struct player *pplayer)
 {
   struct city *pcity = ptile->city;
 
@@ -1434,7 +1434,7 @@
 /**************************************************************************
 ...
 **************************************************************************/
-bool is_unit_near_a_friendly_city(struct unit *punit)
+bool is_unit_near_a_friendly_city(const struct unit *punit)
 {
   return is_friendly_city_near(unit_owner(punit), punit->tile);
 }
@@ -1442,7 +1442,7 @@
 /**************************************************************************
 ...
 **************************************************************************/
-bool is_friendly_city_near(struct player *owner, const struct tile *ptile)
+bool is_friendly_city_near(const struct player *owner, const struct tile 
*ptile)
 {
   square_iterate(ptile, 3, ptile1) {
     struct city * pcity = ptile1->city;
@@ -1494,7 +1494,7 @@
 /**************************************************************************
   Give base number of content citizens in any city owner by pplayer.
 **************************************************************************/
-static int content_citizens(struct player *pplayer)
+static int content_citizens(const struct player *pplayer)
 {
   int cities = city_list_size(&pplayer->cities);
   int content = game.unhappysize;
@@ -1908,7 +1908,7 @@
   Calculate pollution for the city.  The shield_total must be passed in
   (most callers will want to pass pcity->prod[O_SHIELD]).
 **************************************************************************/
-int city_pollution(struct city *pcity, int shield_total)
+int city_pollution(const struct city *pcity, int shield_total)
 {
   struct player *pplayer = city_owner(pcity);
   int mod, pollution;
@@ -2341,8 +2341,8 @@
   Create virtual skeleton for a city.  It does not register the city so 
   the id is set to 0.  All other values are more or less sane defaults.
 **************************************************************************/
-struct city *create_city_virtual(struct player *pplayer, struct tile *ptile,
-                                const char *name)
+struct city *create_city_virtual(const struct player *pplayer,
+                                struct tile *ptile, const char *name)
 {
   int i;
   struct city *pcity;
Index: common/city.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.h,v
retrieving revision 1.188
diff -u -r1.188 city.h
--- common/city.h       25 Dec 2004 20:13:05 -0000      1.188
+++ common/city.h       30 Dec 2004 04:40:42 -0000
@@ -448,7 +448,7 @@
                                struct city **result_pcity);
 bool is_worker_here(const struct city *pcity, int city_x, int city_y);
 
-bool city_can_be_built_here(const struct tile *ptile, struct unit *punit);
+bool city_can_be_built_here(const struct tile *ptile, const struct unit 
*punit);
 
 /* trade functions */
 bool can_cities_trade(const struct city *pc1, const struct city *pc2);
@@ -469,35 +469,36 @@
 /* city free cost values depending on government: */
 int citygov_free_upkeep(const struct city *pcity,
                        const struct government *gov, Output_type_id otype);
-int citygov_free_happy(const struct city *pcity, struct government *gov);
+int citygov_free_happy(const struct city *pcity, const struct government *gov);
 
 /* city style functions */
 int get_city_style(const struct city *pcity);
-int get_player_city_style(struct player *plr);
+int get_player_city_style(const struct player *plr);
 int get_style_by_name(const char *);
 int get_style_by_name_orig(const char *);
 const char *get_city_style_name(int style);
 char* get_city_style_name_orig(int style);
 
 struct city *is_enemy_city_tile(const struct tile *ptile,
-                               struct player *pplayer);
+                               const struct player *pplayer);
 struct city *is_allied_city_tile(const struct tile *ptile,
-                                struct player *pplayer);
+                                const struct player *pplayer);
 struct city *is_non_attack_city_tile(const struct tile *ptile,
-                                    struct player *pplayer);
+                                    const struct player *pplayer);
 struct city *is_non_allied_city_tile(const struct tile *ptile,
-                                    struct player *pplayer);
+                                    const struct player *pplayer);
 
-bool is_unit_near_a_friendly_city(struct unit *punit);
-bool is_friendly_city_near(struct player *owner, const struct tile *ptile);
+bool is_unit_near_a_friendly_city(const struct unit *punit);
+bool is_friendly_city_near(const struct player *owner,
+                          const struct tile *ptile);
 bool city_exists_within_city_radius(const struct tile *ptile,
                                    bool may_be_on_center);
 
 /* granary size as a function of city size */
 int city_granary_size(int city_size);
 
-void city_add_improvement(struct city *pcity,Impr_Type_id impr);
-void city_remove_improvement(struct city *pcity,Impr_Type_id impr);
+void city_add_improvement(struct city *pcity, Impr_Type_id impr);
+void city_remove_improvement(struct city *pcity, Impr_Type_id impr);
 
 /* city update functions */
 void generic_city_refresh(struct city *pcity,
@@ -514,8 +515,8 @@
 bool city_built_last_turn(const struct city *pcity);
 
 /* city creation / destruction */
-struct city *create_city_virtual(struct player *pplayer, struct tile *ptile,
-                                const char *name);
+struct city *create_city_virtual(const struct player *pplayer,
+                                struct tile *ptile, const char *name);
 void remove_city_virtual(struct city *pcity);
 
 /* misc */
@@ -526,7 +527,7 @@
 void get_citizen_output(const struct city *pcity, int *output);
 void add_tax_income(const struct player *pplayer, int *output);
 int get_city_tithes_bonus(const struct city *pcity);
-int city_pollution(struct city *pcity, int shield_total);
+int city_pollution(const struct city *pcity, int shield_total);
 
 /*
  * Iterates over all improvements which are built in the given city.

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11725) Constifying common/city, Frédéric Brière <=