[Freeciv-Dev] (PR#4725) Rename map_get_known and map_get_known_and_seen
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#4725) Rename map_get_known and map_get_known_and_seen to map_is_* |
From: |
"Andy Smith" <andy@xxxxxxxxxxxxxx> |
Date: |
Wed, 30 Jul 2003 21:58:29 -0700 |
Reply-to: |
rt@xxxxxxxxxxxxxx |
Attached is a patch to rename map_get_known() and
map_get_known_and_seen() to map_is_known() and
map_is_known_and_seen() as per Gregory's suggestion in
http://lists.complete.org/freeciv-dev@xxxxxxxxxxx/2003/07/msg00672.html.gz
There are also a few trivial coding style fixes around the same
code.
TODO: perhaps now rename map_get_known2() to map_get_known as the
name is free? It seems silly to have a map_get_known2() where
there is no map_get_known().
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/ai/aiair.c
freeciv-map-get-fix/ai/aiair.c
--- freeciv-cvs/ai/aiair.c 2003-07-17 19:56:50.000000000 +0100
+++ freeciv-map-get-fix/ai/aiair.c 2003-07-31 05:34:17.000000000 +0100
@@ -178,12 +178,12 @@
/* Let's find something to bomb */
iterate_outward(x, y, max_dist, x1, y1) {
- if (ai_handicap(pplayer, H_MAP) && !map_get_known(x1, y1, pplayer)) {
+ if (ai_handicap(pplayer, H_MAP) && !map_is_known(x1, y1, pplayer)) {
/* The target tile is unknown */
continue;
}
if (ai_handicap(pplayer, H_FOG)
- && !map_get_known_and_seen(x1, y1, pplayer)) {
+ && !map_is_known_and_seen(x1, y1, pplayer)) {
/* The tile is fogged */
continue;
}
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/ai/aidata.c
freeciv-map-get-fix/ai/aidata.c
--- freeciv-cvs/ai/aidata.c 2003-07-17 19:56:50.000000000 +0100
+++ freeciv-map-get-fix/ai/aidata.c 2003-07-31 05:37:04.000000000 +0100
@@ -151,8 +151,9 @@
if (is_ocean(ptile->terrain)) {
if (ai->explore.sea_done && ai_handicap(pplayer, H_TARGETS)
- && !map_get_known(x, y, pplayer)) {
- ai->explore.sea_done = FALSE; /* we're not done there */
+ && !map_is_known(x, y, pplayer)) {
+ /* We're not done there. */
+ ai->explore.sea_done = FALSE;
}
/* skip rest, which is land only */
continue;
@@ -163,7 +164,7 @@
}
if ((map_has_special(x, y, S_HUT)
&& (!ai_handicap(pplayer, H_HUTS)
- || map_get_known(x, y, pplayer)))
+ || map_is_known(x, y, pplayer)))
|| (ptile->city && unit_list_size(&ptile->units) == 0
&& pplayers_at_war(pplayer, city_owner(ptile->city)))) {
/* hut, empty city... what is the difference? :) */
@@ -171,7 +172,7 @@
ai->explore.continent[continent] = TRUE;
continue;
}
- if (ai_handicap(pplayer, H_TARGETS) && !map_get_known(x, y, pplayer)) {
+ if (ai_handicap(pplayer, H_TARGETS) && !map_is_known(x, y, pplayer)) {
/* this AI must explore */
ai->explore.land_done = FALSE;
ai->explore.continent[continent] = TRUE;
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/ai/aitools.c
freeciv-map-get-fix/ai/aitools.c
--- freeciv-cvs/ai/aitools.c 2003-07-17 19:56:50.000000000 +0100
+++ freeciv-map-get-fix/ai/aitools.c 2003-07-31 05:37:25.000000000 +0100
@@ -396,7 +396,7 @@
if ((best_dist == -1 || city_dist < best_dist)
&& (everywhere || con == 0
|| con == map_get_continent(pcity->x, pcity->y))
- && (!pplayer || map_get_known(pcity->x, pcity->y, pplayer))) {
+ && (!pplayer || map_is_known(pcity->x, pcity->y, pplayer))) {
best_dist = city_dist;
pc = pcity;
}
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/ai/aiunit.c
freeciv-map-get-fix/ai/aiunit.c
--- freeciv-cvs/ai/aiunit.c 2003-07-20 21:41:37.000000000 +0100
+++ freeciv-map-get-fix/ai/aiunit.c 2003-07-31 05:49:53.000000000 +0100
@@ -308,7 +308,7 @@
{
int sum;
- if (map_get_known(x, y, pplayer)) {
+ if (map_is_known(x, y, pplayer)) {
/* we've seen the tile already. */
return (is_ocean(map_get_terrain(x,y)) ? 100 : 0);
}
@@ -321,7 +321,7 @@
* the centre tile. */
sum = 50;
adjc_dir_iterate(x, y, x1, y1, dir) {
- if (map_get_known(x1, y1, pplayer)) {
+ if (map_is_known(x1, y1, pplayer)) {
if (DIR_IS_CARDINAL(dir)) {
/* If a tile is cardinally adjacent, we can tell if the
* central tile is ocean or not by the appearance of
@@ -449,7 +449,7 @@
square_iterate(x, y, range, x1, y1) {
int ocean = likely_ocean(x1, y1, pplayer);
- if (!map_get_known(x1, y1, pplayer)) {
+ if (!map_is_known(x1, y1, pplayer)) {
unknown++;
/* FIXME: we should add OWN_CITY_SCORE to desirable if the tile
@@ -477,7 +477,7 @@
}
if ((!pplayer->ai.control || !ai_handicap(pplayer, H_HUTS))
- && map_get_known(x, y, pplayer)
+ && map_is_known(x, y, pplayer)
&& map_has_special(x, y, S_HUT)) {
/* we want to explore huts whenever we can,
* even if doing so will not uncover any tiles. */
@@ -2065,7 +2065,7 @@
&& !(goto_is_sane(punit, acity->x, acity->y, TRUE)
&& WARMAP_COST(acity->x, acity->y) < maxd));
- if (handicap && !map_get_known(acity->x, acity->y, pplayer)) {
+ if (handicap && !map_is_known(acity->x, acity->y, pplayer)) {
/* Can't see it */
continue;
}
@@ -2215,7 +2215,7 @@
continue;
}
- if (handicap && !map_get_known(aunit->x, aunit->y, pplayer)) {
+ if (handicap && !map_is_known(aunit->x, aunit->y, pplayer)) {
/* Can't see the target */
continue;
}
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/server/barbarian.c
freeciv-map-get-fix/server/barbarian.c
--- freeciv-cvs/server/barbarian.c 2003-07-13 02:51:11.000000000 +0100
+++ freeciv-map-get-fix/server/barbarian.c 2003-07-31 04:26:47.000000000
+0100
@@ -348,7 +348,7 @@
/* I think Sea Raiders can come out of unknown sea territory */
if (!find_empty_tile_nearby(x,y,&xu,&yu)
- || (!map_get_known(xu, yu, victim)
+ || (!map_is_known(xu, yu, victim)
&& !is_ocean(map_get_terrain(xu, yu)))
|| !is_near_land(xu, yu)) {
return;
@@ -408,7 +408,7 @@
notify_player_ex(victim, xu, yu, E_UPRISING,
_("Native unrest near %s led by %s."), pc->name,
barbarians->name);
- } else if (map_get_known_and_seen(xu, yu, victim)) {
+ } else if (map_is_known_and_seen(xu, yu, victim)) {
notify_player_ex(victim, xu, yu, E_UPRISING,
_("Sea raiders seen near %s!"), pc->name);
}
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/server/citytools.c
freeciv-map-get-fix/server/citytools.c
--- freeciv-cvs/server/citytools.c 2003-07-24 18:41:05.000000000 +0100
+++ freeciv-map-get-fix/server/citytools.c 2003-07-31 04:54:14.000000000
+0100
@@ -1162,7 +1162,7 @@
map_update_borders_city_destroyed(x, y);
players_iterate(other_player) {
- if (map_get_known_and_seen(x, y, other_player)) {
+ if (map_is_known_and_seen(x, y, other_player)) {
reality_check_city(other_player, x, y);
}
} players_iterate_end;
@@ -1325,7 +1325,7 @@
sz_strlcpy(packet->name, pdcity->name);
packet->size=pdcity->size;
- if (map_get_known_and_seen(x, y, pplayer)) {
+ if (map_is_known_and_seen(x, y, pplayer)) {
/* Since the tile is visible the player can see the tile,
and if it didn't actually have a city pdcity would be NULL */
assert(pcity != NULL);
@@ -1356,7 +1356,7 @@
void refresh_dumb_city(struct city *pcity)
{
players_iterate(pplayer) {
- if (map_get_known_and_seen(pcity->x, pcity->y, pplayer)
+ if (map_is_known_and_seen(pcity->x, pcity->y, pplayer)
|| player_has_traderoute_with_city(pplayer, pcity)) {
if (update_dumb_city(pplayer, pcity)) {
struct packet_short_city sc_pack;
@@ -1400,9 +1400,13 @@
/* send to all others who can see the city: */
players_iterate(pplayer) {
- if(city_owner(pcity) == pplayer) continue; /* already sent above */
- if (map_get_known_and_seen(pcity->x, pcity->y, pplayer) ||
- player_has_traderoute_with_city(pplayer, pcity)) {
+ if (city_owner(pcity) == pplayer) {
+ /* Already sent above. */
+ continue;
+ }
+
+ if (map_is_known_and_seen(pcity->x, pcity->y, pplayer)
+ || player_has_traderoute_with_city(pplayer, pcity)) {
update_dumb_city(pplayer, pcity);
package_dumb_city(pplayer, pcity->x, pcity->y, &sc_pack);
lsend_packet_short_city(&pplayer->connections, &sc_pack);
@@ -1534,10 +1538,10 @@
lsend_packet_city_info(dest, &packet);
}
} else {
- if (!map_get_known(x, y, pviewer)) {
+ if (!map_is_known(x, y, pviewer)) {
show_area(pviewer, x, y, 0);
}
- if (map_get_known_and_seen(x, y, pviewer)) {
+ if (map_is_known_and_seen(x, y, pviewer)) {
if (pcity) { /* it's there and we see it; update and send */
update_dumb_city(pviewer, pcity);
package_dumb_city(pviewer, x, y, &sc_pack);
@@ -1883,19 +1887,24 @@
int map_x, map_y;
struct tile *ptile;
- if (!city_map_to_map(&map_x, &map_y, pcity, city_x, city_y))
+ if (!city_map_to_map(&map_x, &map_y, pcity, city_x, city_y)) {
return FALSE;
+ }
+
ptile = map_get_tile(map_x, map_y);
if (is_enemy_unit_tile(ptile, city_owner(pcity))
- && !is_city_center(city_x, city_y))
+ && !is_city_center(city_x, city_y)) {
return FALSE;
+ }
- if (!map_get_known(map_x, map_y, city_owner(pcity)))
+ if (!map_is_known(map_x, map_y, city_owner(pcity))) {
return FALSE;
+ }
- if (ptile->worked && ptile->worked != pcity)
+ if (ptile->worked && ptile->worked != pcity) {
return FALSE;
+ }
if (ptile->owner && ptile->owner->player_no != pcity->owner) {
return FALSE;
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/server/diplhand.c
freeciv-map-get-fix/server/diplhand.c
--- freeciv-cvs/server/diplhand.c 2003-06-27 00:03:13.000000000 +0100
+++ freeciv-map-get-fix/server/diplhand.c 2003-07-31 04:28:57.000000000
+0100
@@ -521,7 +521,7 @@
*/
if (packet->clause_type == CLAUSE_CITY){
struct city *pcity = find_city_by_id(packet->value);
- if (pcity && !map_get_known_and_seen(pcity->x, pcity->y, plr1))
+ if (pcity && !map_is_known_and_seen(pcity->x, pcity->y, plr1))
give_citymap_from_player_to_player(pcity, plr0, plr1);
}
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/server/gotohand.c
freeciv-map-get-fix/server/gotohand.c
--- freeciv-cvs/server/gotohand.c 2003-07-22 12:48:35.000000000 +0100
+++ freeciv-map-get-fix/server/gotohand.c 2003-07-31 04:18:59.000000000
+0100
@@ -651,7 +651,7 @@
else
move_cost = MIN(psrctile->move_cost[dir],
unit_type(punit)->move_rate);
- if (!pplayer->ai.control && !map_get_known(x1, y1, pplayer)) {
+ if (!pplayer->ai.control && !map_is_known(x1, y1, pplayer)) {
/* Don't go into the unknown. 5*SINGLE_MOVE is an arbitrary
deterrent. */
move_cost = (restriction == GOTO_MOVE_STRAIGHTEST) ? SINGLE_MOVE :
5*SINGLE_MOVE;
} else if (is_non_allied_unit_tile(pdesttile, unit_owner(punit))) {
@@ -723,7 +723,7 @@
move_cost = 20 * SINGLE_MOVE;
}
- if (!pplayer->ai.control && !map_get_known(x1, y1, pplayer))
+ if (!pplayer->ai.control && !map_is_known(x1, y1, pplayer))
move_cost = (restriction == GOTO_MOVE_STRAIGHTEST) ? SINGLE_MOVE :
5*SINGLE_MOVE; /* arbitrary deterrent. */
/* We don't allow attacks during GOTOs here; you can almost
@@ -1072,7 +1072,7 @@
adjc_iterate(x, y, tmp_x, tmp_y) {
struct tile *adjtile = map_get_tile(tmp_x, tmp_y);
- if (!map_get_known(tmp_x, tmp_y, pplayer)) {
+ if (!map_is_known(tmp_x, tmp_y, pplayer)) {
if (punit->moves_left < base_move_cost) {
/* Avoid the unknown */
fitness[dir] -=
@@ -1207,7 +1207,7 @@
return TRUE;
}
- if (!(omni || map_get_known_and_seen(x, y, pplayer))) {
+ if (!(omni || map_is_known_and_seen(x, y, pplayer))) {
/* The destination is in unknown -- assume sane */
return TRUE;
}
@@ -1466,7 +1466,7 @@
*/
/* If the tile's unknown, we (may) assume it's safe. */
- if (ai_handicap(pplayer, H_MAP) && !map_get_known(x, y, pplayer)) {
+ if (ai_handicap(pplayer, H_MAP) && !map_is_known(x, y, pplayer)) {
return AIR_ASSUMES_UNKNOWN_SAFE;
}
@@ -1478,7 +1478,7 @@
/* If the tile's fogged we again (may) assume it's safe. */
if (ai_handicap(pplayer, H_FOG) &&
- !map_get_known_and_seen(x, y, pplayer)) {
+ !map_is_known_and_seen(x, y, pplayer)) {
return AIR_ASSUMES_FOGGED_SAFE;
}
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/server/maphand.c
freeciv-map-get-fix/server/maphand.c
--- freeciv-cvs/server/maphand.c 2003-07-23 14:46:04.000000000 +0100
+++ freeciv-map-get-fix/server/maphand.c 2003-07-31 05:17:17.000000000
+0100
@@ -310,7 +310,7 @@
if (!pplayer) {
send_tile_info_always(pplayer, &pconn->self, x, y);
- } else if (map_get_known(x, y, pplayer)) {
+ } else if (map_is_known(x, y, pplayer)) {
send_tile_info_always(pplayer, &pconn->self, x, y);
}
} conn_list_iterate_end;
@@ -343,7 +343,7 @@
if (!pplayer && !pconn->observer) {
continue;
}
- if (!pplayer || map_get_known_and_seen(x, y, pplayer)) {
+ if (!pplayer || map_is_known_and_seen(x, y, pplayer)) {
info.known = TILE_KNOWN;
info.type = ptile->terrain;
info.special = ptile->special;
@@ -352,7 +352,7 @@
update_tile_knowledge(pplayer,x,y);
}
send_packet_tile_info(pconn, &info);
- } else if (pplayer && map_get_known(x, y, pplayer)
+ } else if (pplayer && map_is_known(x, y, pplayer)
&& !map_get_seen(x, y, pplayer)) {
/* Just update the owner */
struct player_tile *plrtile = map_get_player_tile(x, y, pplayer);
@@ -387,24 +387,28 @@
info.y = y;
info.owner = ptile->owner ? ptile->owner->player_no : MAP_TILE_OWNER_NULL;
- if (!pplayer) { /* observer sees all */
+ if (!pplayer) {
+ /* Observer sees all. */
info.known=TILE_KNOWN;
info.type = ptile->terrain;
info.special = ptile->special;
info.continent = ptile->continent;
- }
- else if (map_get_known(x, y, pplayer)) {
- if (map_get_seen(x, y, pplayer) != 0) { /* known and seen */
- update_tile_knowledge(pplayer,x,y); /* visible; update info */
+ } else if (map_is_known(x, y, pplayer)) {
+ if (map_get_seen(x, y, pplayer) != 0) {
+ /* Known and seen. */
+ /* Visible; update info. */
+ update_tile_knowledge(pplayer,x,y);
info.known = TILE_KNOWN;
- } else { /* known but not seen */
+ } else {
+ /* Known but not seen. */
info.known = TILE_KNOWN_FOGGED;
}
plrtile = map_get_player_tile(x, y, pplayer);
info.type = plrtile->terrain;
info.special = plrtile->special;
info.continent = ptile->continent;
- } else { /* unknown (the client needs these sometimes to draw correctly) */
+ } else {
+ /* Unknown (the client needs these sometimes to draw correctly). */
info.known = TILE_UNKNOWN;
info.type = ptile->terrain;
info.special = ptile->special;
@@ -484,7 +488,7 @@
static void really_unfog_area(struct player *pplayer, int x, int y)
{
struct city *pcity;
- bool old_known = map_get_known(x, y, pplayer);
+ bool old_known = map_is_known(x, y, pplayer);
freelog(LOG_DEBUG, "really unfogging %d,%d\n", x, y);
@@ -530,16 +534,18 @@
/* the player himself */
shared_vision_change_seen(abs_x, abs_y, pplayer, +1);
if (map_get_seen(abs_x, abs_y, pplayer) == 1
- || !map_get_known(abs_x, abs_y, pplayer))
+ || !map_is_known(abs_x, abs_y, pplayer)) {
really_unfog_area(pplayer, abs_x, abs_y);
+ }
/* players (s)he gives shared vision */
players_iterate(pplayer2) {
- if (!really_gives_vision(pplayer, pplayer2))
+ if (!really_gives_vision(pplayer, pplayer2)) {
continue;
+ }
if (map_get_seen(abs_x, abs_y, pplayer2) == 1
- || !map_get_known(abs_x, abs_y, pplayer2)) {
+ || !map_is_known(abs_x, abs_y, pplayer2)) {
really_unfog_area(pplayer2, abs_x, abs_y);
}
reveal_pending_seen(pplayer2, abs_x, abs_y, 0);
@@ -571,18 +577,21 @@
{
buffer_shared_vision(pplayer);
square_iterate(x, y, len, abs_x, abs_y) {
- if (map_get_known(abs_x, abs_y, pplayer)) {
+ if (map_is_known(abs_x, abs_y, pplayer)) {
/* the player himself */
shared_vision_change_seen(abs_x, abs_y, pplayer, -1);
- if (map_get_seen(abs_x, abs_y, pplayer) == 0)
+ if (map_get_seen(abs_x, abs_y, pplayer) == 0) {
really_fog_area(pplayer, abs_x, abs_y);
+ }
/* players (s)he gives shared vision */
players_iterate(pplayer2) {
- if (!really_gives_vision(pplayer, pplayer2))
+ if (!really_gives_vision(pplayer, pplayer2)) {
continue;
- if (map_get_seen(abs_x, abs_y, pplayer2) == 0)
+ }
+ if (map_get_seen(abs_x, abs_y, pplayer2) == 0) {
really_fog_area(pplayer2, abs_x, abs_y);
+ }
} players_iterate_end;
} else {
decrement_pending_seen(pplayer, abs_x, abs_y);
@@ -654,7 +663,7 @@
buffer_shared_vision(pplayer);
map_city_radius_iterate(x, y, x_itr, y_itr) {
- if (map_get_known(x_itr, y_itr, pplayer)) {
+ if (map_is_known(x_itr, y_itr, pplayer)) {
unfog_area(pplayer, x_itr, y_itr, 0);
} else {
increment_pending_seen(pplayer, x_itr, y_itr);
@@ -672,7 +681,7 @@
buffer_shared_vision(pplayer);
map_city_radius_iterate(x, y, x_itr, y_itr) {
- if (map_get_known(x_itr, y_itr, pplayer)) {
+ if (map_is_known(x_itr, y_itr, pplayer)) {
fog_area(pplayer, x_itr, y_itr, 0);
} else {
decrement_pending_seen(pplayer, x_itr, y_itr);
@@ -706,11 +715,11 @@
static void really_show_area(struct player *pplayer, int x, int y)
{
struct city *pcity;
- bool old_known = map_get_known(x, y, pplayer);
+ bool old_known = map_is_known(x, y, pplayer);
freelog(LOG_DEBUG, "Showing %i,%i", x, y);
- if (!map_get_known_and_seen(x, y, pplayer)) {
+ if (!map_is_known_and_seen(x, y, pplayer)) {
map_set_known(x, y, pplayer);
/* as the tile may be fogged send_tile_info won't always do this for us */
@@ -773,7 +782,7 @@
/***************************************************************
...
***************************************************************/
-bool map_get_known(int x, int y, struct player *pplayer)
+bool map_is_known(int x, int y, struct player *pplayer)
{
return TEST_BIT(map_get_tile(x, y)->known, pplayer->player_no);
}
@@ -781,7 +790,7 @@
/***************************************************************
...
***************************************************************/
-bool map_get_known_and_seen(int x, int y, struct player *pplayer)
+bool map_is_known_and_seen(int x, int y, struct player *pplayer)
{
int offset = map_pos_to_index(x, y);
@@ -814,8 +823,9 @@
static int map_get_own_seen(int x, int y, struct player *pplayer)
{
int own_seen = map_get_player_tile(x, y, pplayer)->own_seen;
- if (own_seen != 0)
- assert(map_get_known(x, y, pplayer));
+ if (own_seen != 0) {
+ assert(map_is_known(x, y, pplayer));
+ }
return own_seen;
}
@@ -924,7 +934,7 @@
plrtile->seen = 0;
plrtile->pending_seen = 0;
if (!game.fogofwar_old) {
- if (map_get_known(x, y, pplayer)) {
+ if (map_is_known(x, y, pplayer)) {
plrtile->seen = 1;
} else {
plrtile->pending_seen = 1;
@@ -971,18 +981,19 @@
int x, int y)
{
struct player_tile *from_tile, *dest_tile;
- if (!map_get_known_and_seen(x, y, pdest)) {
+ if (!map_is_known_and_seen(x, y, pdest)) {
/* I can just hear people scream as they try to comprehend this if :).
- Let me try in words:
- 1) if the tile is seen by pdest the info is sent to pfrom
- OR
- 2) if the tile is known by pfrom AND (he has more resent info
- OR it is not known by pdest) */
- if (map_get_known_and_seen(x, y, pfrom)
- || (map_get_known(x,y,pfrom)
+ * Let me try in words:
+ * 1) if the tile is seen by pdest the info is sent to pfrom
+ * OR
+ * 2) if the tile is known by pfrom AND (he has more recent info
+ * OR it is not known by pdest)
+ */
+ if (map_is_known_and_seen(x, y, pfrom)
+ || (map_is_known(x,y,pfrom)
&& (((map_get_player_tile(x, y, pfrom)->last_updated
> map_get_player_tile(x, y, pdest)->last_updated))
- || !map_get_known(x, y, pdest)))) {
+ || !map_is_known(x, y, pdest)))) {
from_tile = map_get_player_tile(x, y, pfrom);
dest_tile = map_get_player_tile(x, y, pdest);
/* Update and send tile knowledge */
@@ -1186,7 +1197,7 @@
*************************************************************************/
enum known_type map_get_known2(int x, int y, struct player *pplayer)
{
- if (map_get_known(x, y, pplayer)) {
+ if (map_is_known(x, y, pplayer)) {
if (map_get_own_seen(x, y, pplayer) > 0) {
return TILE_KNOWN;
} else {
@@ -1203,7 +1214,7 @@
static void enable_fog_of_war_player(struct player *pplayer)
{
whole_map_iterate(x, y) {
- if (map_get_known(x, y, pplayer)) {
+ if (map_is_known(x, y, pplayer)) {
fog_area(pplayer, x, y, 0);
} else {
decrement_pending_seen(pplayer, x, y);
@@ -1227,7 +1238,7 @@
static void disable_fog_of_war_player(struct player *pplayer)
{
whole_map_iterate(x, y) {
- if (map_get_known(x, y, pplayer)) {
+ if (map_is_known(x, y, pplayer)) {
unfog_area(pplayer, x, y, 0);
} else {
increment_pending_seen(pplayer, x, y);
@@ -1260,7 +1271,7 @@
continue;
}
/* Found land next to (x,y). Can we see it? */
- if (ai_always_see_map || map_get_known(x1, y1, pplayer)) {
+ if (ai_always_see_map || map_is_known(x1, y1, pplayer)) {
/* Yes, we can see it */
return TRUE;
}
@@ -1271,7 +1282,7 @@
/* We cannot see strip of land on diagonal tiles */
continue;
}
- if (map_get_known(x2, y2, pplayer)) {
+ if (map_is_known(x2, y2, pplayer)) {
/* Yes, we can see (x2, y2) and it will display
* the strip of land. We can conclude that (x1, y1) is land
* and therefore (x,y) is right next to (or on) the land */
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/server/maphand.h
freeciv-map-get-fix/server/maphand.h
--- freeciv-cvs/server/maphand.h 2003-07-23 14:46:04.000000000 +0100
+++ freeciv-map-get-fix/server/maphand.h 2003-07-31 05:17:37.000000000
+0100
@@ -66,9 +66,9 @@
void map_unfog_pseudo_city_area(struct player *pplayer, int x,int y);
void map_fog_pseudo_city_area(struct player *pplayer, int x,int y);
-bool map_get_known_and_seen(int x, int y, struct player *pplayer);
+bool map_is_known_and_seen(int x, int y, struct player *pplayer);
void map_change_seen(int x, int y, struct player *pplayer, int change);
-bool map_get_known(int x, int y, struct player *pplayer);
+bool map_is_known(int x, int y, struct player *pplayer);
void map_set_known(int x, int y, struct player *pplayer);
void map_clear_known(int x, int y, struct player *pplayer);
void map_know_all(struct player *pplayer);
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/server/plrhand.c
freeciv-map-get-fix/server/plrhand.c
--- freeciv-cvs/server/plrhand.c 2003-07-21 02:43:52.000000000 +0100
+++ freeciv-map-get-fix/server/plrhand.c 2003-07-31 04:32:51.000000000
+0100
@@ -994,7 +994,7 @@
if (server_state >= RUN_GAME_STATE
&& (x != -1 || y != -1) /* special case, see above */
&& ((!pconn->player && pconn->observer)
- || (pconn->player && map_get_known(x, y, pconn->player)))) {
+ || (pconn->player && map_is_known(x, y, pconn->player)))) {
CHECK_MAP_POS(x, y);
genmsg.x = x;
genmsg.y = y;
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/server/sanitycheck.c
freeciv-map-get-fix/server/sanitycheck.c
--- freeciv-cvs/server/sanitycheck.c 2003-07-23 14:46:04.000000000 +0100
+++ freeciv-map-get-fix/server/sanitycheck.c 2003-07-31 05:24:57.000000000
+0100
@@ -69,8 +69,9 @@
assert(plr_tile->pending_seen < 60000);
assert(plr_tile->own_seen <= plr_tile->seen);
- if (map_get_known(x, y, pplayer))
+ if (map_is_known(x, y, pplayer)) {
assert(plr_tile->pending_seen == 0);
+ }
} players_iterate_end;
} whole_map_iterate_end;
}
@@ -188,7 +189,7 @@
case C_TILE_UNAVAILABLE:
if (!map_get_tile(map_x, map_y)->worked
&& !is_enemy_unit_tile(ptile, pplayer)
- && map_get_known(map_x, map_y, pplayer)
+ && map_is_known(map_x, map_y, pplayer)
&& (!owner || owner->player_no == pcity->owner)) {
freelog(LOG_ERROR, "Tile at %s->%d,%d marked as "
"unavailable but seems to be available!",
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/server/savegame.c
freeciv-map-get-fix/server/savegame.c
--- freeciv-cvs/server/savegame.c 2003-07-23 14:46:04.000000000 +0100
+++ freeciv-map-get-fix/server/savegame.c 2003-07-31 03:57:17.000000000
+0100
@@ -1262,7 +1262,7 @@
/* This shouldn't be neccesary if the savegame was consistent, but there
is a bug in some pre-1.11 savegames. Anyway, it can't hurt */
whole_map_iterate(x, y) {
- if (map_get_known_and_seen(x, y, plr)) {
+ if (map_is_known_and_seen(x, y, plr)) {
update_tile_knowledge(plr, x, y);
reality_check_city(plr, x, y);
if (map_get_city(x, y)) {
@@ -1276,7 +1276,7 @@
players private knowledge is set to be what he could see
without fog of war */
whole_map_iterate(x, y) {
- if (map_get_known(x, y, plr)) {
+ if (map_is_known(x, y, plr)) {
struct city *pcity = map_get_city(x, y);
update_player_tile_last_seen(plr, x, y);
update_tile_knowledge(plr, x, y);
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/server/settlers.c
freeciv-map-get-fix/server/settlers.c
--- freeciv-cvs/server/settlers.c 2003-07-21 02:19:36.000000000 +0100
+++ freeciv-map-get-fix/server/settlers.c 2003-07-31 04:49:11.000000000
+0100
@@ -517,7 +517,9 @@
enum tile_terrain_type t;
enum tile_special_type s;
- if (!pplayer->ai.control && !map_get_known(x, y, pplayer)) return FALSE;
+ if (!pplayer->ai.control && !map_is_known(x, y, pplayer)) {
+ return FALSE;
+ }
t=map_get_terrain(x,y);
if (is_ocean(t) || t == T_RIVER) {
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/server/unithand.c
freeciv-map-get-fix/server/unithand.c
--- freeciv-cvs/server/unithand.c 2003-07-20 21:41:39.000000000 +0100
+++ freeciv-map-get-fix/server/unithand.c 2003-07-31 04:30:10.000000000
+0100
@@ -756,8 +756,8 @@
0, FALSE);
players_iterate(other_player) {
- if (map_get_known_and_seen(punit->x, punit->y, other_player) ||
- map_get_known_and_seen(def_x, def_y, other_player)) {
+ if (map_is_known_and_seen(punit->x, punit->y, other_player) ||
+ map_is_known_and_seen(def_x, def_y, other_player)) {
/*
* Special case for attacking/defending:
diff -ruN -Xfreeciv-cvs/diff_ignore freeciv-cvs/server/unittools.c
freeciv-map-get-fix/server/unittools.c
--- freeciv-cvs/server/unittools.c 2003-07-24 17:52:28.000000000 +0100
+++ freeciv-map-get-fix/server/unittools.c 2003-07-31 05:23:09.000000000
+0100
@@ -1255,7 +1255,7 @@
adjc_iterate(x, y, x1, y1) {
if (ai_handicap(pplayer, H_FOG)
- && !map_get_known_and_seen(x1, y1, unit_owner(punit))) {
+ && !map_is_known_and_seen(x1, y1, unit_owner(punit))) {
/* We cannot see danger at (x1, y1) => assume there is none */
continue;
}
@@ -1565,7 +1565,7 @@
packet.value = punit->id;
players_iterate(pplayer) {
- if (map_get_known_and_seen(punit_x, punit_y, pplayer)) {
+ if (map_is_known_and_seen(punit_x, punit_y, pplayer)) {
lsend_packet_generic_integer(&pplayer->connections, PACKET_REMOVE_UNIT,
&packet);
}
@@ -1825,7 +1825,7 @@
freelog(LOG_ERROR, "NULL pointer in can_player_see_unit_at");
return FALSE;
} else {
- bool see_tile = map_get_known_and_seen(x, y, pplayer);
+ bool see_tile = map_is_known_and_seen(x, y, pplayer);
bool see_unit = player_can_see_unit_at_location(pplayer, punit, x, y);
bool not_in_city = (pplayers_allied(unit_owner(punit), pplayer)
|| !map_get_city(x, y));
@@ -1896,7 +1896,7 @@
struct player *unitowner = &game.players[p];
unit_list_iterate(unitowner->units, punit) {
if (!pplayer
- || map_get_known_and_seen(punit->x, punit->y, pplayer)) {
+ || map_is_known_and_seen(punit->x, punit->y, pplayer)) {
send_unit_info_to_onlookers(&pconn->self, punit,
punit->x, punit->y, FALSE);
}
@@ -2078,7 +2078,7 @@
return FALSE;
}
- if (!map_get_known(dest_x, dest_y, pplayer)) {
+ if (!map_is_known(dest_x, dest_y, pplayer)) {
notify_player_ex(pplayer, dest_x, dest_y, E_NOEVENT,
_("Game: The destination location is not known."));
return FALSE;
@@ -2091,8 +2091,9 @@
return FALSE;
}
- if (map_get_known_and_seen(dest_x, dest_y, pplayer) && ((ptile->city
- && pplayers_non_attack(pplayer, city_owner(ptile->city)))
+ if (map_is_known_and_seen(dest_x, dest_y, pplayer)
+ && ((ptile->city
+ && pplayers_non_attack(pplayer, city_owner(ptile->city)))
|| is_non_attack_unit_tile(ptile, pplayer))) {
notify_player_ex(pplayer, dest_x, dest_y, E_NOEVENT,
_("Game: Cannot attack unless you declare war first."));
@@ -2623,7 +2624,7 @@
if (!pplayers_allied(unit_owner(punit), unit_owner(penemy))
&& penemy->activity == ACTIVITY_SENTRY
- && map_get_known_and_seen(punit->x, punit->y, unit_owner(penemy))
+ && map_is_known_and_seen(punit->x, punit->y, unit_owner(penemy))
&& range >= real_map_distance(punit->x, punit->y, x, y)
&& player_can_see_unit(unit_owner(penemy), punit)
/* on board transport; don't awaken */
- [Freeciv-Dev] (PR#4725) Rename map_get_known and map_get_known_and_seen to map_is_*,
Andy Smith <=
|
|