Complete.Org: Mailing Lists: Archives: freeciv-dev: April 1999:
[Freeciv-Dev] Patch: prevent futile attacks
Home

[Freeciv-Dev] Patch: prevent futile attacks

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Patch: prevent futile attacks
From: Patrick Smith <patsmith@xxxxxxxxx>
Date: Fri, 02 Apr 1999 20:45:49 +0000

Here is a patch to prevent units with attack strength 0 from attacking.
The message produced is, e.g., "A Galleon cannot attack other units."

This check is done after all the other checks, so it only catches the
cases that weren't already prevented.

The patch is based on the March 29 CVS snapshot.
-- 
patsmith@xxxxxxxxx
*** unithand.c.orig     Fri Apr  2 14:48:31 1999
--- unithand.c  Fri Apr  2 15:00:26 1999
***************
*** 800,805 ****
--- 800,813 ----
                 unit_name(passenger->type), passenger->id);
            }
          }
+         if (get_unit_type(punit->type)->attack_strength == 0) {
+           char message[MAX_LENGTH_NAME + 64];
+           sprintf(message, "Game: A %s cannot attack other units.",
+                            unit_name(punit->type));
+           notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+                            message);
+           return 0;
+         }
        handle_unit_attack_request(pplayer, punit, pdefender);
          return 1;
        };

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Patch: prevent futile attacks, Patrick Smith <=