Fix shops loading incorrectly

This commit is contained in:
2015-06-08 16:04:08 -04:00
parent f8ea8fd80b
commit b807a1842f
3 changed files with 22 additions and 8 deletions

View File

@@ -112,6 +112,14 @@ void cShop::addItem(size_t n, cItem item, size_t quantity, int chance) {
items[i].quantity = min(999,quantity) + chance * 1000;
}
void cShop::refreshItems(std::vector<cItem>& fromList) {
// The purpose of this is to load in the actual item data from the scenario list
for(size_t i = 0; i < items.size(); i++) {
if(items[i].type == eShopItemType::ITEM || items[i].type == eShopItemType::OPT_ITEM)
items[i].item = fromList[items[i].index];
}
}
static cItem store_mage_spells(short which_s) {
cItem spell('spel');
static const short cost[62] = {

View File

@@ -78,6 +78,7 @@ public:
}
void replaceItem(size_t i, cShopItem newItem);
void replaceSpecial(size_t i, eShopItemType type, int n = 0);
void refreshItems(std::vector<cItem>& fromList);
size_t size();
cShopItem getItem(size_t i) const;
eShopType getType() const;