Refactored Map Data access so that other locations in code no longer had write abilities to the map data. Changed permanent exit zone spawning to a temporary. Fix equipment items being duplicated due to sorted inventory not being in sync with actual inventory.
if(ZONE_LIST.count(std::string(zoneName))==0)ERR(std::format("WARNING! Trying to add non-existent Zone Key {} to zone list of map {}. THIS IS NOT ALLOWED!",zoneName,std::string(GetCurrentMapName())));
inv.erase(inv.begin()+count);//Clears it from the detected sorted inventory as well!
if(invSize-1!=inv.size())ERR(std::format("WARNING! Did not properly erase {} from sorted inventory {}",itemName,inventory));
if(!eraseFromLootWindow){//We must clear out the item AFTER we've updated context-sensitive inventories because they may be borrowing a ref from this structure!!!
std::vector<std::shared_ptr<Item>>::iteratorit=std::find(inv.begin(),inv.end(),std::make_shared<Item>(amt,item));//Uses operator== to compare if this item does exist in a stage/monster loot inventory already. We just make an in-place shared pointer of an item to compare with.
if(it!=inv.end()){
(*it)->amt+=amt;
if(itemRef->IsEquippable()){//We cannot stack items! They are always individual.
inv.push_back(itemRef);
}else{
inv.push_back(std::make_shared<Item>(amt,item));
std::vector<std::shared_ptr<Item>>::iteratorit=std::find(inv.begin(),inv.end(),itemRef);//Uses operator== to compare if this item does exist in a stage/monster loot inventory already. We just make an in-place shared pointer of an item to compare with.
std::vector<std::shared_ptr<Item>>itemList=get(itemCategory);//We have to make a copy here because RemoveItem() will modify the list provided by get() inline.