Complete.Org: Mailing Lists: Archives: freeciv-dev: March 1999:
Re: [Freeciv-Dev] Problem with Helicopters
Home

Re: [Freeciv-Dev] Problem with Helicopters

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] Problem with Helicopters
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Tue, 2 Mar 1999 21:48:32 +1100

David Pfitzner wrote:
> 
> Actually, I think helicopters with zero hp should run out
> of fuel and die? 

Assuming thats the correct thing to do, I propose this patch.
Though I'm not sure if "running out of fuel" is the correct
message?

-- David
diff -u -r --exclude-from exclude freeciv-cvs/server/unitfunc.c 
freeciv-mod/server/unitfunc.c
--- freeciv-cvs/server/unitfunc.c       Sat Feb 27 18:09:38 1999
+++ freeciv-mod/server/unitfunc.c       Tue Mar  2 21:42:56 1999
@@ -764,8 +764,18 @@
   unit_list_iterate(pplayer->units, punit) {
     unit_restore_hitpoints(pplayer, punit);
     unit_restore_movepoints(pplayer, punit);
-    
-    if(is_air_unit(punit)) {
+
+    if(is_heli_unit(punit) && punit->hp<=0) {
+      send_remove_unit(0, punit->id);
+      notify_player_ex(pplayer, punit->x, punit->y, E_UNIT_LOST, 
+                      "Game: Your %s has run out of fuel",
+                      unit_name(punit->type));
+      gamelog(GAMELOG_UNITF, "%s lose a %s (fuel)", 
+             get_race_name_plural(pplayer->race),
+             unit_name(punit->type));
+      wipe_unit(0, punit);
+    }
+    else if(is_air_unit(punit)) {
       punit->fuel--;
       if(map_get_city(punit->x, punit->y))
        punit->fuel=get_unit_type(punit->type)->fuel;

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