[Freeciv-Dev] (PR#6874) Replace int with enum tile_special_type
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#6874) Replace int with enum tile_special_type |
From: |
"Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx> |
Date: |
Sat, 15 Nov 2003 10:07:03 -0800 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=6874 >
See $SUBJECT.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"> WHY?! Isn't it better to put $(shell cat cscope.files) on the list of
I only have a yellow belt in makefile kungfu. These fancy gnu make things
are relatively new to some of us..."
-- Mark Frazer to Vassilii Khachaturov in linux-kernel
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.150
diff -u -u -r1.150 map.c
--- common/map.c 2003/11/14 12:26:58 1.150
+++ common/map.c 2003/11/15 18:01:57
@@ -71,7 +71,7 @@
/***************************************************************
...
***************************************************************/
-int get_tile_infrastructure_set(struct tile * ptile)
+enum tile_special_type get_tile_infrastructure_set(struct tile *ptile)
{
return
ptile->special &
@@ -666,7 +666,7 @@
eg: "Mine"
eg: "Road/Farmland"
***************************************************************/
-const char *map_get_infrastructure_text(int spe)
+const char *map_get_infrastructure_text(enum tile_special_type spe)
{
static char s[64];
char *p;
@@ -704,9 +704,9 @@
/***************************************************************
...
***************************************************************/
-int map_get_infrastructure_prerequisite(int spe)
+enum tile_special_type map_get_infrastructure_prerequisite(enum
tile_special_type spe)
{
- int prereq = S_NO_SPECIAL;
+ enum tile_special_type prereq = S_NO_SPECIAL;
if (contains_special(spe, S_RAILROAD))
prereq |= S_ROAD;
@@ -719,7 +719,7 @@
/***************************************************************
...
***************************************************************/
-enum tile_special_type get_preferred_pillage(int pset)
+enum tile_special_type get_preferred_pillage(enum tile_special_type pset)
{
if (contains_special(pset, S_FARMLAND))
return S_FARMLAND;
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.163
diff -u -u -r1.163 map.h
--- common/map.h 2003/11/14 12:26:58 1.163
+++ common/map.h 2003/11/15 18:01:58
@@ -357,10 +357,10 @@
int get_tile_food_base(struct tile * ptile);
int get_tile_shield_base(struct tile * ptile);
int get_tile_trade_base(struct tile * ptile);
-int get_tile_infrastructure_set(struct tile * ptile);
-const char *map_get_infrastructure_text(int spe);
-int map_get_infrastructure_prerequisite(int spe);
-enum tile_special_type get_preferred_pillage(int pset);
+enum tile_special_type get_tile_infrastructure_set(struct tile * ptile);
+const char *map_get_infrastructure_text(enum tile_special_type spe);
+enum tile_special_type map_get_infrastructure_prerequisite(enum
tile_special_type spe);
+enum tile_special_type get_preferred_pillage(enum tile_special_type pset);
void map_irrigate_tile(int x, int y);
void map_mine_tile(int x, int y);
Index: common/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.187
diff -u -u -r1.187 unit.c
--- common/unit.c 2003/10/29 08:00:39 1.187
+++ common/unit.c 2003/11/15 18:02:00
@@ -754,9 +754,9 @@
case ACTIVITY_PILLAGE:
{
- int pspresent;
- int psworking;
- pspresent = get_tile_infrastructure_set(ptile);
+ enum tile_special_type pspresent = get_tile_infrastructure_set(ptile);
+ enum tile_special_type psworking;
+
if (pspresent != S_NO_SPECIAL && is_ground_unit(punit)) {
psworking = get_unit_tile_pillage_set(punit->x, punit->y);
if (ptile->city && (contains_special(target, S_ROAD) ||
@@ -764,15 +764,16 @@
return FALSE;
if (target == S_NO_SPECIAL) {
if (ptile->city)
- return ((pspresent & (~(psworking | S_ROAD |S_RAILROAD))) != 0);
+ return ((pspresent & (~(psworking | S_ROAD | S_RAILROAD))) !=
+ S_NO_SPECIAL);
else
- return ((pspresent & (~psworking)) != 0);
+ return ((pspresent & (~psworking)) != S_NO_SPECIAL);
}
else if ((!game.rgame.pillage_select) &&
(target != get_preferred_pillage(pspresent)))
return FALSE;
else
- return ((pspresent & (~psworking) & target) != 0);
+ return ((pspresent & (~psworking) & target) != S_NO_SPECIAL);
} else {
return FALSE;
}
@@ -841,7 +842,7 @@
/**************************************************************************
...
**************************************************************************/
-int get_unit_tile_pillage_set(int x, int y)
+enum tile_special_type get_unit_tile_pillage_set(int x, int y)
{
enum tile_special_type tgt_ret = S_NO_SPECIAL;
Index: common/unit.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.h,v
retrieving revision 1.103
diff -u -u -r1.103 unit.h
--- common/unit.h 2003/10/29 08:00:39 1.103
+++ common/unit.h 2003/11/15 18:02:00
@@ -232,7 +232,7 @@
enum tile_special_type new_target);
bool can_unit_do_auto(struct unit *punit);
bool is_unit_activity_on_tile(enum unit_activity activity, int x, int y);
-int get_unit_tile_pillage_set(int x, int y);
+enum tile_special_type get_unit_tile_pillage_set(int x, int y);
bool is_military_unit(struct unit *punit); /* !set !dip !cara */
bool is_diplomat_unit(struct unit *punit);
bool is_square_threatened(struct player *pplayer, int x, int y);
Index: server/sanitycheck.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sanitycheck.c,v
retrieving revision 1.38
diff -u -u -r1.38 sanitycheck.c
--- server/sanitycheck.c 2003/10/13 06:55:21 1.38
+++ server/sanitycheck.c 2003/11/15 18:02:10
@@ -39,7 +39,7 @@
{
whole_map_iterate(x, y) {
int terrain = map_get_terrain(x, y);
- int special = map_get_special(x, y);
+ enum tile_special_type special = map_get_special(x, y);
if (contains_special(special, S_RAILROAD))
assert(contains_special(special, S_ROAD));
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.278
diff -u -u -r1.278 unithand.c
--- server/unithand.c 2003/11/13 19:41:10 1.278
+++ server/unithand.c 2003/11/15 18:02:10
@@ -1376,8 +1376,10 @@
...
**************************************************************************/
static void handle_unit_activity_dependencies(struct unit *punit,
- enum unit_activity old_activity,
- int old_target)
+ enum unit_activity
+ old_activity,
+ enum tile_special_type
+ old_target)
{
switch (punit->activity) {
case ACTIVITY_IDLE:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#6874) Replace int with enum tile_special_type,
Raimar Falke <=
|
|