Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2002:
[Freeciv-Dev] Re: attacking transport (PR#2025)
Home

[Freeciv-Dev] Re: attacking transport (PR#2025)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Cc: Freeciv Development List <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: attacking transport (PR#2025)
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 22 Sep 2002 21:07:56 +0000 (GMT)

On Sun, 22 Sep 2002, Gregory Berkolaiko wrote:
> Attached is a patch which prohibits units with attack strength of 0 to
> attack anything.There will be generic message
>       Game: You can't attack there.
> printed if a player attempts such an attack.

Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.181
diff -u -r1.181 unittools.c
--- server/unittools.c  2002/08/31 02:24:34     1.181
+++ server/unittools.c  2002/09/22 17:50:37
@@ -159,6 +159,12 @@
 bool can_unit_attack_tile(struct unit *punit, int dest_x, int dest_y)
 {
   struct unit *pdefender;
+
+  if (unit_type(punit)->attack_strength == 0) {
+    /* This unit can't attack anything */
+    return FALSE;
+  }
+
   pdefender=get_defender(punit, dest_x, dest_y);
   if (!pdefender) {
     struct city *pcity = map_get_city(dest_x, dest_y);

This should be in can_unit_attack_unit_at_tile(), not here.

Yours
Per

"I don't see why people are so upset about cloning sheep. American
television networks have been doing that to their audiences for years."
-- Jello Biafra



[Prev in Thread] Current Thread [Next in Thread]