Skip to content

Commit

Permalink
Added RunicAffix boolean for upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrettin committed Jan 1, 2016
1 parent fcd9b43 commit 4e7b45c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/include/upgrade_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class CUpgrade
bool Arrows;
bool MagicPrefix;
bool MagicSuffix;
bool RunicAffix;
bool ItemPrefix[MaxItemClasses];
bool ItemSuffix[MaxItemClasses];
bool IncompatibleAffixes[UpgradeMax];
Expand Down
1 change: 1 addition & 0 deletions src/tolua/upgrade.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class CUpgrade
bool Arrows;
bool MagicPrefix;
bool MagicSuffix;
bool RunicAffix;
bool ItemPrefix[MaxItemClasses];
bool ItemSuffix[MaxItemClasses];
bool IncompatibleAffixes[UpgradeMax];
Expand Down
23 changes: 21 additions & 2 deletions src/unit/upgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ bool CUnitStats::operator != (const CUnitStats &rhs) const
CUpgrade::CUpgrade(const std::string &ident) :
//Wyrmgus start
// Ident(ident), ID(0)
Ident(ident), ID(0), Ability(false), Weapon(false), Shield(false), Boots(false), Arrows(false), MagicPrefix(false), MagicSuffix(false)
Ident(ident), ID(0), Ability(false), Weapon(false), Shield(false), Boots(false), Arrows(false), MagicPrefix(false), MagicSuffix(false), RunicAffix(false)
//Wyrmgus end
{
memset(this->Costs, 0, sizeof(this->Costs));
Expand Down Expand Up @@ -600,7 +600,25 @@ static int CclGetItemSuffixes(lua_State *l)
{
std::vector<CUpgrade *> item_suffixes;
for (int i = 0; i < AllUpgrades.size(); ++i) {
if (AllUpgrades[i]->MagicSuffix) {
if (AllUpgrades[i]->MagicSuffix && !AllUpgrades[i]->RunicAffix) {
item_suffixes.push_back(AllUpgrades[i]);
}
}

lua_createtable(l, item_suffixes.size(), 0);
for (size_t i = 1; i <= item_suffixes.size(); ++i)
{
lua_pushstring(l, item_suffixes[i-1]->Ident.c_str());
lua_rawseti(l, -2, i);
}
return 1;
}

static int CclGetRunicSuffixes(lua_State *l)
{
std::vector<CUpgrade *> item_suffixes;
for (int i = 0; i < AllUpgrades.size(); ++i) {
if (AllUpgrades[i]->MagicSuffix && AllUpgrades[i]->RunicAffix) {
item_suffixes.push_back(AllUpgrades[i]);
}
}
Expand Down Expand Up @@ -756,6 +774,7 @@ void UpgradesCclRegister()
lua_register(Lua, "GetUpgrades", CclGetUpgrades);
lua_register(Lua, "GetItemPrefixes", CclGetItemPrefixes);
lua_register(Lua, "GetItemSuffixes", CclGetItemSuffixes);
lua_register(Lua, "GetRunicSuffixes", CclGetRunicSuffixes);
lua_register(Lua, "GetUpgradeData", CclGetUpgradeData);
//Wyrmgus end
}
Expand Down

0 comments on commit 4e7b45c

Please sign in to comment.