| [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]
 
 
<URL: http://rt.freeciv.org/Ticket/Display.html?id=23 >
> [schaefer@xxxxxx - Tue Jun 08 15:48:24 1999]:
> A unit is low on fuel indicator would be cool.
> This should probably be triggered when moves left<=2.
> A "return to next city command 'H'" should be added.
Here's an updated patch.
Fixed: multiply by SINGLE_MOVE.
Added: a "tired" graphic for units with less than one move left.  Useful
to avoid attacking with them by mistake.
jason
 Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.177
diff -u -r1.177 tilespec.c
--- client/tilespec.c   25 Jun 2004 23:35:55 -0000      1.177
+++ client/tilespec.c   27 Jun 2004 06:16:55 -0000
@@ -1128,6 +1128,8 @@
   SET_SPRITE(unit.transform,    "unit.transform");
   SET_SPRITE(unit.connect,      "unit.connect");
   SET_SPRITE(unit.patrol,       "unit.patrol");
+  SET_SPRITE(unit.lowfuel, "unit.lowfuel");
+  SET_SPRITE(unit.tired, "unit.tired");
 
   for(i=0; i<NUM_TILES_HP_BAR; i++) {
     my_snprintf(buffer, sizeof(buffer), "unit.hp_%d", i*10);
@@ -1687,6 +1689,20 @@
     }
   }
 
+  if (sprites.unit.lowfuel
+      && unit_type(punit)->fuel > 0
+      && punit->fuel == 1
+      && punit->moves_left <= 2 * SINGLE_MOVE) {
+    /* Show a low-fuel graphic if the plane has 2 or fewer moves left. */
+    ADD_SPRITE_FULL(sprites.unit.lowfuel);
+  }
+  if (sprites.unit.tired
+      && punit->moves_left < SINGLE_MOVE) {
+    /* Show a "tired" graphic if the unit has fewer than one move
+     * remaining. */
+    ADD_SPRITE_FULL(sprites.unit.tired);
+  }
+
   if (stack || punit->occupy) {
     ADD_SPRITE_FULL(sprites.unit.stack);
   } else {
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.71
diff -u -r1.71 tilespec.h
--- client/tilespec.h   21 Jun 2004 15:14:43 -0000      1.71
+++ client/tilespec.h   27 Jun 2004 06:16:55 -0000
@@ -206,7 +206,9 @@
       *stack,
       *transform,
       *connect,
-      *patrol;
+      *patrol,
+      *lowfuel,
+      *tired;
   } unit;
   struct {
     struct Sprite
 
| [Prev in Thread] | Current Thread | [Next in Thread] |  
[Freeciv-Dev] (PR#23) Wishlist: low fuel indicator for air units,
Jason Short <=
 
 |  |