[Freeciv-Dev] (PR#14294) circular vision for units
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14294 >
This patch changes unit vision to use circles.
The vision code is simplified a little. fog_area and unfog_area are
made static. Several "area" functions are changed to be either "circle"
or "tile" functions.
Watchtower code is also fixed. Watchtower values are moved from
game.info (what were they doing there???) into terrain_control, and are
no longer loaded from the savegame (which was a bug that should be
checked in 2.0).
Except for watchtowers and AWACS, the behavior is unchanged in all rulesets.
This also fixes an off-by-one bug introduced in refog_circle that was
introduced in the last patch.
-jason
Index: server/srv_main.c
===================================================================
--- server/srv_main.c (revision 11111)
+++ server/srv_main.c (working copy)
@@ -334,7 +334,7 @@
if (get_player_bonus(pplayer, EFT_REVEAL_CITIES) > 0) {
players_iterate(other_player) {
city_list_iterate(other_player->cities, pcity) {
- show_area(pplayer, pcity->tile, 0);
+ show_circle(pplayer, pcity->tile, 0);
} city_list_iterate_end;
} players_iterate_end;
}
Index: server/citytools.c
===================================================================
--- server/citytools.c (revision 11111)
+++ server/citytools.c (working copy)
@@ -1009,9 +1009,10 @@
struct player *owner = unit_owner(punit);
if (player_knows_techs_with_flag(owner, TF_WATCHTOWER)) {
- unfog_area(owner, punit->tile,
- unit_type(punit)->vision_range);
- fog_area(owner, punit->tile, get_watchtower_vision(punit));
+ map_refog_circle(owner, punit->tile,
+ get_watchtower_vision(punit),
+ punit->type->vision_radius_sq,
+ FALSE);
}
} unit_list_iterate_end;
}
@@ -1536,7 +1537,7 @@
}
} else {
if (!map_is_known(ptile, pviewer)) {
- show_area(pviewer, ptile, 0);
+ show_circle(pviewer, ptile, 0);
}
if (map_is_known_and_seen(ptile, pviewer)) {
if (pcity) { /* it's there and we see it; update and send */
Index: server/barbarian.c
===================================================================
--- server/barbarian.c (revision 11111)
+++ server/barbarian.c (working copy)
@@ -54,6 +54,9 @@
#include "barbarian.h"
+#define BARBARIAN_INITIAL_VISION_RADIUS 3
+#define BARBARIAN_INITIAL_VISION_RADIUS_SQ 9
+
/*
IDEAS:
1. Unrest factors configurable via rulesets (distance and gov factor)
@@ -311,7 +314,7 @@
/* FIXME: I don't know if this is needed */
if (utile) {
- show_area(barbarians, utile, 3);
+ show_circle(barbarians, utile, BARBARIAN_INITIAL_VISION_RADIUS_SQ);
}
return alive;
@@ -464,8 +467,8 @@
} unit_list_iterate_end;
/* to let them know where to get you */
- show_area(barbarians, utile, 3);
- show_area(barbarians, pc->tile, 3);
+ show_circle(barbarians, utile, BARBARIAN_INITIAL_VISION_RADIUS_SQ);
+ show_circle(barbarians, pc->tile, BARBARIAN_INITIAL_VISION_RADIUS_SQ);
/* There should probably be a different message about Sea Raiders */
if (is_land_barbarian(barbarians)) {
Index: server/ruleset.c
===================================================================
--- server/ruleset.c (revision 11111)
+++ server/ruleset.c (working copy)
@@ -1115,8 +1115,8 @@
u->move_rate =
SINGLE_MOVE*secfile_lookup_int(file,"%s.move_rate", sec[i]);
- u->vision_range =
- secfile_lookup_int(file,"%s.vision_range", sec[i]);
+ u->vision_radius_sq =
+ secfile_lookup_int(file,"%s.vision_radius_sq", sec[i]);
u->transport_capacity =
secfile_lookup_int(file,"%s.transport_cap", sec[i]);
u->hp = secfile_lookup_int(file,"%s.hitpoints", sec[i]);
@@ -1467,14 +1467,8 @@
terrain_control.fortress_defense_bonus =
secfile_lookup_int_default(file, 100, "parameters.fortress_defense_bonus");
- game.info.watchtower_extra_vision =
- secfile_lookup_int_default(file, GAME_DEFAULT_WATCHTOWER_EXTRA_VISION,
- "parameters.fortress_extra_vision");
- if (game.info.watchtower_extra_vision < GAME_MIN_WATCHTOWER_EXTRA_VISION
- || game.info.watchtower_extra_vision > GAME_MAX_WATCHTOWER_EXTRA_VISION)
{
- freelog(LOG_FATAL, _("Fortress vision range set to illegal value."));
- exit(EXIT_FAILURE);
- }
+ terrain_control.watchtower_extra_vision_radius_sq
+ = secfile_lookup_int(file, "parameters.fortress_extra_vision_radius_sq");
terrain_control.road_superhighway_trade_bonus =
secfile_lookup_int_default(file, 50,
"parameters.road_superhighway_trade_bonus");
@@ -2667,7 +2661,7 @@
packet.impr_requirement = u->impr_requirement;
packet.gov_requirement
= u->gov_requirement ? u->gov_requirement->index : -1;
- packet.vision_range = u->vision_range;
+ packet.vision_radius_sq = u->vision_radius_sq;
packet.transport_capacity = u->transport_capacity;
packet.hp = u->hp;
packet.firepower = u->firepower;
Index: server/gamehand.c
===================================================================
--- server/gamehand.c (revision 11111)
+++ server/gamehand.c (working copy)
@@ -80,9 +80,7 @@
}
/* Expose visible area. */
- circle_iterate(ptile, game.info.init_vis_radius_sq, ctile) {
- show_area(pplayer, ctile, 0);
- } circle_iterate_end;
+ show_circle(pplayer, ptile, game.info.init_vis_radius_sq);
switch(crole) {
case 'c':
Index: server/maphand.c
===================================================================
--- server/maphand.c (revision 11111)
+++ server/maphand.c (working copy)
@@ -56,6 +56,9 @@
static Continent_id *lake_surrounders;
static int *continent_sizes, *ocean_sizes;
+static void map_unfog_tile(struct player *pplayer, struct tile *ptile);
+static void map_fog_tile(struct player *pplayer, struct tile *ptile);
+
/**************************************************************************
Number this tile and nearby tiles (recursively) with the specified
continent number nr, using a flood-fill algorithm.
@@ -537,16 +540,15 @@
/**************************************************************************
...
**************************************************************************/
-static void reveal_pending_seen(struct player *pplayer, struct tile *ptile,
int len)
+static void reveal_pending_seen(struct player *pplayer, struct tile *ptile)
{
- square_iterate(ptile, len, tile1) {
- int pseen = map_get_pending_seen(pplayer, tile1);
- map_set_pending_seen(pplayer, tile1, 0);
- while (pseen > 0) {
- unfog_area(pplayer, tile1, 0);
- pseen--;
- }
- } square_iterate_end;
+ int pseen = map_get_pending_seen(pplayer, ptile);
+
+ map_set_pending_seen(pplayer, ptile, 0);
+ while (pseen > 0) {
+ map_unfog_tile(pplayer, ptile);
+ pseen--;
+ }
}
/*************************************************************************
@@ -593,7 +595,7 @@
/**************************************************************************
...
**************************************************************************/
-static void really_unfog_area(struct player *pplayer, struct tile *ptile)
+static void really_unfog_tile(struct player *pplayer, struct tile *ptile)
{
struct city *pcity;
bool old_known = map_is_known(ptile, pplayer);
@@ -633,45 +635,37 @@
}
/**************************************************************************
- Add an extra point of visibility to a square centered at x,y with
- sidelength 1+2*len, ie length 1 is normal sightrange for a unit.
- pplayer may not be NULL.
+ Add an extra point of visibility to the given tile. pplayer may not be
+ NULL. The caller may wish to buffer_shared_vision if calling this
+ function multiple times.
**************************************************************************/
-void unfog_area(struct player *pplayer, struct tile *ptile, int len)
+static void map_unfog_tile(struct player *pplayer, struct tile *ptile)
{
/* Did the tile just become visible?
- send info about units and cities and the tile itself */
- buffer_shared_vision(pplayer);
- square_iterate(ptile, len, tile1) {
- /* the player himself */
- shared_vision_change_seen(tile1, pplayer, +1);
- if (map_get_seen(tile1, pplayer) == 1
- || !map_is_known(tile1, pplayer)) {
- really_unfog_area(pplayer, tile1);
- }
- /* players (s)he gives shared vision */
- players_iterate(pplayer2) {
- if (!really_gives_vision(pplayer, pplayer2)) {
- continue;
- }
+ /* Increase seen count. */
+ shared_vision_change_seen(ptile, pplayer, +1);
- if (map_get_seen(tile1, pplayer2) == 1
- || !map_is_known(tile1, pplayer2)) {
- really_unfog_area(pplayer2, tile1);
- }
- reveal_pending_seen(pplayer2, tile1, 0);
- } players_iterate_end;
- } square_iterate_end;
+ /* And then give the vision. */
+ players_iterate(pplayer2) {
+ if (pplayer2 != pplayer
+ && !really_gives_vision(pplayer, pplayer2)) {
+ continue;
+ }
- reveal_pending_seen(pplayer, ptile, len);
- unbuffer_shared_vision(pplayer);
+ if (map_get_seen(ptile, pplayer2) == 1
+ || !map_is_known(ptile, pplayer2)) {
+ really_unfog_tile(pplayer2, ptile);
+ }
+ reveal_pending_seen(pplayer2, ptile);
+ } players_iterate_end;
}
/**************************************************************************
...
**************************************************************************/
-static void really_fog_area(struct player *pplayer, struct tile *ptile)
+static void really_fog_tile(struct player *pplayer, struct tile *ptile)
{
freelog(LOG_DEBUG, "Fogging %i,%i. Previous fog: %i.",
TILE_XY(ptile), map_get_seen(ptile, pplayer));
@@ -687,34 +681,31 @@
}
/**************************************************************************
- Remove a point of visibility from a square centered at x,y with
- sidelength 1+2*len, ie length 1 is normal sightrange for a unit.
+ Remove a point of visibility from the given tile. pplayer may not be
+ NULL. The caller may wish to buffer_shared_vision if calling this
+ function multiple times.
**************************************************************************/
-void fog_area(struct player *pplayer, struct tile *ptile, int len)
+static void map_fog_tile(struct player *pplayer, struct tile *ptile)
{
- buffer_shared_vision(pplayer);
- square_iterate(ptile, len, tile1) {
- if (map_is_known(tile1, pplayer)) {
- /* the player himself */
- shared_vision_change_seen(tile1, pplayer, -1);
- if (map_get_seen(tile1, pplayer) == 0) {
- really_fog_area(pplayer, tile1);
- }
-
- /* players (s)he gives shared vision */
- players_iterate(pplayer2) {
- if (!really_gives_vision(pplayer, pplayer2)) {
- continue;
- }
- if (map_get_seen(tile1, pplayer2) == 0) {
- really_fog_area(pplayer2, tile1);
- }
- } players_iterate_end;
- } else {
- decrement_pending_seen(pplayer, tile1);
+ if (map_is_known(ptile, pplayer)) {
+ /* the player himself */
+ shared_vision_change_seen(ptile, pplayer, -1);
+ if (map_get_seen(ptile, pplayer) == 0) {
+ really_fog_tile(pplayer, ptile);
}
- } square_iterate_end;
- unbuffer_shared_vision(pplayer);
+
+ /* players (s)he gives shared vision */
+ players_iterate(pplayer2) {
+ if (!really_gives_vision(pplayer, pplayer2)) {
+ continue;
+ }
+ if (map_get_seen(ptile, pplayer2) == 0) {
+ really_fog_tile(pplayer2, ptile);
+ }
+ } players_iterate_end;
+ } else {
+ decrement_pending_seen(pplayer, ptile);
+ }
}
/**************************************************************************
@@ -798,13 +789,13 @@
circle_dxyr_iterate(ptile, max_radius, tile1, dx, dy, dr) {
if (dr > old_radius_sq && dr <= new_radius_sq) {
if (!pseudo || map_is_known(tile1, pplayer)) {
- unfog_area(pplayer, tile1, 0);
+ map_unfog_tile(pplayer, tile1);
} else {
increment_pending_seen(pplayer, tile1);
}
- } else if (dr > new_radius_sq && dr < old_radius_sq) {
+ } else if (dr > new_radius_sq && dr <= old_radius_sq) {
if (!pseudo || map_is_known(tile1, pplayer)) {
- fog_area(pplayer, tile1, 0);
+ map_fog_tile(pplayer, tile1);
} else {
decrement_pending_seen(pplayer, tile1);
}
@@ -821,22 +812,25 @@
{
struct tile *ptile = punit->tile;
struct player *pplayer = unit_owner(punit);
+ int vision;
freelog(LOG_DEBUG, "Removing unit sight points at %i,%i",
TILE_XY(punit->tile));
if (tile_has_special(punit->tile, S_FORTRESS)
- && unit_profits_of_watchtower(punit))
- fog_area(pplayer, ptile, get_watchtower_vision(punit));
- else
- fog_area(pplayer, ptile, unit_type(punit)->vision_range);
+ && unit_profits_of_watchtower(punit)) {
+ vision = get_watchtower_vision(punit);
+ } else {
+ vision = unit_type(punit)->vision_radius_sq;
+ }
+ map_refog_circle(pplayer, ptile, vision, -1, FALSE);
}
/**************************************************************************
Shows area even if still fogged. If the tile is not "seen" units are not
shown
**************************************************************************/
-static void really_show_area(struct player *pplayer, struct tile *ptile)
+static void really_show_tile(struct player *pplayer, struct tile *ptile)
{
struct city *pcity;
bool old_known = map_is_known(ptile, pplayer);
@@ -883,23 +877,20 @@
/**************************************************************************
Shows area, ie send terrain etc., even if still fogged, sans units and cities.
**************************************************************************/
-void show_area(struct player *pplayer, struct tile *ptile, int len)
+void show_circle(struct player *pplayer, struct tile *ptile, int radius_sq)
{
buffer_shared_vision(pplayer);
- square_iterate(ptile, len, tile1) {
- /* the player himself */
- really_show_area(pplayer, tile1);
- /* players (s)he gives shared vision */
+ circle_iterate(ptile, radius_sq, tile1) {
players_iterate(pplayer2) {
- if (really_gives_vision(pplayer, pplayer2)) {
- really_show_area(pplayer2, tile1);
- reveal_pending_seen(pplayer2, tile1, 0);
+ if (pplayer == pplayer2
+ || really_gives_vision(pplayer, pplayer2)) {
+ really_show_tile(pplayer2, tile1);
+ reveal_pending_seen(pplayer2, tile1);
}
} players_iterate_end;
- } square_iterate_end;
+ } circle_iterate_end;
- reveal_pending_seen(pplayer, ptile, len);
unbuffer_shared_vision(pplayer);
}
@@ -999,9 +990,11 @@
***************************************************************/
void map_know_all(struct player *pplayer)
{
+ buffer_shared_vision(pplayer);
whole_map_iterate(ptile) {
- show_area(pplayer, ptile, 0);
+ show_circle(pplayer, ptile, 0);
} whole_map_iterate_end;
+ unbuffer_shared_vision(pplayer);
}
/***************************************************************
@@ -1009,9 +1002,11 @@
***************************************************************/
void map_know_and_see_all(struct player *pplayer)
{
+ buffer_shared_vision(pplayer);
whole_map_iterate(ptile) {
- unfog_area(pplayer, ptile, 0);
+ map_unfog_tile(pplayer, ptile);
} whole_map_iterate_end;
+ unbuffer_shared_vision(pplayer);
}
/**************************************************************************
@@ -1216,7 +1211,7 @@
send_city_info_at_tile(pdest, pdest->connections, NULL, ptile);
}
- reveal_pending_seen(pdest, ptile, 0);
+ reveal_pending_seen(pdest, ptile);
map_city_radius_iterate(ptile, tile1) {
struct city *pcity = tile_get_city(tile1);
@@ -1316,8 +1311,8 @@
if (change != 0) {
map_change_seen(ptile, pplayer2, change);
if (map_get_seen(ptile, pplayer2) == change) {
- really_unfog_area(pplayer2, ptile);
- reveal_pending_seen(pplayer2, ptile, 0);
+ really_unfog_tile(pplayer2, ptile);
+ reveal_pending_seen(pplayer2, ptile);
}
}
} whole_map_iterate_end;
@@ -1370,7 +1365,7 @@
if (change > 0) {
map_change_seen(ptile, pplayer2, -change);
if (map_get_seen(ptile, pplayer2) == 0)
- really_fog_area(pplayer2, ptile);
+ really_fog_tile(pplayer2, ptile);
}
} whole_map_iterate_end;
}
@@ -1388,13 +1383,15 @@
*************************************************************************/
static void enable_fog_of_war_player(struct player *pplayer)
{
+ buffer_shared_vision(pplayer);
whole_map_iterate(ptile) {
if (map_is_known(ptile, pplayer)) {
- fog_area(pplayer, ptile, 0);
+ map_fog_tile(pplayer, ptile);
} else {
decrement_pending_seen(pplayer, ptile);
}
} whole_map_iterate_end;
+ unbuffer_shared_vision(pplayer);
}
/*************************************************************************
@@ -1412,13 +1409,15 @@
*************************************************************************/
static void disable_fog_of_war_player(struct player *pplayer)
{
+ buffer_shared_vision(pplayer);
whole_map_iterate(ptile) {
if (map_is_known(ptile, pplayer)) {
- unfog_area(pplayer, ptile, 0);
+ map_unfog_tile(pplayer, ptile);
} else {
increment_pending_seen(pplayer, ptile);
}
} whole_map_iterate_end;
+ unbuffer_shared_vision(pplayer);
}
/*************************************************************************
Index: server/maphand.h
===================================================================
--- server/maphand.h (revision 11111)
+++ server/maphand.h (working copy)
@@ -63,14 +63,12 @@
void send_tile_info(struct conn_list *dest, struct tile *ptile);
void reveal_hidden_units(struct player *pplayer, struct tile *ptile);
void conceal_hidden_units(struct player *pplayer, struct tile *ptile);
-void unfog_area(struct player *pplayer, struct tile *ptile, int len);
-void fog_area(struct player *pplayer, struct tile *ptile, int len);
void upgrade_city_rails(struct player *pplayer, bool discovery);
void send_map_info(struct conn_list *dest);
void map_fog_city_area(struct city *pcity);
void map_unfog_city_area(struct city *pcity);
void remove_unit_sight_points(struct unit *punit);
-void show_area(struct player *pplayer,struct tile *ptile, int len);
+void show_circle(struct player *pplayer,struct tile *ptile, int radius_sq);
void map_refog_circle(struct player *pplayer, struct tile *ptile,
int old_radius_sq, int new_radius_sq, bool pseudo);
Index: server/unittools.c
===================================================================
--- server/unittools.c (revision 11111)
+++ server/unittools.c (working copy)
@@ -81,21 +81,6 @@
struct unit *ptrans);
/**************************************************************************
- Handle changes to (unit) vision range, usually caused by watchtower.
-**************************************************************************/
-static void change_vision_range(struct player *pplayer, struct tile *ptile,
- int old_range, int new_range)
-{
- if (new_range != old_range) {
- /* Make sure that area that is unfogged both before and after is
- not even temporarily fogged. Unfog (increase seen counter) first,
- fog (decrease seen counter) later. */
- unfog_area(pplayer, ptile, new_range);
- fog_area(pplayer, ptile, old_range);
- }
-}
-
-/**************************************************************************
Returns a unit type that matches the role_tech or role roles.
If role_tech is given, then we look at all units with this role
@@ -684,9 +669,9 @@
if (is_ground_unit(punit2)
&& player_knows_techs_with_flag(owner, TF_WATCHTOWER)) {
- change_vision_range(owner, punit2->tile,
- get_watchtower_vision(punit2),
- unit_type(punit2)->vision_range);
+ map_refog_circle(owner, punit2->tile,
+ get_watchtower_vision(punit2),
+ unit_type(punit2)->vision_radius_sq, FALSE);
}
}
unit_list_iterate_end;
@@ -718,9 +703,9 @@
if (is_ground_unit(punit2)
&& player_knows_techs_with_flag(owner, TF_WATCHTOWER)) {
- change_vision_range(owner, ptile,
- get_watchtower_vision(punit2),
- unit_type(punit2)->vision_range);
+ map_refog_circle(owner, ptile,
+ get_watchtower_vision(punit2),
+ unit_type(punit2)->vision_radius_sq, FALSE);
}
}
unit_list_iterate_end;
@@ -756,9 +741,9 @@
if (is_ground_unit(punit)
&& player_knows_techs_with_flag(owner, TF_WATCHTOWER)) {
- change_vision_range(pplayer, ptile,
- unit_type(punit)->vision_range,
- get_watchtower_vision(punit));
+ map_refog_circle(pplayer, ptile,
+ unit_type(punit)->vision_radius_sq,
+ get_watchtower_vision(punit), FALSE);
}
}
unit_list_iterate_end;
@@ -1290,7 +1275,7 @@
bool is_free)
{
struct player *pplayer = unit_owner(punit);
- int range;
+ int old_radius_sq, new_radius_sq;
int old_mr = unit_move_rate(punit), old_hp = unit_type(punit)->hp;
assert(test_unit_upgrade(punit, is_free) == UR_OK);
@@ -1303,9 +1288,9 @@
/* save old vision range */
if (tile_has_special(punit->tile, S_FORTRESS)
&& unit_profits_of_watchtower(punit))
- range = get_watchtower_vision(punit);
+ old_radius_sq = get_watchtower_vision(punit);
else
- range = unit_type(punit)->vision_range;
+ old_radius_sq = unit_type(punit)->vision_radius_sq;
punit->type = to_unit;
@@ -1320,10 +1305,11 @@
/* apply new vision range */
if (tile_has_special(punit->tile, S_FORTRESS)
&& unit_profits_of_watchtower(punit)) {
- change_vision_range(pplayer, punit->tile, range,
get_watchtower_vision(punit));
+ new_radius_sq = get_watchtower_vision(punit);
} else {
- change_vision_range(pplayer, punit->tile, range, to_unit->vision_range);
+ new_radius_sq = to_unit->vision_radius_sq;
}
+ map_refog_circle(pplayer, punit->tile, old_radius_sq, new_radius_sq, FALSE);
send_unit_info(NULL, punit);
conn_list_do_unbuffer(pplayer->connections);
@@ -1403,9 +1389,11 @@
if (tile_has_special(ptile, S_FORTRESS)
&& unit_profits_of_watchtower(punit)) {
- unfog_area(pplayer, punit->tile, get_watchtower_vision(punit));
+ map_refog_circle(pplayer, punit->tile,
+ -1, get_watchtower_vision(punit), FALSE);
} else {
- unfog_area(pplayer, ptile, unit_type(punit)->vision_range);
+ map_refog_circle(pplayer, ptile,
+ -1, unit_type(punit)->vision_radius_sq, FALSE);
}
send_unit_info(NULL, punit);
@@ -2180,10 +2168,7 @@
/* Safe terrain, really? Not transformed since player last saw it. */
if (!can_unit_exist_at_tile(punit, ptile)) {
- int srange = unit_type(punit)->vision_range;
-
- show_area(pplayer, ptile, srange);
-
+ show_circle(pplayer, ptile, unit_type(punit)->vision_radius_sq);
notify_player(pplayer, ptile, E_UNIT_LOST,
_("Your %s paradropped into the %s "
"and was lost."),
@@ -2194,8 +2179,7 @@
if ((ptile->city && pplayers_non_attack(pplayer, city_owner(ptile->city)))
|| is_non_allied_unit_tile(ptile, pplayer)) {
- int srange = unit_type(punit)->vision_range;
- show_area(pplayer, ptile, srange);
+ show_circle(pplayer, ptile, unit_type(punit)->vision_radius_sq);
maybe_make_contact(ptile, pplayer);
notify_player(pplayer, ptile, E_UNIT_LOST_ATT,
_("Your %s was killed by enemy units at the "
@@ -2566,19 +2550,19 @@
wake them up if the punit is farther away than 3. */
square_iterate(punit->tile, 3, ptile) {
unit_list_iterate(ptile->units, penemy) {
- int range;
+ int radius_sq;
enum unit_move_type move_type = unit_type(penemy)->move_type;
struct terrain *pterrain = tile_get_terrain(ptile);
if (tile_has_special(ptile, S_FORTRESS)
&& unit_profits_of_watchtower(penemy))
- range = get_watchtower_vision(penemy);
+ radius_sq = get_watchtower_vision(penemy);
else
- range = unit_type(penemy)->vision_range;
+ radius_sq = unit_type(penemy)->vision_radius_sq;
if (!pplayers_allied(unit_owner(punit), unit_owner(penemy))
&& penemy->activity == ACTIVITY_SENTRY
- && range >= real_map_distance(punit->tile, ptile)
+ && radius_sq >= sq_map_distance(punit->tile, ptile)
&& can_player_see_unit(unit_owner(penemy), punit)
/* on board transport; don't awaken */
&& !(move_type == LAND_MOVING && is_ocean(pterrain))) {
@@ -2754,7 +2738,8 @@
/* Insert them again. */
unit_list_iterate(cargo_units, pcargo) {
- unfog_area(unit_owner(pcargo), pdesttile,
unit_type(pcargo)->vision_range);
+ map_refog_circle(unit_owner(pcargo), pdesttile,
+ -1, unit_type(pcargo)->vision_radius_sq, FALSE);
/* Silently free orders since they won't be applicable anymore. */
free_unit_orders(pcargo);
@@ -2764,7 +2749,8 @@
unit_list_prepend(pdesttile->units, pcargo);
check_unit_activity(pcargo);
send_unit_info_to_onlookers(NULL, pcargo, psrctile, FALSE);
- fog_area(unit_owner(pcargo), psrctile, unit_type(pcargo)->vision_range);
+ map_refog_circle(unit_owner(pcargo), psrctile,
+ unit_type(pcargo)->vision_radius_sq, -1, FALSE);
handle_unit_move_consequences(pcargo, psrctile, pdesttile);
} unit_list_iterate_end;
unit_list_unlink_all(cargo_units);
@@ -2780,9 +2766,11 @@
/* Enhance vision if unit steps into a fortress */
if (unit_profits_of_watchtower(punit)
&& tile_has_special(pdesttile, S_FORTRESS)) {
- unfog_area(pplayer, pdesttile, get_watchtower_vision(punit));
+ map_refog_circle(pplayer, pdesttile,
+ -1, get_watchtower_vision(punit), FALSE);
} else {
- unfog_area(pplayer, pdesttile, unit_type(punit)->vision_range);
+ map_refog_circle(pplayer, pdesttile,
+ -1, unit_type(punit)->vision_radius_sq, FALSE);
}
unit_list_unlink(psrctile->units, punit);
@@ -2864,9 +2852,11 @@
if (unit_profits_of_watchtower(punit)
&& tile_has_special(psrctile, S_FORTRESS)) {
- fog_area(pplayer, psrctile, get_watchtower_vision(punit));
+ map_refog_circle(pplayer, psrctile,
+ get_watchtower_vision(punit), -1, FALSE);
} else {
- fog_area(pplayer, psrctile, unit_type(punit)->vision_range);
+ map_refog_circle(pplayer, psrctile,
+ unit_type(punit)->vision_radius_sq, -1, FALSE);
}
/*
@@ -2960,16 +2950,16 @@
static bool maybe_cancel_patrol_due_to_enemy(struct unit *punit)
{
bool cancel = FALSE;
- int range;
+ int radius_sq;
struct player *pplayer = unit_owner(punit);
if (tile_has_special(punit->tile, S_FORTRESS)
&& unit_profits_of_watchtower(punit))
- range = get_watchtower_vision(punit);
+ radius_sq = get_watchtower_vision(punit);
else
- range = unit_type(punit)->vision_range;
+ radius_sq = unit_type(punit)->vision_radius_sq;
- square_iterate(punit->tile, range, ptile) {
+ circle_iterate(punit->tile, radius_sq, ptile) {
struct unit *penemy =
is_non_allied_unit_tile(ptile, pplayer);
struct dumb_city *pdcity = map_get_player_tile(ptile, pplayer)->city;
@@ -2980,7 +2970,7 @@
cancel = TRUE;
break;
}
- } square_iterate_end;
+ } circle_iterate_end;
return cancel;
}
@@ -3253,7 +3243,8 @@
**************************************************************************/
int get_watchtower_vision(struct unit *punit)
{
- return (unit_type(punit)->vision_range + game.info.watchtower_extra_vision);
+ return (unit_type(punit)->vision_radius_sq
+ + terrain_control.watchtower_extra_vision_radius_sq);
}
/**************************************************************************
Index: server/techtools.c
===================================================================
--- server/techtools.c (revision 11111)
+++ server/techtools.c (working copy)
@@ -215,9 +215,9 @@
unit_list_iterate(plr->units, punit) {
if (tile_has_special(punit->tile, S_FORTRESS)
&& is_ground_unit(punit)) {
- unfog_area(plr, punit->tile, get_watchtower_vision(punit));
- fog_area(plr, punit->tile,
- unit_type(punit)->vision_range);
+ map_refog_circle(plr, punit->tile,
+ unit_type(punit)->vision_radius_sq,
+ get_watchtower_vision(punit), FALSE);
}
}
unit_list_iterate_end;
Index: server/unithand.c
===================================================================
--- server/unithand.c (revision 11111)
+++ server/unithand.c (working copy)
@@ -287,6 +287,8 @@
unit_list_unlink(old_pcity->units_supported, punit);
}
if (old_owner != new_owner) {
+ int vision_radius_sq;
+
remove_unit_sight_points(punit);
ai_reinit(punit);
@@ -296,10 +298,11 @@
if (tile_has_special(punit->tile, S_FORTRESS)
&& unit_profits_of_watchtower(punit)) {
- unfog_area(new_owner, punit->tile, get_watchtower_vision(punit));
+ vision_radius_sq = get_watchtower_vision(punit);
} else {
- unfog_area(new_owner, punit->tile, unit_type(punit)->vision_range);
+ vision_radius_sq = unit_type(punit)->vision_radius_sq;
}
+ map_refog_circle(new_owner, punit->tile, -1, vision_radius_sq, FALSE);
conceal_hidden_units(old_owner, punit->tile);
reveal_hidden_units(new_owner, punit->tile);
Index: server/savegame.c
===================================================================
--- server/savegame.c (revision 11111)
+++ server/savegame.c (working copy)
@@ -1573,26 +1573,24 @@
}
{
- /* Sanity: set the map to known for all tiles within the vision
- * range.
- *
- * FIXME: shouldn't this take into account modifiers like
- * watchtowers? */
- int range = unit_type(punit)->vision_range;
+ int radius_sq;
- square_iterate(punit->tile, range, tile1) {
+ if (tile_has_special(punit->tile, S_FORTRESS)
+ && unit_profits_of_watchtower(punit)) {
+ radius_sq = get_watchtower_vision(punit);
+ } else {
+ radius_sq = unit_type(punit)->vision_radius_sq;
+ }
+
+ /* Sanity: set the map to known for all tiles within the vision
+ * range. */
+ circle_iterate(punit->tile, radius_sq, tile1) {
map_set_known(tile1, plr);
- } square_iterate_end;
- }
+ } circle_iterate_end;
- /* allocate the unit's contribution to fog of war */
- if (unit_profits_of_watchtower(punit)
- && tile_has_special(punit->tile, S_FORTRESS)) {
- unfog_area(unit_owner(punit), punit->tile,
- get_watchtower_vision(punit));
- } else {
- unfog_area(unit_owner(punit), punit->tile,
- unit_type(punit)->vision_range);
+ /* allocate the unit's contribution to fog of war */
+ map_refog_circle(unit_owner(punit), punit->tile,
+ -1, radius_sq, FALSE);
}
unit_list_append(plr->units, punit);
@@ -3295,13 +3293,6 @@
game.info.diplomacy = secfile_lookup_int_default(file,
GAME_DEFAULT_DIPLOMACY,
"game.diplomacy");
- if (has_capability("watchtower", savefile_options)) {
- game.info.watchtower_extra_vision =
- secfile_lookup_int(file, "game.watchtower_extra_vision");
- } else {
- game.info.watchtower_extra_vision = 0;
- }
-
sz_strlcpy(game.save_name,
secfile_lookup_str_default(file, GAME_DEFAULT_SAVE_NAME,
"game.save_name"));
@@ -3865,9 +3856,12 @@
secfile_insert_int(file, game.info.borders, "game.borders");
secfile_insert_bool(file, game.info.happyborders, "game.happyborders");
secfile_insert_int(file, game.info.diplomacy, "game.diplomacy");
- /* watchtower_vision is required by 2.0 servers. */
+ /* watchtower_vision and watchtower_extra_vision are
+ * required by 2.0 servers. */
secfile_insert_int(file, 0, "game.watchtower_vision");
- secfile_insert_int(file, game.info.watchtower_extra_vision,
"game.watchtower_extra_vision");
+ secfile_insert_int(file,
+ (int)(sqrt(terrain_control.watchtower_extra_vision_radius_sq) + 0.5),
+ "game.watchtower_extra_vision");
secfile_insert_int(file, game.info.allowed_city_names,
"game.allowed_city_names");
/* old (1.14.1) servers need to have these server variables. The values
Index: data/civ1/units.ruleset
===================================================================
--- data/civ1/units.ruleset (revision 11111)
+++ data/civ1/units.ruleset (working copy)
@@ -111,7 +111,7 @@
hitpoints = 1
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -155,7 +155,7 @@
hitpoints = 1
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -187,7 +187,7 @@
hitpoints = 1
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -215,7 +215,7 @@
hitpoints = 1
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -243,7 +243,7 @@
hitpoints = 1
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -272,7 +272,7 @@
hitpoints = 1
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -300,7 +300,7 @@
hitpoints = 1
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -333,7 +333,7 @@
hitpoints = 1
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -361,7 +361,7 @@
hitpoints = 1
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -389,7 +389,7 @@
hitpoints = 1
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -418,7 +418,7 @@
hitpoints = 1
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -446,7 +446,7 @@
hitpoints = 1
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -474,7 +474,7 @@
hitpoints = 1
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -502,7 +502,7 @@
hitpoints = 1
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -530,7 +530,7 @@
hitpoints = 1
firepower = 1
move_rate = 10
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 1
uk_happy = 1
@@ -558,7 +558,7 @@
hitpoints = 1
firepower = 1
move_rate = 8
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 2
uk_happy = 1
@@ -586,7 +586,7 @@
hitpoints = 1
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 2
fuel = 0
uk_happy = 1
@@ -614,7 +614,7 @@
hitpoints = 1
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 3
fuel = 0
uk_happy = 1
@@ -642,7 +642,7 @@
hitpoints = 1
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 4
fuel = 0
uk_happy = 1
@@ -670,7 +670,7 @@
hitpoints = 1
firepower = 1
move_rate = 4
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -698,7 +698,7 @@
hitpoints = 1
firepower = 1
move_rate = 6
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -726,7 +726,7 @@
hitpoints = 1
firepower = 1
move_rate = 4
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -754,7 +754,7 @@
hitpoints = 1
firepower = 1
move_rate = 3
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -786,7 +786,7 @@
hitpoints = 1
firepower = 1
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 8
fuel = 0
uk_happy = 1
@@ -819,7 +819,7 @@
hitpoints = 1
firepower = 1
move_rate = 4
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 8
fuel = 0
uk_happy = 1
@@ -847,7 +847,7 @@
hitpoints = 1
firepower = 1
move_rate = 16
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 1
uk_happy = 1
@@ -894,7 +894,7 @@
hitpoints = 1
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -940,7 +940,7 @@
hitpoints = 1
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -976,7 +976,7 @@
hitpoints = 1
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
Index: data/civ1/terrain.ruleset
===================================================================
--- data/civ1/terrain.ruleset (revision 11111)
+++ data/civ1/terrain.ruleset (working copy)
@@ -52,6 +52,9 @@
; percent added to defense if square has fortress
fortress_defense_bonus=100
+; extra vision range given to units in a fortress
+fortress_extra_vision_radius_sq = 0
+
; percent added to trade production if road and city has superhighways
road_superhighway_trade_bonus=0
Index: data/civ2/units.ruleset
===================================================================
--- data/civ2/units.ruleset (revision 11111)
+++ data/civ2/units.ruleset (working copy)
@@ -103,7 +103,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -147,7 +147,7 @@
hitpoints = 20
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -188,7 +188,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -220,7 +220,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -248,7 +248,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -276,7 +276,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -304,7 +304,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -332,7 +332,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -362,7 +362,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -394,7 +394,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -434,7 +434,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -462,7 +462,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -490,7 +490,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -518,7 +518,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -550,7 +550,7 @@
hitpoints = 30
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -583,7 +583,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -611,7 +611,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -639,7 +639,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -667,7 +667,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -695,7 +695,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -724,7 +724,7 @@
hitpoints = 20
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -753,7 +753,7 @@
hitpoints = 20
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -781,7 +781,7 @@
hitpoints = 30
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -809,7 +809,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -837,7 +837,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -865,7 +865,7 @@
hitpoints = 20
firepower = 2
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -893,7 +893,7 @@
hitpoints = 30
firepower = 2
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -921,7 +921,7 @@
hitpoints = 20
firepower = 2
move_rate = 10
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 1
uk_happy = 0
@@ -949,7 +949,7 @@
hitpoints = 20
firepower = 2
move_rate = 8
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 2
uk_happy = 1
@@ -977,7 +977,7 @@
hitpoints = 20
firepower = 2
move_rate = 6
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1011,7 +1011,7 @@
hitpoints = 20
firepower = 2
move_rate = 14
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 1
uk_happy = 0
@@ -1043,7 +1043,7 @@
hitpoints = 20
firepower = 2
move_rate = 12
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 2
uk_happy = 1
@@ -1075,7 +1075,7 @@
hitpoints = 10
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 2
fuel = 0
uk_happy = 1
@@ -1103,7 +1103,7 @@
hitpoints = 10
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 3
fuel = 0
uk_happy = 1
@@ -1131,7 +1131,7 @@
hitpoints = 20
firepower = 1
move_rate = 4
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 4
fuel = 0
uk_happy = 1
@@ -1159,7 +1159,7 @@
hitpoints = 20
firepower = 1
move_rate = 4
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 2
fuel = 0
uk_happy = 1
@@ -1187,7 +1187,7 @@
hitpoints = 30
firepower = 1
move_rate = 4
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1215,7 +1215,7 @@
hitpoints = 30
firepower = 1
move_rate = 6
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1247,7 +1247,7 @@
hitpoints = 30
firepower = 2
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1275,7 +1275,7 @@
hitpoints = 30
firepower = 2
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1303,7 +1303,7 @@
hitpoints = 40
firepower = 2
move_rate = 4
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1331,7 +1331,7 @@
hitpoints = 30
firepower = 2
move_rate = 3
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 8
fuel = 0
uk_happy = 1
@@ -1364,7 +1364,7 @@
hitpoints = 40
firepower = 2
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 8
fuel = 0
uk_happy = 1
@@ -1397,7 +1397,7 @@
hitpoints = 30
firepower = 1
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 8
fuel = 0
uk_happy = 1
@@ -1425,7 +1425,7 @@
hitpoints = 10
firepower = 3
move_rate = 12
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 1
uk_happy = 1
@@ -1457,7 +1457,7 @@
hitpoints = 10
firepower = 1
move_rate = 16
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 1
uk_happy = 1
@@ -1504,7 +1504,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1550,7 +1550,7 @@
hitpoints = 10
firepower = 1
move_rate = 3
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1597,7 +1597,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1633,7 +1633,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1664,7 +1664,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1695,7 +1695,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
Index: data/civ2/terrain.ruleset
===================================================================
--- data/civ2/terrain.ruleset (revision 11111)
+++ data/civ2/terrain.ruleset (working copy)
@@ -60,6 +60,9 @@
; percent added to defense if square has fortress
fortress_defense_bonus=100
+; extra vision range given to units in a fortress
+fortress_extra_vision_radius_sq = 0
+
; percent added to trade production if road and city has superhighways
road_superhighway_trade_bonus=50
Index: data/default/units.ruleset
===================================================================
--- data/default/units.ruleset (revision 11111)
+++ data/default/units.ruleset (working copy)
@@ -209,7 +209,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -253,7 +253,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -294,7 +294,7 @@
hitpoints = 20
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -335,7 +335,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -367,7 +367,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -395,7 +395,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -423,7 +423,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -451,7 +451,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -479,7 +479,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -508,7 +508,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -548,7 +548,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -576,7 +576,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -604,7 +604,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -632,7 +632,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -664,7 +664,7 @@
hitpoints = 30
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -697,7 +697,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -725,7 +725,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -753,7 +753,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -782,7 +782,7 @@
hitpoints = 20
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -811,7 +811,7 @@
hitpoints = 20
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -839,7 +839,7 @@
hitpoints = 30
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -867,7 +867,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -895,7 +895,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -923,7 +923,7 @@
hitpoints = 20
firepower = 2
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -951,7 +951,7 @@
hitpoints = 30
firepower = 2
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -979,7 +979,7 @@
hitpoints = 20
firepower = 2
move_rate = 10
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 1
uk_happy = 0
@@ -1007,7 +1007,7 @@
hitpoints = 20
firepower = 2
move_rate = 8
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 2
uk_happy = 1
@@ -1035,7 +1035,7 @@
hitpoints = 20
firepower = 2
move_rate = 6
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1069,7 +1069,7 @@
hitpoints = 20
firepower = 2
move_rate = 14
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 1
uk_happy = 0
@@ -1101,7 +1101,7 @@
hitpoints = 20
firepower = 2
move_rate = 12
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 2
uk_happy = 1
@@ -1133,7 +1133,7 @@
hitpoints = 10
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 2
fuel = 0
uk_happy = 1
@@ -1161,7 +1161,7 @@
hitpoints = 10
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 3
fuel = 0
uk_happy = 1
@@ -1189,7 +1189,7 @@
hitpoints = 20
firepower = 1
move_rate = 4
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 4
fuel = 0
uk_happy = 1
@@ -1217,7 +1217,7 @@
hitpoints = 20
firepower = 1
move_rate = 4
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 2
fuel = 0
uk_happy = 1
@@ -1245,7 +1245,7 @@
hitpoints = 30
firepower = 1
move_rate = 4
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1273,7 +1273,7 @@
hitpoints = 30
firepower = 1
move_rate = 6
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1305,7 +1305,7 @@
hitpoints = 30
firepower = 2
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1333,7 +1333,7 @@
hitpoints = 30
firepower = 2
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1361,7 +1361,7 @@
hitpoints = 40
firepower = 2
move_rate = 4
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1389,7 +1389,7 @@
hitpoints = 30
firepower = 2
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 8
fuel = 0
uk_happy = 1
@@ -1422,7 +1422,7 @@
hitpoints = 40
firepower = 2
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 8
fuel = 0
uk_happy = 1
@@ -1455,7 +1455,7 @@
hitpoints = 30
firepower = 1
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 8
fuel = 0
uk_happy = 1
@@ -1483,7 +1483,7 @@
hitpoints = 10
firepower = 3
move_rate = 12
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 1
uk_happy = 1
@@ -1515,7 +1515,7 @@
hitpoints = 10
firepower = 1
move_rate = 16
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 1
uk_happy = 1
@@ -1562,7 +1562,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1608,7 +1608,7 @@
hitpoints = 10
firepower = 1
move_rate = 3
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1655,7 +1655,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1691,7 +1691,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1722,7 +1722,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1753,7 +1753,7 @@
hitpoints = 20
firepower = 1
move_rate = 2
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1786,7 +1786,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1819,7 +1819,7 @@
hitpoints = 20
firepower = 1
move_rate = 16
-vision_range = 5
+vision_radius_sq = 26
transport_cap = 0
fuel = 2
uk_happy = 1
Index: data/default/terrain.ruleset
===================================================================
--- data/default/terrain.ruleset (revision 11111)
+++ data/default/terrain.ruleset (working copy)
@@ -61,7 +61,7 @@
fortress_defense_bonus=100
; extra vision range given to units in a fortress
-fortress_extra_vision=2
+fortress_extra_vision_radius_sq = 8
; percent added to trade production if road and city has superhighways
road_superhighway_trade_bonus=50
Index: data/history/units.ruleset
===================================================================
--- data/history/units.ruleset (revision 11111)
+++ data/history/units.ruleset (working copy)
@@ -176,7 +176,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -220,7 +220,7 @@
hitpoints = 20
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -261,7 +261,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -293,7 +293,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -321,7 +321,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -349,7 +349,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -377,7 +377,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -405,7 +405,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -434,7 +434,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -474,7 +474,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -502,7 +502,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -530,7 +530,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -558,7 +558,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -590,7 +590,7 @@
hitpoints = 30
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -623,7 +623,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -651,7 +651,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -679,7 +679,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -708,7 +708,7 @@
hitpoints = 20
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -737,7 +737,7 @@
hitpoints = 20
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -765,7 +765,7 @@
hitpoints = 30
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -793,7 +793,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -821,7 +821,7 @@
hitpoints = 20
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -849,7 +849,7 @@
hitpoints = 20
firepower = 2
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -877,7 +877,7 @@
hitpoints = 30
firepower = 2
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -905,7 +905,7 @@
hitpoints = 20
firepower = 2
move_rate = 10
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 1
uk_happy = 0
@@ -933,7 +933,7 @@
hitpoints = 20
firepower = 2
move_rate = 8
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 2
uk_happy = 1
@@ -961,7 +961,7 @@
hitpoints = 20
firepower = 2
move_rate = 6
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -995,7 +995,7 @@
hitpoints = 20
firepower = 2
move_rate = 14
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 1
uk_happy = 0
@@ -1027,7 +1027,7 @@
hitpoints = 20
firepower = 2
move_rate = 12
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 2
uk_happy = 1
@@ -1059,7 +1059,7 @@
hitpoints = 10
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 2
fuel = 0
uk_happy = 1
@@ -1087,7 +1087,7 @@
hitpoints = 10
firepower = 1
move_rate = 3
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 3
fuel = 0
uk_happy = 1
@@ -1115,7 +1115,7 @@
hitpoints = 20
firepower = 1
move_rate = 4
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 4
fuel = 0
uk_happy = 1
@@ -1143,7 +1143,7 @@
hitpoints = 20
firepower = 1
move_rate = 4
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 2
fuel = 0
uk_happy = 1
@@ -1171,7 +1171,7 @@
hitpoints = 30
firepower = 1
move_rate = 4
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1199,7 +1199,7 @@
hitpoints = 30
firepower = 1
move_rate = 6
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1231,7 +1231,7 @@
hitpoints = 30
firepower = 2
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1259,7 +1259,7 @@
hitpoints = 30
firepower = 2
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1287,7 +1287,7 @@
hitpoints = 40
firepower = 2
move_rate = 4
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 1
@@ -1315,7 +1315,7 @@
hitpoints = 30
firepower = 2
move_rate = 3
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 8
fuel = 0
uk_happy = 1
@@ -1348,7 +1348,7 @@
hitpoints = 40
firepower = 2
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 8
fuel = 0
uk_happy = 1
@@ -1381,7 +1381,7 @@
hitpoints = 30
firepower = 1
move_rate = 5
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 8
fuel = 0
uk_happy = 1
@@ -1409,7 +1409,7 @@
hitpoints = 10
firepower = 3
move_rate = 12
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 1
uk_happy = 1
@@ -1441,7 +1441,7 @@
hitpoints = 10
firepower = 1
move_rate = 16
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 1
uk_happy = 1
@@ -1488,7 +1488,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1534,7 +1534,7 @@
hitpoints = 10
firepower = 1
move_rate = 3
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1581,7 +1581,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1617,7 +1617,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1648,7 +1648,7 @@
hitpoints = 10
firepower = 1
move_rate = 1
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1679,7 +1679,7 @@
hitpoints = 20
firepower = 1
move_rate = 2
-vision_range = 2
+vision_radius_sq = 8
transport_cap = 0
fuel = 0
uk_happy = 0
@@ -1712,7 +1712,7 @@
hitpoints = 10
firepower = 1
move_rate = 2
-vision_range = 1
+vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 0
Index: data/history/terrain.ruleset
===================================================================
--- data/history/terrain.ruleset (revision 11111)
+++ data/history/terrain.ruleset (working copy)
@@ -60,6 +60,9 @@
; percent added to defense if square has fortress
fortress_defense_bonus=100
+; extra vision range given to units in a fortress
+fortress_extra_vision_radius_sq = 8
+
; percent added to trade production if road and city has superhighways
road_superhighway_trade_bonus=50
Index: common/unittype.h
===================================================================
--- common/unittype.h (revision 11111)
+++ common/unittype.h (working copy)
@@ -163,7 +163,7 @@
int tech_requirement;
int impr_requirement; /* should be Impr_type_id */
struct government *gov_requirement; /* may be NULL */
- int vision_range;
+ int vision_radius_sq;
int transport_capacity;
int hp;
int firepower;
Index: common/packets.def
===================================================================
--- common/packets.def (revision 11111)
+++ common/packets.def (working copy)
@@ -409,7 +409,6 @@
BOOL slow_invasions;
UINT8 add_to_size_limit;
UINT8 notradesize, fulltradesize;
- UINT8 watchtower_extra_vision;
UINT8 allowed_city_names;
IMPROVEMENT palace_building;
IMPROVEMENT land_defend_building;
@@ -1045,7 +1044,7 @@
TECH tech_requirement;
UINT8 impr_requirement;
GOVERNMENT gov_requirement;
- UINT8 vision_range;
+ UINT16 vision_radius_sq;
UINT8 transport_capacity;
UINT8 hp;
UINT8 firepower;
@@ -1158,6 +1157,8 @@
UINT16 rail_tile_bonus[O_MAX]; /* % added to output if railroad */
UINT8 pollution_tile_penalty[O_MAX]; /* % taken from output if polluted */
UINT8 fallout_tile_penalty[O_MAX]; /* % taken from output if polluted */
+
+ UINT16 watchtower_extra_vision_radius_sq;
end
PACKET_RULESET_NATION=102;sc,lsend
Index: common/packets_gen.c
===================================================================
--- common/packets_gen.c (revision 11111)
+++ common/packets_gen.c (working copy)
@@ -3281,7 +3281,7 @@
#define cmp_packet_game_info_100 cmp_const
-BV_DEFINE(packet_game_info_100_fields, 107);
+BV_DEFINE(packet_game_info_100_fields, 106);
static struct packet_game_info *receive_packet_game_info_100(struct connection
*pc, enum packet_type type)
{
@@ -3754,7 +3754,7 @@
int readin;
dio_get_uint8(&din, &readin);
- real_packet->watchtower_extra_vision = readin;
+ real_packet->allowed_city_names = readin;
}
}
if (BV_ISSET(fields, 67)) {
@@ -3762,7 +3762,7 @@
int readin;
dio_get_uint8(&din, &readin);
- real_packet->allowed_city_names = readin;
+ real_packet->palace_building = readin;
}
}
if (BV_ISSET(fields, 68)) {
@@ -3770,19 +3770,11 @@
int readin;
dio_get_uint8(&din, &readin);
- real_packet->palace_building = readin;
- }
- }
- if (BV_ISSET(fields, 69)) {
- {
- int readin;
-
- dio_get_uint8(&din, &readin);
real_packet->land_defend_building = readin;
}
}
- real_packet->changable_tax = BV_ISSET(fields, 70);
- if (BV_ISSET(fields, 71)) {
+ real_packet->changable_tax = BV_ISSET(fields, 69);
+ if (BV_ISSET(fields, 70)) {
{
int readin;
@@ -3790,7 +3782,7 @@
real_packet->forced_science = readin;
}
}
- if (BV_ISSET(fields, 72)) {
+ if (BV_ISSET(fields, 71)) {
{
int readin;
@@ -3798,7 +3790,7 @@
real_packet->forced_luxury = readin;
}
}
- if (BV_ISSET(fields, 73)) {
+ if (BV_ISSET(fields, 72)) {
{
int readin;
@@ -3806,7 +3798,7 @@
real_packet->forced_gold = readin;
}
}
- if (BV_ISSET(fields, 74)) {
+ if (BV_ISSET(fields, 73)) {
{
int i;
@@ -3821,7 +3813,7 @@
}
}
}
- if (BV_ISSET(fields, 75)) {
+ if (BV_ISSET(fields, 74)) {
{
int readin;
@@ -3829,7 +3821,7 @@
real_packet->min_dist_bw_cities = readin;
}
}
- if (BV_ISSET(fields, 76)) {
+ if (BV_ISSET(fields, 75)) {
{
int readin;
@@ -3837,7 +3829,7 @@
real_packet->init_vis_radius_sq = readin;
}
}
- if (BV_ISSET(fields, 77)) {
+ if (BV_ISSET(fields, 76)) {
{
int readin;
@@ -3845,8 +3837,8 @@
real_packet->hut_overflight = readin;
}
}
- real_packet->pillage_select = BV_ISSET(fields, 78);
- if (BV_ISSET(fields, 79)) {
+ real_packet->pillage_select = BV_ISSET(fields, 77);
+ if (BV_ISSET(fields, 78)) {
{
int readin;
@@ -3854,7 +3846,7 @@
real_packet->nuke_contamination = readin;
}
}
- if (BV_ISSET(fields, 80)) {
+ if (BV_ISSET(fields, 79)) {
{
int i;
@@ -3869,7 +3861,7 @@
}
}
}
- if (BV_ISSET(fields, 81)) {
+ if (BV_ISSET(fields, 80)) {
{
int readin;
@@ -3877,7 +3869,7 @@
real_packet->granary_num_inis = readin;
}
}
- if (BV_ISSET(fields, 82)) {
+ if (BV_ISSET(fields, 81)) {
{
int readin;
@@ -3885,7 +3877,7 @@
real_packet->granary_food_inc = readin;
}
}
- if (BV_ISSET(fields, 83)) {
+ if (BV_ISSET(fields, 82)) {
{
int readin;
@@ -3893,7 +3885,7 @@
real_packet->tech_cost_style = readin;
}
}
- if (BV_ISSET(fields, 84)) {
+ if (BV_ISSET(fields, 83)) {
{
int readin;
@@ -3901,7 +3893,7 @@
real_packet->tech_leakage = readin;
}
}
- if (BV_ISSET(fields, 85)) {
+ if (BV_ISSET(fields, 84)) {
{
int readin;
@@ -3909,8 +3901,8 @@
real_packet->tech_cost_double_year = readin;
}
}
- real_packet->killstack = BV_ISSET(fields, 86);
- if (BV_ISSET(fields, 87)) {
+ real_packet->killstack = BV_ISSET(fields, 85);
+ if (BV_ISSET(fields, 86)) {
{
int readin;
@@ -3918,7 +3910,7 @@
real_packet->autoupgrade_veteran_loss = readin;
}
}
- if (BV_ISSET(fields, 88)) {
+ if (BV_ISSET(fields, 87)) {
{
int readin;
@@ -3926,7 +3918,7 @@
real_packet->incite_improvement_factor = readin;
}
}
- if (BV_ISSET(fields, 89)) {
+ if (BV_ISSET(fields, 88)) {
{
int readin;
@@ -3934,7 +3926,7 @@
real_packet->incite_unit_factor = readin;
}
}
- if (BV_ISSET(fields, 90)) {
+ if (BV_ISSET(fields, 89)) {
{
int readin;
@@ -3942,7 +3934,7 @@
real_packet->incite_total_factor = readin;
}
}
- if (BV_ISSET(fields, 91)) {
+ if (BV_ISSET(fields, 90)) {
{
int readin;
@@ -3950,7 +3942,7 @@
real_packet->government_when_anarchy_id = readin;
}
}
- if (BV_ISSET(fields, 92)) {
+ if (BV_ISSET(fields, 91)) {
{
int readin;
@@ -3958,7 +3950,7 @@
real_packet->revolution_length = readin;
}
}
- if (BV_ISSET(fields, 93)) {
+ if (BV_ISSET(fields, 92)) {
{
int readin;
@@ -3966,7 +3958,7 @@
real_packet->base_pollution = readin;
}
}
- if (BV_ISSET(fields, 94)) {
+ if (BV_ISSET(fields, 93)) {
{
int readin;
@@ -3974,7 +3966,7 @@
real_packet->happy_cost = readin;
}
}
- if (BV_ISSET(fields, 95)) {
+ if (BV_ISSET(fields, 94)) {
{
int readin;
@@ -3982,7 +3974,7 @@
real_packet->food_cost = readin;
}
}
- if (BV_ISSET(fields, 96)) {
+ if (BV_ISSET(fields, 95)) {
{
int readin;
@@ -3990,7 +3982,7 @@
real_packet->base_bribe_cost = readin;
}
}
- if (BV_ISSET(fields, 97)) {
+ if (BV_ISSET(fields, 96)) {
{
int readin;
@@ -3998,7 +3990,7 @@
real_packet->base_incite_cost = readin;
}
}
- if (BV_ISSET(fields, 98)) {
+ if (BV_ISSET(fields, 97)) {
{
int readin;
@@ -4006,7 +3998,7 @@
real_packet->base_tech_cost = readin;
}
}
- if (BV_ISSET(fields, 99)) {
+ if (BV_ISSET(fields, 98)) {
{
int readin;
@@ -4014,7 +4006,7 @@
real_packet->ransom_gold = readin;
}
}
- if (BV_ISSET(fields, 100)) {
+ if (BV_ISSET(fields, 99)) {
{
int readin;
@@ -4022,7 +4014,7 @@
real_packet->save_nturns = readin;
}
}
- if (BV_ISSET(fields, 101)) {
+ if (BV_ISSET(fields, 100)) {
{
int readin;
@@ -4030,10 +4022,10 @@
real_packet->save_compress_level = readin;
}
}
- if (BV_ISSET(fields, 102)) {
+ if (BV_ISSET(fields, 101)) {
dio_get_string(&din, real_packet->start_units,
sizeof(real_packet->start_units));
}
- if (BV_ISSET(fields, 103)) {
+ if (BV_ISSET(fields, 102)) {
{
int readin;
@@ -4041,7 +4033,7 @@
real_packet->num_teams = readin;
}
}
- if (BV_ISSET(fields, 104)) {
+ if (BV_ISSET(fields, 103)) {
{
int i;
@@ -4055,7 +4047,7 @@
}
}
}
- if (BV_ISSET(fields, 105)) {
+ if (BV_ISSET(fields, 104)) {
for (;;) {
int i;
@@ -4071,7 +4063,7 @@
}
}
}
- if (BV_ISSET(fields, 106)) {
+ if (BV_ISSET(fields, 105)) {
for (;;) {
int i;
@@ -4390,37 +4382,33 @@
if(differ) {different++;}
if(differ) {BV_SET(fields, 65);}
- differ = (old->watchtower_extra_vision !=
real_packet->watchtower_extra_vision);
+ differ = (old->allowed_city_names != real_packet->allowed_city_names);
if(differ) {different++;}
if(differ) {BV_SET(fields, 66);}
- differ = (old->allowed_city_names != real_packet->allowed_city_names);
+ differ = (old->palace_building != real_packet->palace_building);
if(differ) {different++;}
if(differ) {BV_SET(fields, 67);}
- differ = (old->palace_building != real_packet->palace_building);
+ differ = (old->land_defend_building != real_packet->land_defend_building);
if(differ) {different++;}
if(differ) {BV_SET(fields, 68);}
- differ = (old->land_defend_building != real_packet->land_defend_building);
- if(differ) {different++;}
- if(differ) {BV_SET(fields, 69);}
-
differ = (old->changable_tax != real_packet->changable_tax);
if(differ) {different++;}
- if(packet->changable_tax) {BV_SET(fields, 70);}
+ if(packet->changable_tax) {BV_SET(fields, 69);}
differ = (old->forced_science != real_packet->forced_science);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 71);}
+ if(differ) {BV_SET(fields, 70);}
differ = (old->forced_luxury != real_packet->forced_luxury);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 72);}
+ if(differ) {BV_SET(fields, 71);}
differ = (old->forced_gold != real_packet->forced_gold);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 73);}
+ if(differ) {BV_SET(fields, 72);}
{
@@ -4436,27 +4424,27 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 74);}
+ if(differ) {BV_SET(fields, 73);}
differ = (old->min_dist_bw_cities != real_packet->min_dist_bw_cities);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 75);}
+ if(differ) {BV_SET(fields, 74);}
differ = (old->init_vis_radius_sq != real_packet->init_vis_radius_sq);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 76);}
+ if(differ) {BV_SET(fields, 75);}
differ = (old->hut_overflight != real_packet->hut_overflight);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 77);}
+ if(differ) {BV_SET(fields, 76);}
differ = (old->pillage_select != real_packet->pillage_select);
if(differ) {different++;}
- if(packet->pillage_select) {BV_SET(fields, 78);}
+ if(packet->pillage_select) {BV_SET(fields, 77);}
differ = (old->nuke_contamination != real_packet->nuke_contamination);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 79);}
+ if(differ) {BV_SET(fields, 78);}
{
@@ -4472,99 +4460,99 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 80);}
+ if(differ) {BV_SET(fields, 79);}
differ = (old->granary_num_inis != real_packet->granary_num_inis);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 81);}
+ if(differ) {BV_SET(fields, 80);}
differ = (old->granary_food_inc != real_packet->granary_food_inc);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 82);}
+ if(differ) {BV_SET(fields, 81);}
differ = (old->tech_cost_style != real_packet->tech_cost_style);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 83);}
+ if(differ) {BV_SET(fields, 82);}
differ = (old->tech_leakage != real_packet->tech_leakage);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 84);}
+ if(differ) {BV_SET(fields, 83);}
differ = (old->tech_cost_double_year != real_packet->tech_cost_double_year);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 85);}
+ if(differ) {BV_SET(fields, 84);}
differ = (old->killstack != real_packet->killstack);
if(differ) {different++;}
- if(packet->killstack) {BV_SET(fields, 86);}
+ if(packet->killstack) {BV_SET(fields, 85);}
differ = (old->autoupgrade_veteran_loss !=
real_packet->autoupgrade_veteran_loss);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 87);}
+ if(differ) {BV_SET(fields, 86);}
differ = (old->incite_improvement_factor !=
real_packet->incite_improvement_factor);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 88);}
+ if(differ) {BV_SET(fields, 87);}
differ = (old->incite_unit_factor != real_packet->incite_unit_factor);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 89);}
+ if(differ) {BV_SET(fields, 88);}
differ = (old->incite_total_factor != real_packet->incite_total_factor);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 90);}
+ if(differ) {BV_SET(fields, 89);}
differ = (old->government_when_anarchy_id !=
real_packet->government_when_anarchy_id);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 91);}
+ if(differ) {BV_SET(fields, 90);}
differ = (old->revolution_length != real_packet->revolution_length);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 92);}
+ if(differ) {BV_SET(fields, 91);}
differ = (old->base_pollution != real_packet->base_pollution);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 93);}
+ if(differ) {BV_SET(fields, 92);}
differ = (old->happy_cost != real_packet->happy_cost);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 94);}
+ if(differ) {BV_SET(fields, 93);}
differ = (old->food_cost != real_packet->food_cost);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 95);}
+ if(differ) {BV_SET(fields, 94);}
differ = (old->base_bribe_cost != real_packet->base_bribe_cost);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 96);}
+ if(differ) {BV_SET(fields, 95);}
differ = (old->base_incite_cost != real_packet->base_incite_cost);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 97);}
+ if(differ) {BV_SET(fields, 96);}
differ = (old->base_tech_cost != real_packet->base_tech_cost);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 98);}
+ if(differ) {BV_SET(fields, 97);}
differ = (old->ransom_gold != real_packet->ransom_gold);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 99);}
+ if(differ) {BV_SET(fields, 98);}
differ = (old->save_nturns != real_packet->save_nturns);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 100);}
+ if(differ) {BV_SET(fields, 99);}
differ = (old->save_compress_level != real_packet->save_compress_level);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 101);}
+ if(differ) {BV_SET(fields, 100);}
differ = (strcmp(old->start_units, real_packet->start_units) != 0);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 102);}
+ if(differ) {BV_SET(fields, 101);}
differ = (old->num_teams != real_packet->num_teams);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 103);}
+ if(differ) {BV_SET(fields, 102);}
{
@@ -4580,7 +4568,7 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 104);}
+ if(differ) {BV_SET(fields, 103);}
{
@@ -4596,7 +4584,7 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 105);}
+ if(differ) {BV_SET(fields, 104);}
{
@@ -4612,7 +4600,7 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 106);}
+ if(differ) {BV_SET(fields, 105);}
if (different == 0 && !force_send_of_unchanged) {
return 0;
@@ -4795,28 +4783,25 @@
dio_put_uint8(&dout, real_packet->fulltradesize);
}
if (BV_ISSET(fields, 66)) {
- dio_put_uint8(&dout, real_packet->watchtower_extra_vision);
+ dio_put_uint8(&dout, real_packet->allowed_city_names);
}
if (BV_ISSET(fields, 67)) {
- dio_put_uint8(&dout, real_packet->allowed_city_names);
+ dio_put_uint8(&dout, real_packet->palace_building);
}
if (BV_ISSET(fields, 68)) {
- dio_put_uint8(&dout, real_packet->palace_building);
- }
- if (BV_ISSET(fields, 69)) {
dio_put_uint8(&dout, real_packet->land_defend_building);
}
- /* field 70 is folded into the header */
- if (BV_ISSET(fields, 71)) {
+ /* field 69 is folded into the header */
+ if (BV_ISSET(fields, 70)) {
dio_put_uint8(&dout, real_packet->forced_science);
}
- if (BV_ISSET(fields, 72)) {
+ if (BV_ISSET(fields, 71)) {
dio_put_uint8(&dout, real_packet->forced_luxury);
}
- if (BV_ISSET(fields, 73)) {
+ if (BV_ISSET(fields, 72)) {
dio_put_uint8(&dout, real_packet->forced_gold);
}
- if (BV_ISSET(fields, 74)) {
+ if (BV_ISSET(fields, 73)) {
{
int i;
@@ -4826,20 +4811,20 @@
}
}
}
- if (BV_ISSET(fields, 75)) {
+ if (BV_ISSET(fields, 74)) {
dio_put_uint8(&dout, real_packet->min_dist_bw_cities);
}
- if (BV_ISSET(fields, 76)) {
+ if (BV_ISSET(fields, 75)) {
dio_put_uint8(&dout, real_packet->init_vis_radius_sq);
}
- if (BV_ISSET(fields, 77)) {
+ if (BV_ISSET(fields, 76)) {
dio_put_uint8(&dout, real_packet->hut_overflight);
}
- /* field 78 is folded into the header */
- if (BV_ISSET(fields, 79)) {
+ /* field 77 is folded into the header */
+ if (BV_ISSET(fields, 78)) {
dio_put_uint8(&dout, real_packet->nuke_contamination);
}
- if (BV_ISSET(fields, 80)) {
+ if (BV_ISSET(fields, 79)) {
{
int i;
@@ -4849,74 +4834,74 @@
}
}
}
- if (BV_ISSET(fields, 81)) {
+ if (BV_ISSET(fields, 80)) {
dio_put_uint8(&dout, real_packet->granary_num_inis);
}
- if (BV_ISSET(fields, 82)) {
+ if (BV_ISSET(fields, 81)) {
dio_put_uint8(&dout, real_packet->granary_food_inc);
}
- if (BV_ISSET(fields, 83)) {
+ if (BV_ISSET(fields, 82)) {
dio_put_uint8(&dout, real_packet->tech_cost_style);
}
- if (BV_ISSET(fields, 84)) {
+ if (BV_ISSET(fields, 83)) {
dio_put_uint8(&dout, real_packet->tech_leakage);
}
- if (BV_ISSET(fields, 85)) {
+ if (BV_ISSET(fields, 84)) {
dio_put_sint16(&dout, real_packet->tech_cost_double_year);
}
- /* field 86 is folded into the header */
- if (BV_ISSET(fields, 87)) {
+ /* field 85 is folded into the header */
+ if (BV_ISSET(fields, 86)) {
dio_put_uint8(&dout, real_packet->autoupgrade_veteran_loss);
}
- if (BV_ISSET(fields, 88)) {
+ if (BV_ISSET(fields, 87)) {
dio_put_uint16(&dout, real_packet->incite_improvement_factor);
}
- if (BV_ISSET(fields, 89)) {
+ if (BV_ISSET(fields, 88)) {
dio_put_uint16(&dout, real_packet->incite_unit_factor);
}
- if (BV_ISSET(fields, 90)) {
+ if (BV_ISSET(fields, 89)) {
dio_put_uint16(&dout, real_packet->incite_total_factor);
}
- if (BV_ISSET(fields, 91)) {
+ if (BV_ISSET(fields, 90)) {
dio_put_uint8(&dout, real_packet->government_when_anarchy_id);
}
- if (BV_ISSET(fields, 92)) {
+ if (BV_ISSET(fields, 91)) {
dio_put_uint8(&dout, real_packet->revolution_length);
}
- if (BV_ISSET(fields, 93)) {
+ if (BV_ISSET(fields, 92)) {
dio_put_sint16(&dout, real_packet->base_pollution);
}
- if (BV_ISSET(fields, 94)) {
+ if (BV_ISSET(fields, 93)) {
dio_put_uint8(&dout, real_packet->happy_cost);
}
- if (BV_ISSET(fields, 95)) {
+ if (BV_ISSET(fields, 94)) {
dio_put_uint8(&dout, real_packet->food_cost);
}
- if (BV_ISSET(fields, 96)) {
+ if (BV_ISSET(fields, 95)) {
dio_put_uint16(&dout, real_packet->base_bribe_cost);
}
- if (BV_ISSET(fields, 97)) {
+ if (BV_ISSET(fields, 96)) {
dio_put_uint16(&dout, real_packet->base_incite_cost);
}
- if (BV_ISSET(fields, 98)) {
+ if (BV_ISSET(fields, 97)) {
dio_put_uint8(&dout, real_packet->base_tech_cost);
}
- if (BV_ISSET(fields, 99)) {
+ if (BV_ISSET(fields, 98)) {
dio_put_uint16(&dout, real_packet->ransom_gold);
}
- if (BV_ISSET(fields, 100)) {
+ if (BV_ISSET(fields, 99)) {
dio_put_uint8(&dout, real_packet->save_nturns);
}
- if (BV_ISSET(fields, 101)) {
+ if (BV_ISSET(fields, 100)) {
dio_put_uint8(&dout, real_packet->save_compress_level);
}
- if (BV_ISSET(fields, 102)) {
+ if (BV_ISSET(fields, 101)) {
dio_put_string(&dout, real_packet->start_units);
}
- if (BV_ISSET(fields, 103)) {
+ if (BV_ISSET(fields, 102)) {
dio_put_uint8(&dout, real_packet->num_teams);
}
- if (BV_ISSET(fields, 104)) {
+ if (BV_ISSET(fields, 103)) {
{
int i;
@@ -4926,7 +4911,7 @@
}
}
}
- if (BV_ISSET(fields, 105)) {
+ if (BV_ISSET(fields, 104)) {
{
int i;
@@ -4942,7 +4927,7 @@
dio_put_uint8(&dout, 255);
}
}
- if (BV_ISSET(fields, 106)) {
+ if (BV_ISSET(fields, 105)) {
{
int i;
@@ -21532,8 +21517,8 @@
{
int readin;
- dio_get_uint8(&din, &readin);
- real_packet->vision_range = readin;
+ dio_get_uint16(&din, &readin);
+ real_packet->vision_radius_sq = readin;
}
}
if (BV_ISSET(fields, 19)) {
@@ -21784,7 +21769,7 @@
if(differ) {different++;}
if(differ) {BV_SET(fields, 17);}
- differ = (old->vision_range != real_packet->vision_range);
+ differ = (old->vision_radius_sq != real_packet->vision_radius_sq);
if(differ) {different++;}
if(differ) {BV_SET(fields, 18);}
@@ -21965,7 +21950,7 @@
dio_put_uint8(&dout, real_packet->gov_requirement);
}
if (BV_ISSET(fields, 18)) {
- dio_put_uint8(&dout, real_packet->vision_range);
+ dio_put_uint16(&dout, real_packet->vision_radius_sq);
}
if (BV_ISSET(fields, 19)) {
dio_put_uint8(&dout, real_packet->transport_capacity);
@@ -23929,7 +23914,7 @@
#define cmp_packet_ruleset_terrain_control_100 cmp_const
-BV_DEFINE(packet_ruleset_terrain_control_100_fields, 15);
+BV_DEFINE(packet_ruleset_terrain_control_100_fields, 16);
static struct packet_ruleset_terrain_control
*receive_packet_ruleset_terrain_control_100(struct connection *pc, enum
packet_type type)
{
@@ -24061,6 +24046,14 @@
}
}
}
+ if (BV_ISSET(fields, 15)) {
+ {
+ int readin;
+
+ dio_get_uint16(&din, &readin);
+ real_packet->watchtower_extra_vision_radius_sq = readin;
+ }
+ }
clone = fc_malloc(sizeof(*clone));
*clone = *real_packet;
@@ -24191,6 +24184,10 @@
if(differ) {different++;}
if(differ) {BV_SET(fields, 14);}
+ differ = (old->watchtower_extra_vision_radius_sq !=
real_packet->watchtower_extra_vision_radius_sq);
+ if(differ) {different++;}
+ if(differ) {BV_SET(fields, 15);}
+
if (different == 0 && !force_send_of_unchanged) {
return 0;
}
@@ -24255,6 +24252,9 @@
}
}
}
+ if (BV_ISSET(fields, 15)) {
+ dio_put_uint16(&dout, real_packet->watchtower_extra_vision_radius_sq);
+ }
if (old_from_hash) {
Index: common/packets_gen.h
===================================================================
--- common/packets_gen.h (revision 11111)
+++ common/packets_gen.h (working copy)
@@ -165,7 +165,6 @@
int add_to_size_limit;
int notradesize;
int fulltradesize;
- int watchtower_extra_vision;
int allowed_city_names;
Impr_type_id palace_building;
Impr_type_id land_defend_building;
@@ -774,7 +773,7 @@
int tech_requirement;
int impr_requirement;
int gov_requirement;
- int vision_range;
+ int vision_radius_sq;
int transport_capacity;
int hp;
int firepower;
@@ -871,6 +870,7 @@
int rail_tile_bonus[O_MAX];
int pollution_tile_penalty[O_MAX];
int fallout_tile_penalty[O_MAX];
+ int watchtower_extra_vision_radius_sq;
};
struct packet_ruleset_nation {
Index: common/game.c
===================================================================
--- common/game.c (revision 11111)
+++ common/game.c (working copy)
@@ -232,7 +232,6 @@
game.info.revolution_length = GAME_DEFAULT_REVOLUTION_LENGTH;
game.info.heating = 0;
game.info.cooling = 0;
- game.info.watchtower_extra_vision = GAME_DEFAULT_WATCHTOWER_EXTRA_VISION;
game.info.allowed_city_names = GAME_DEFAULT_ALLOWED_CITY_NAMES;
game.info.save_nturns = GAME_DEFAULT_SAVETURNS;
#ifdef HAVE_LIBZ
Index: common/game.h
===================================================================
--- common/game.h (revision 11111)
+++ common/game.h (working copy)
@@ -352,10 +352,6 @@
#define GAME_MAX_COMPRESS_LEVEL 9
#define GAME_NO_COMPRESS_LEVEL 0
-#define GAME_DEFAULT_WATCHTOWER_EXTRA_VISION 2
-#define GAME_MIN_WATCHTOWER_EXTRA_VISION 0
-#define GAME_MAX_WATCHTOWER_EXTRA_VISION 4
-
#define GAME_DEFAULT_ALLOWED_CITY_NAMES 1
#define GAME_MIN_ALLOWED_CITY_NAMES 0
#define GAME_MAX_ALLOWED_CITY_NAMES 3
Index: ai/aiexplorer.c
===================================================================
--- ai/aiexplorer.c (revision 11111)
+++ ai/aiexplorer.c (working copy)
@@ -154,7 +154,7 @@
struct unit *punit)
{
int land_score, ocean_score, known_land_score, known_ocean_score;
- int range = unit_type(punit)->vision_range;
+ int radius_sq = punit->type->vision_radius_sq;
int desirable = 0;
int unknown = 0;
@@ -184,7 +184,7 @@
known_ocean_score = KNOWN_SAME_TER_SCORE;
}
- square_iterate(ptile, range, ptile1) {
+ circle_iterate(ptile, radius_sq, ptile1) {
int ocean = likely_ocean(ptile1, pplayer);
if (!map_is_known(ptile1, pplayer)) {
@@ -207,7 +207,7 @@
+ (100 - ocean) * known_land_score);
}
}
- } square_iterate_end;
+ } circle_iterate_end;
if (unknown <= 0) {
/* We make sure we'll uncover at least one unexplored tile. */
Index: client/gui-gtk-2.0/helpdlg.c
===================================================================
--- client/gui-gtk-2.0/helpdlg.c (revision 11111)
+++ client/gui-gtk-2.0/helpdlg.c (working copy)
@@ -803,7 +803,7 @@
gtk_label_set_text(GTK_LABEL(help_ulabel[2][4]), buf);
gtk_label_set_text(GTK_LABEL(help_ulabel[3][1]),
helptext_unit_upkeep_str(utype));
- sprintf(buf, "%d", utype->vision_range);
+ sprintf(buf, "%d", (int)sqrt((double)utype->vision_radius_sq));
gtk_label_set_text(GTK_LABEL(help_ulabel[3][4]), buf);
if(utype->tech_requirement==A_LAST) {
gtk_label_set_text(GTK_LABEL(help_ulabel[4][1]), REQ_NEVER);
Index: client/packhand.c
===================================================================
--- client/packhand.c (revision 11111)
+++ client/packhand.c (working copy)
@@ -2083,7 +2083,7 @@
u->tech_requirement = p->tech_requirement;
u->impr_requirement = p->impr_requirement;
u->gov_requirement = get_government(p->gov_requirement);
- u->vision_range = p->vision_range;
+ u->vision_radius_sq = p->vision_radius_sq;
u->transport_capacity = p->transport_capacity;
u->hp = p->hp;
u->firepower = p->firepower;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#14294) circular vision for units,
Jason Short <=
|
|