diff --git a/src/editor/editloop.cpp b/src/editor/editloop.cpp
index 970675572..2998b43ba 100644
--- a/src/editor/editloop.cpp
+++ b/src/editor/editloop.cpp
@@ -382,10 +382,7 @@ local void DrawTileIcons(void)
 */
 local void DrawUnitIcons(void)
 {
-    int x;
-    int y;
-    int i;
-    int j;
+    int x, y, i, j, percent;
     char buf[256];
     Icon *icon;
 
@@ -547,7 +544,9 @@ local void DrawUnitIcons(void)
     } else {
 	VideoDraw(MenuButtonGfx.Sprite, MBUTTON_RIGHT_ARROW, x + j - 20, y);
     }
-    i = (50 * (j - 54)) / 100;
+
+    percent = UnitIndex * 100 / MaxUnitIndex;
+    i = (percent * (j - 54)) / 100;
     VideoDraw(MenuButtonGfx.Sprite, MBUTTON_S_KNOB, x + 18 + i, y + 1);
 
     //