[Freeciv-Dev] (PR#12618) [Bugfix] FoW & Watchtowers
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12618 >
There might be allied units in the stack...
Untested
- ML
diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c
--- freeciv/server/citytools.c 2005-03-24 22:44:10.062500000 +0200
+++ freeciv/server/citytools.c 2005-03-24 21:40:42.984375000 +0200
@@ -979,12 +979,14 @@
auto_arrange_workers(pcity);
/* Put vision back to normal, if fortress acted as a watchtower */
- if (player_knows_techs_with_flag(pplayer, TF_WATCHTOWER)
- && map_has_special(ptile, S_FORTRESS)) {
+ if(map_has_special(ptile, S_FORTRESS)) {
unit_list_iterate((ptile)->units, punit) {
- unfog_area(pplayer, punit->tile,
- unit_type(punit)->vision_range);
- fog_area(pplayer, punit->tile, get_watchtower_vision(punit));
+ 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));
+ }
}
unit_list_iterate_end;
}
diff -Nurd -X.diff_ignore freeciv/server/unittools.c freeciv/server/unittools.c
--- freeciv/server/unittools.c 2005-03-24 22:44:14.750000000 +0200
+++ freeciv/server/unittools.c 2005-03-24 23:00:49.812500000 +0200
@@ -646,13 +646,13 @@
}
/* If a watchtower has been pillaged, reduce sight to normal */
- if (what == S_FORTRESS
- && player_knows_techs_with_flag(pplayer, TF_WATCHTOWER)) {
+ if (what == S_FORTRESS) {
freelog(LOG_VERBOSE, "Watchtower pillaged!");
- unit_list_iterate(punit->tile->units,
- punit2) {
- if (is_ground_unit(punit2)) {
- change_vision_range(pplayer, punit2->tile,
get_watchtower_vision(punit2),
+ unit_list_iterate(punit->tile->units, punit2) {
+ struct player *owner = unit_owner(punit2);
+ 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);
}
}
@@ -675,18 +675,19 @@
update_tile_knowledge(punit->tile);
/* If a watchtower has been pillaged, reduce sight to normal */
- if (what_pillaged == S_FORTRESS
- && player_knows_techs_with_flag(pplayer, TF_WATCHTOWER)) {
+ if (what_pillaged == S_FORTRESS) {
freelog(LOG_VERBOSE, "Watchtower(2) pillaged!");
unit_list_iterate(punit->tile->units, punit2) {
- if (is_ground_unit(punit2)) {
- change_vision_range(pplayer, punit->tile,
get_watchtower_vision(punit2),
+ struct player *owner = unit_owner(punit2);
+ if (is_ground_unit(punit2)
+ && player_knows_techs_with_flag(owner, TF_WATCHTOWER)) {
+ change_vision_range(owner, punit->tile,
get_watchtower_vision(punit2),
unit_type(punit2)->vision_range);
}
}
unit_list_iterate_end;
}
- }
+ }
}
if (activity==ACTIVITY_POLLUTION) {
@@ -711,15 +712,15 @@
map_set_special(punit->tile, S_FORTRESS);
unit_activity_done = TRUE;
/* watchtower becomes effective */
- if (player_knows_techs_with_flag(pplayer, TF_WATCHTOWER)) {
- unit_list_iterate(ptile->units, punit) {
- if (is_ground_unit(punit)) {
- change_vision_range(pplayer, punit->tile,
unit_type(punit)->vision_range,
- get_watchtower_vision(punit));
- }
- }
- unit_list_iterate_end;
+ unit_list_iterate(ptile->units, punit) {
+ struct player *owner = unit_owner(punit);
+ if (is_ground_unit(punit)
+ && player_knows_techs_with_flag(owner, TF_WATCHTOWER)) {
+ change_vision_range(pplayer, punit->tile,
unit_type(punit)->vision_range,
+ get_watchtower_vision(punit));
+ }
}
+ unit_list_iterate_end;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12618) [Bugfix] FoW & Watchtowers,
Marko Lindqvist <=
|
|