Author: sveinung Date: Wed Jan 18 22:49:10 2017 New Revision: 34869 URL: http://svn.gna.org/viewcvs/freeciv?rev=34869&view=rev Log: Move tile seen checker to the tile module.
Rename the function is_tile_seen() to tile_is_seen() and move it from the metaknowledge module to the tile module. See patch #8080 Modified: branches/S3_0/common/metaknowledge.c branches/S3_0/common/tile.c branches/S3_0/common/tile.h Modified: branches/S3_0/common/metaknowledge.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/metaknowledge.c?rev=34869&r1=34868&r2=34869&view=diff ============================================================================== --- branches/S3_0/common/metaknowledge.c (original) +++ branches/S3_0/common/metaknowledge.c Wed Jan 18 22:49:10 2017 @@ -41,15 +41,6 @@ } /************************************************************************** - Returns TRUE iff the target_tile is seen by pow_player. -**************************************************************************/ -static bool is_tile_seen(const struct player *pow_player, - const struct tile *target_tile) -{ - return tile_get_known(target_tile, pow_player) == TILE_KNOWN_SEEN; -} - -/************************************************************************** Returns TRUE iff the target_tile it self and all tiles cardinally adjacent to it are seen by pow_player. **************************************************************************/ @@ -57,13 +48,13 @@ const struct tile *target_tile) { /* The tile it self is unseen. */ - if (!is_tile_seen(pow_player, target_tile)) { + if (!tile_is_seen(target_tile, pow_player)) { return FALSE; } /* A cardinally adjacent tile is unseen. */ cardinal_adjc_iterate(target_tile, ptile) { - if (!is_tile_seen(pow_player, ptile)) { + if (!tile_is_seen(ptile, pow_player)) { return FALSE; } } cardinal_adjc_iterate_end; @@ -80,13 +71,13 @@ const struct tile *target_tile) { /* The tile it self is unseen. */ - if (!is_tile_seen(pow_player, target_tile)) { + if (!tile_is_seen(target_tile, pow_player)) { return FALSE; } /* An adjacent tile is unseen. */ adjc_iterate(target_tile, ptile) { - if (!is_tile_seen(pow_player, ptile)) { + if (!tile_is_seen(ptile, pow_player)) { return FALSE; } } adjc_iterate_end; @@ -109,7 +100,7 @@ /* A tile of the city is unseen */ city_tile_iterate(city_map_radius_sq_get(target_city), city_tile(target_city), ptile) { - if (!is_tile_seen(pow_player, ptile)) { + if (!tile_is_seen(ptile, pow_player)) { return FALSE; } } city_tile_iterate_end; @@ -361,7 +352,7 @@ switch (req->range) { case REQ_RANGE_LOCAL: /* Known because the tile is seen */ - if (is_tile_seen(pow_player, target_tile)) { + if (tile_is_seen(target_tile, pow_player)) { return TRUE; } @@ -575,7 +566,7 @@ switch (req->range) { case REQ_RANGE_LOCAL: - return is_tile_seen(pow_player, target_tile); + return tile_is_seen(target_tile, pow_player); case REQ_RANGE_CADJACENT: /* TODO: The answer is known when the universal is located on a seen * tile. Is returning TRUE in those cases worth the added complexity @@ -724,7 +715,7 @@ return TRUE; } - if (is_tile_seen(pow_player, city_tile(target_city))) { + if (tile_is_seen(city_tile(target_city), pow_player)) { /* The tile is being observed. */ return TRUE; } Modified: branches/S3_0/common/tile.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/tile.c?rev=34869&r1=34868&r2=34869&view=diff ============================================================================== --- branches/S3_0/common/tile.c (original) +++ branches/S3_0/common/tile.c Wed Jan 18 22:49:10 2017 @@ -428,6 +428,15 @@ } } +/************************************************************************** + Returns TRUE iff the target_tile is seen by pow_player. +**************************************************************************/ +bool tile_is_seen(const struct tile *target_tile, + const struct player *pow_player) +{ + return tile_get_known(target_tile, pow_player) == TILE_KNOWN_SEEN; +} + /**************************************************************************** Time to complete the given activity on the given tile. ****************************************************************************/ Modified: branches/S3_0/common/tile.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/tile.h?rev=34869&r1=34868&r2=34869&view=diff ============================================================================== --- branches/S3_0/common/tile.h (original) +++ branches/S3_0/common/tile.h Wed Jan 18 22:49:10 2017 @@ -158,6 +158,9 @@ enum known_type tile_get_known(const struct tile *ptile, const struct player *pplayer); +bool tile_is_seen(const struct tile *target_tile, + const struct player *pow_player); + /* A somewhat arbitrary integer value. Activity times are multiplied by * this amount, and divided by them later before being used. This may * help to avoid rounding errors; however it should probably be removed. */ _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits