[Freeciv-Dev] (PR#11603) Const-ifying common/unittype.c
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#11603) Const-ifying common/unittype.c |
From: |
"Frédéric Brière" <fbriere@xxxxxxxxxxx> |
Date: |
Sun, 19 Dec 2004 04:46:08 -0800 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11603 >
This patch adds a few consts to common/unittype.[ch].
--
Frédéric Brière <*> fbriere@xxxxxxxxxxx
=> <fbriere@xxxxxxxxxx> IS NO MORE: <http://www.abacomsucks.com> <=
Index: common/unittype.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.c,v
retrieving revision 1.47
diff -u -r1.47 unittype.c
--- common/unittype.c 8 Dec 2004 14:36:22 -0000 1.47
+++ common/unittype.c 19 Dec 2004 11:24:21 -0000
@@ -78,7 +78,7 @@
/**************************************************************************
...
**************************************************************************/
-struct unit_type *unit_type(struct unit *punit)
+struct unit_type *unit_type(const struct unit *punit)
{
return get_unit_type(punit->type);
}
@@ -132,7 +132,7 @@
/**************************************************************************
...
**************************************************************************/
-int utype_happy_cost(struct unit_type *ut, struct government *g)
+int utype_happy_cost(const struct unit_type *ut, const struct government *g)
{
return ut->happy_cost * g->unit_happy_cost_factor;
}
@@ -611,7 +611,7 @@
Return "best" unit this city can build, with given role/flag.
Returns U_LAST if none match. "Best" means highest unit type id.
**************************************************************************/
-Unit_Type_id best_role_unit(struct city *pcity, int role)
+Unit_Type_id best_role_unit(const struct city *pcity, int role)
{
Unit_Type_id u;
int j;
Index: common/unittype.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.h,v
retrieving revision 1.38
diff -u -r1.38 unittype.h
--- common/unittype.h 8 Dec 2004 14:36:22 -0000 1.38
+++ common/unittype.h 19 Dec 2004 11:24:21 -0000
@@ -224,7 +224,7 @@
#define CHECK_UNIT_TYPE(ut) (assert((ut) >= 0 && (ut) < game.num_unit_types))
struct unit_type *get_unit_type(Unit_Type_id id);
-struct unit_type *unit_type(struct unit *punit);
+struct unit_type *unit_type(const struct unit *punit);
bool unit_type_flag(Unit_Type_id id, int flag);
bool unit_flag(const struct unit *punit, enum unit_flag_id flag);
@@ -249,7 +249,7 @@
int utype_upkeep_cost(const struct unit_type *ut,
const struct government *gov, Output_type_id otype);
-int utype_happy_cost(struct unit_type *ut, struct government *g);
+int utype_happy_cost(const struct unit_type *ut, const struct government *g);
int can_upgrade_unittype(struct player *pplayer, Unit_Type_id id);
int unit_upgrade_price(const struct player * const pplayer,
@@ -270,7 +270,7 @@
void role_unit_precalcs(void);
int num_role_units(int role);
Unit_Type_id get_role_unit(int role, int index);
-Unit_Type_id best_role_unit(struct city *pcity, int role);
+Unit_Type_id best_role_unit(const struct city *pcity, int role);
Unit_Type_id best_role_unit_for_player(struct player *pplayer, int role);
Unit_Type_id first_role_unit_for_player(struct player *pplayer, int role);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#11603) Const-ifying common/unittype.c,
Frédéric Brière <=
|
|