Author: cazfi
Date: Thu Feb 11 21:40:19 2016
New Revision: 31887

URL: http://svn.gna.org/viewcvs/freeciv?rev=31887&view=rev
Log:
Inlined map_move_cost() and map_move_cost_unit() that are just simple wrappers
for tile_move_cost_ptrs().

See patch #6934

Modified:
    branches/S2_6/common/map.c
    branches/S2_6/common/map.h

Modified: branches/S2_6/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/map.c?rev=31887&r1=31886&r2=31887&view=diff
==============================================================================
--- branches/S2_6/common/map.c  (original)
+++ branches/S2_6/common/map.c  Thu Feb 11 21:40:19 2016
@@ -699,13 +699,13 @@
   the tiles are assumed to be adjacent, and the (x,y)
   values are used only to get the river bonus correct.
 
-  May also be used with punit==NULL, in which case punit
+  May also be used with punit == NULL, in which case punit
   tests are not done (for unit-independent results).
 ***************************************************************/
-static int tile_move_cost_ptrs(const struct unit *punit,
-                               const struct unit_type *punittype,
-                               const struct player *pplayer,
-                               const struct tile *t1, const struct tile *t2)
+int tile_move_cost_ptrs(const struct unit *punit,
+                        const struct unit_type *punittype,
+                        const struct player *pplayer,
+                        const struct tile *t1, const struct tile *t2)
 {
   const struct unit_class *pclass = utype_class(punittype);
   int cost;
@@ -835,26 +835,6 @@
 }
 
 /***************************************************************
-  The cost to move punit from where it is to tile x,y.
-  It is assumed the move is a valid one, e.g. the tiles are adjacent.
-***************************************************************/
-int map_move_cost_unit(struct unit *punit, const struct tile *ptile)
-{
-  return tile_move_cost_ptrs(punit, unit_type_get(punit), unit_owner(punit),
-                             unit_tile(punit), ptile);
-}
-
-/***************************************************************
-  Move cost between two tiles
-***************************************************************/
-int map_move_cost(const struct player *pplayer,
-                  const struct unit_type *punittype,
-                  const struct tile *src_tile, const struct tile *dst_tile)
-{
-  return tile_move_cost_ptrs(NULL, punittype, pplayer, src_tile, dst_tile);
-}
-
-/***************************************************************
   Are two tiles adjacent to each other.
 ***************************************************************/
 bool is_tiles_adjacent(const struct tile *tile0, const struct tile *tile1)

Modified: branches/S2_6/common/map.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/map.h?rev=31887&r1=31886&r2=31887&view=diff
==============================================================================
--- branches/S2_6/common/map.h  (original)
+++ branches/S2_6/common/map.h  Thu Feb 11 21:40:19 2016
@@ -268,11 +268,34 @@
 bool is_tiles_adjacent(const struct tile *ptile0, const struct tile *ptile1);
 bool is_move_cardinal(const struct tile *src_tile,
                      const struct tile *dst_tile);
-int map_move_cost_unit(struct unit *punit, const struct tile *ptile);
-int map_move_cost(const struct player *pplayer,
-                  const struct unit_type *punittype,
-                  const struct tile *src_tile,
-                  const struct tile *dst_tile);
+
+int tile_move_cost_ptrs(const struct unit *punit,
+                        const struct unit_type *punittype,
+                        const struct player *pplayer,
+                        const struct tile *t1, const struct tile *t2);
+
+/***************************************************************
+  The cost to move punit from where it is to tile x,y.
+  It is assumed the move is a valid one, e.g. the tiles are adjacent.
+***************************************************************/
+static inline int map_move_cost_unit(struct unit *punit,
+                                     const struct tile *ptile)
+{
+  return tile_move_cost_ptrs(punit, unit_type_get(punit), unit_owner(punit),
+                             unit_tile(punit), ptile);
+}
+
+/***************************************************************
+  Move cost between two tiles
+***************************************************************/
+static inline int map_move_cost(const struct player *pplayer,
+                                const struct unit_type *punittype,
+                                const struct tile *src_tile,
+                                const struct tile *dst_tile)
+{
+  return tile_move_cost_ptrs(NULL, punittype, pplayer, src_tile, dst_tile);
+}
+
 bool is_safe_ocean(const struct tile *ptile);
 bv_extras get_tile_infrastructure_set(const struct tile *ptile,
                                       int *count);


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

Reply via email to