int disowned_cnt = 0;
int uninteresting_cnt = 0;
- IL_EACH(default_order_items, true, {
+ IL_EACH(Items_sorted_by_type, true, {
int q = g_inventory.inv_items[it.m_id];
//q = 1; // debug: display all items
if (is_item_filtered(it))
vector tmpos = pos;
int column = 0;
- IL_EACH(default_order_items, !is_item_filtered(it), {
+ IL_EACH(Items_sorted_by_type, !is_item_filtered(it), {
int n = g_inventory.inv_items[it.m_id];
//n = 1 + floor(i * 3 + 4.8) % 7; // debug: display a value for each item
if (n <= 0) continue;
if (!have_item_stats)
{
- IL_EACH(default_order_items, true, {
+ IL_EACH(Items_sorted_by_type, true, {
if (!is_item_filtered(it))
{
int q = g_inventory.inv_items[it.m_id];
#define REGISTER_ITEM(id, inst) REGISTER(Items, ITEM, id, m_id, inst)
#ifndef SVQC
-// Copy Items registry here before it gets sorted alphabetically by REGISTRY_SORT
-// so we can keep items sorted by categories (as they appear in the code)
-IntrusiveList default_order_items;
-STATIC_INIT(default_order_items)
+.bool instanceOfAmmo;
+.bool instanceOfHealth;
+.bool instanceOfArmor;
+.bool instanceOfPowerup;
+// Items in Items_sorted_by_type are sorted by type and weigth / importance (as they appear in the code)
+// e.g. Small Armor, Medium Armor, Big Armor, Mega Armor
+// whereas items in Items are sorted alphabetically by REGISTRY_SORT, regardless of type
+// Sorting by type is needed to fix positions of a few items that aren't defined together with other
+// items of the same type, e.g. Fuel
+IntrusiveList Items_sorted_by_type;
+STATIC_INIT(Items_sorted_by_type)
{
- default_order_items = IL_NEW();
- FOREACH(Items, true, {
- IL_PUSH(default_order_items, it);
+ Items_sorted_by_type = IL_NEW();
+ FOREACH(Items, it.instanceOfAmmo, {
+ IL_PUSH(Items_sorted_by_type, it);
+ });
+ FOREACH(Items, it.instanceOfHealth, {
+ IL_PUSH(Items_sorted_by_type, it);
+ });
+ FOREACH(Items, it.instanceOfArmor, {
+ IL_PUSH(Items_sorted_by_type, it);
+ });
+ FOREACH(Items, it.instanceOfPowerup, {
+ IL_PUSH(Items_sorted_by_type, it);
});
}
#endif
// The descriptions for these are in common/mutators/mutator/buffs/all.inc
#include <common/mutators/mutator/powerups/powerup/_mod.qh>
-IL_SOURCE(PowerupSource, Powerups, default_order_items, it.instanceOfPowerup)
+IL_SOURCE(PowerupSource, Powerups, Items_sorted_by_type, it.instanceOfPowerup)
// The descriptions for these are in common/mutators/mutator/powerups/powerup/*.qc and common/items/item/jetpack.qc
#include <common/items/all.qh>
-IL_SOURCE(ItemSource, Items, default_order_items, !it.instanceOfPowerup)
+IL_SOURCE(ItemSource, Items, Items_sorted_by_type, !it.instanceOfPowerup)
// The descriptions for these are in common/items/item/*.qc and common/mutators/mutator/instagib/items.qc
#include <common/mutators/mutator/nades/nades.qh>