]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/ammo.qc
Migrating resources (ammo, health etc) to a registry for ease of maintenance and...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / ammo.qc
index b4a7b6040a92cd5f980253d8a4f51858c5df2662..0cc1f23956aa417f554c186183ff2f0438d6f53d 100644 (file)
@@ -4,6 +4,7 @@
 #include <client/items/items.qh>
 #include <client/view.qh>
 #include <common/mutators/mutator/nades/nades.qh>
+#include <common/resources/resources.qh>
 #include <common/wepent.qh>
 
 // Ammo (#1)
@@ -31,7 +32,7 @@ void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector col
                autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
 }
 
-void DrawAmmoItem(vector myPos, vector mySize, int ammoType, bool isCurrent, bool isInfinite)
+void DrawAmmoItem(vector myPos, vector mySize, Resource ammoType, bool isCurrent, bool isInfinite)
 {
        TC(bool, isCurrent); TC(bool, isInfinite);
        if(ammoType == RES_NONE)
@@ -216,11 +217,12 @@ void HUD_Ammo()
        }
        else
        {
-               int ammotype;
                row = column = 0;
-               for(i = 0; i < AMMO_COUNT; ++i)
+               // disabling new-style loop for now to restore original order of ammo types
+               //FOREACH(Resources, it.instanceOfAmmoResource && !it.m_hidden,
+               for(int j = 0; j < AMMO_COUNT; ++j)
                {
-                       ammotype = GetAmmoTypeFromNum(i);
+                       Resource ammotype = GetAmmoTypeFromNum(j);
                        DrawAmmoItem(
                                pos + vec2(column * (ammo_size.x + offset.x), row * (ammo_size.y + offset.y)),
                                ammo_size,