[Freeciv-Dev] (PR#16711) Attack/defense chance in the unit info dialog i
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#16711) Attack/defense chance in the unit info dialog is not shown |
From: |
"Petr Baudis" <pasky@xxxxxx> |
Date: |
Thu, 27 Apr 2006 13:09:51 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=16711 >
Hi,
this fix fixes a bug introduced in 11378 when the unit attack/defence
chance relative to the currently selected unit would not be shown since
the currently selected unit variable was wrongly initialized. I've
chosen a trivial way just showing all the chances if multiple units are
selected; the player can then change the selection if some units have
interesting chances.
Signed-off-by: Petr Baudis <pasky@xxxxxx>
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time. I think
I have forgotten this before.
Index: client/text.c
===================================================================
--- client/text.c (revision 11890)
+++ client/text.c (working copy)
@@ -79,7 +79,6 @@
const char *activity_text;
struct city *pcity = ptile->city;
struct unit *punit = find_visible_unit(ptile);
- struct unit *pfocus_unit = get_focus_unit_on_tile(ptile);
const char *diplo_nation_plural_adjectives[DS_LAST] =
{Q_("?nation:Neutral"), Q_("?nation:Hostile"),
Q_("?nation:Neutral"),
@@ -182,7 +181,7 @@
}
} impr_type_iterate_end;
- if (pfocus_unit) {
+ unit_list_iterate(get_units_in_focus(), pfocus_unit) {
struct city *hcity = find_city_by_id(pfocus_unit->homecity);
if (unit_flag(pfocus_unit, F_TRADE_ROUTE)
@@ -192,7 +191,7 @@
astr_add_line(&str, _("Trade from %s: %d"),
hcity->name, trade_between_cities(hcity, pcity));
}
- }
+ } unit_list_iterate_end;
}
infra = get_tile_infrastructure_set(ptile, &infracount);
if (infracount > 0) {
@@ -242,7 +241,7 @@
}
}
- if (pfocus_unit) {
+ unit_list_iterate(get_units_in_focus(), pfocus_unit) {
int att_chance = FC_INFINITY, def_chance = FC_INFINITY;
bool found = FALSE;
@@ -264,7 +263,7 @@
astr_add_line(&str, _("Chance to win: A:%d%% D:%d%%"),
att_chance, def_chance);
}
- }
+ } unit_list_iterate_end;
/* TRANS: A is attack power, D is defense power, FP is firepower,
* HP is hitpoints (current and max). */
- [Freeciv-Dev] (PR#16711) Attack/defense chance in the unit info dialog is not shown,
Petr Baudis <=
|
|