From: Lyberta Date: Mon, 16 Oct 2017 12:05:09 +0000 (+0300) Subject: Random items: Removed more macros. X-Git-Tag: xonotic-v0.8.5~2426^2~18 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a5a607de31be0385337655807b97c2ce29ddc9eb;p=xonotic%2Fxonotic-data.pk3dir.git Random items: Removed more macros. --- diff --git a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc index ad0d49c2c..eb3696c33 100644 --- a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc +++ b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc @@ -221,7 +221,7 @@ string RandomItems_GetRandomMapItemClassName() { RandomSelection_AddString(it.m_canonical_spawnfunc, cvar(sprintf("g_random_items_%s_probability", - RandomItems_GetItemVarName(it.m_canonical_spawnfunc))), 1); + it.m_canonical_spawnfunc)), 1); }); return RandomSelection_chosen_string; } @@ -232,7 +232,7 @@ string RandomItems_GetRandomMapItemClassName() { RandomSelection_AddString(it.m_canonical_spawnfunc, cvar(sprintf("g_random_items_%s_probability", - RandomItems_GetItemVarName(it.m_canonical_spawnfunc))), 1); + it.m_canonical_spawnfunc)), 1); }); return RandomSelection_chosen_string; } @@ -243,7 +243,7 @@ string RandomItems_GetRandomMapItemClassName() { RandomSelection_AddString(it.m_canonical_spawnfunc, cvar(sprintf("g_random_items_%s_probability", - RandomItems_GetItemVarName(it.m_canonical_spawnfunc))), 1); + it.m_canonical_spawnfunc)), 1); }); return RandomSelection_chosen_string; } @@ -268,7 +268,7 @@ string RandomItems_GetRandomMapItemClassName() #define X(classname) \ RandomSelection_AddString( \ classname, \ - cvar(sprintf("g_random_items_%s_probability", RandomItems_GetItemVarName(classname))), \ + cvar(sprintf("g_random_items_%s_probability", classname)), \ 1 \ ) X("item_strength"); @@ -429,46 +429,34 @@ string RandomItems_GetRandomLootItemClassName() case RANDOM_ITEM_TYPE_HEALTH: { RandomSelection_Init(); - #define X(classname) \ - RandomSelection_AddString( \ - classname, \ - cvar(sprintf("g_random_loot_%s_probability", RandomItems_GetItemVarName(classname))), \ - 1 \ - ) - FOREACH(Items, it.instanceOfHealth, { - X(sprintf("item_%s", it.netname)); + FOREACH(Items, it.instanceOfHealth, + { + RandomSelection_AddString(it.m_canonical_spawnfunc, + cvar(sprintf("g_random_loot_%s_probability", + it.m_canonical_spawnfunc)), 1); }); - #undef X return RandomSelection_chosen_string; } case RANDOM_ITEM_TYPE_ARMOR: { RandomSelection_Init(); - #define X(classname) \ - RandomSelection_AddString( \ - classname, \ - cvar(sprintf("g_random_loot_%s_probability", RandomItems_GetItemVarName(classname))), \ - 1 \ - ) - FOREACH(Items, it.instanceOfArmor, { - X(sprintf("item_%s", it.netname)); + FOREACH(Items, it.instanceOfArmor, + { + RandomSelection_AddString(it.m_canonical_spawnfunc, + cvar(sprintf("g_random_loot_%s_probability", + it.m_canonical_spawnfunc)), 1); }); - #undef X return RandomSelection_chosen_string; } case RANDOM_ITEM_TYPE_RESOURCE: { RandomSelection_Init(); - #define X(classname) \ - RandomSelection_AddString( \ - classname, \ - cvar(sprintf("g_random_loot_%s_probability", RandomItems_GetItemVarName(classname))), \ - 1 \ - ) - FOREACH(Items, it.instanceOfAmmo, { - X(sprintf("item_%s", it.netname)); + FOREACH(Items, it.instanceOfAmmo, + { + RandomSelection_AddString(it.m_canonical_spawnfunc, + cvar(sprintf("g_random_loot_%s_probability", + it.m_canonical_spawnfunc)), 1); }); - #undef X return RandomSelection_chosen_string; } case RANDOM_ITEM_TYPE_WEAPON: @@ -493,7 +481,7 @@ string RandomItems_GetRandomLootItemClassName() #define X(classname) \ RandomSelection_AddString( \ classname, \ - cvar(sprintf("g_random_loot_%s_probability", RandomItems_GetItemVarName(classname))), \ + cvar(sprintf("g_random_loot_%s_probability", classname)), \ 1 \ ) X("item_strength");