Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] (PR#23) Wishlist: low fuel indicator for air units
Home

[Freeciv-Dev] (PR#23) Wishlist: low fuel indicator for air units

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: schaefer@xxxxxx
Subject: [Freeciv-Dev] (PR#23) Wishlist: low fuel indicator for air units
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Mar 2004 21:20:31 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=23 >

Here's a simple patch to draw a low-fuel sprite for air units.  It's not
very sophisticated, and isn't of any use unless the tileset actually has
such a sprite.

jason

? Womoks
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.152
diff -u -r1.152 tilespec.c
--- client/tilespec.c   24 Mar 2004 06:18:18 -0000      1.152
+++ client/tilespec.c   26 Mar 2004 05:18:09 -0000
@@ -981,6 +981,7 @@
   SET_SPRITE(unit.transform,    "unit.transform");
   SET_SPRITE(unit.connect,      "unit.connect");
   SET_SPRITE(unit.patrol,       "unit.patrol");
+  SET_SPRITE(unit.lowfuel, "unit.lowfuel");
 
   for(i=0; i<NUM_TILES_HP_BAR; i++) {
     my_snprintf(buffer, sizeof(buffer), "unit.hp_%d", i*10);
@@ -1597,6 +1598,15 @@
     } else {
       ADD_SPRITE_SIMPLE(sprites.unit.go_to);
     }
+  }
+
+  /* Show a low-fuel graphic if the plane has 2 or fewer moves left.  This
+   * check could be made better. */
+  if (unit_type(punit)->fuel > 0
+      && punit->fuel == 1
+      && punit->moves_left <= 2
+      && sprites.unit.lowfuel) {
+    ADD_SPRITE_SIMPLE(sprites.unit.lowfuel);
   }
 
   if (stack) {
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.57
diff -u -r1.57 tilespec.h
--- client/tilespec.h   24 Mar 2004 06:18:18 -0000      1.57
+++ client/tilespec.h   26 Mar 2004 05:18:09 -0000
@@ -178,7 +178,8 @@
       *stack,
       *transform,
       *connect,
-      *patrol;
+      *patrol,
+      *lowfuel;
   } unit;
   struct {
     struct Sprite

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