[Freeciv-Dev] Re: bugfix for can_unit_attack_tile()
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, 13 Aug 2002, Per I. Mathisen wrote:
> +if (!pfedender) {
> + /* nothing to attack */
> + return FALSE;
> +}
Ah, that is very wrong. It could be a city. Let me try that again:
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.178
diff -u -r1.178 unittools.c
--- server/unittools.c 2002/06/01 19:25:26 1.178
+++ server/unittools.c 2002/08/13 15:12:35
@@ -160,6 +160,15 @@
{
struct unit *pdefender;
pdefender=get_defender(punit, dest_x, dest_y);
+ if (!pdefender) {
+ struct city *pcity = map_get_city(dest_x, dest_y);
+ if (pcity && pplayers_at_war(city_owner(pcity), unit_owner(punit))) {
+ /* empty city, yummy! */
+ return TRUE;
+ }
+ /* nothing to attack */
+ return FALSE;
+ }
return(can_unit_attack_unit_at_tile(punit, pdefender, dest_x, dest_y));
}
Looks ok now?
Yours
Per
|
|