Corrected bugs with removing items from the incorrect main inventory.
This commit is contained in:
parent
22d1a6d834
commit
a139072d68
@ -176,8 +176,6 @@ bool Crawler::OnUserCreate(){
|
||||
Inventory::AddItem("Blue Slime Remains",22);
|
||||
|
||||
LoadLevel(LEVEL_NAMES["starting_map"_S]);
|
||||
Inventory::AddItem("Bandages",3);
|
||||
Inventory::AddItem("Blue Slime Remains",10,true);
|
||||
ChangePlayerClass(WARRIOR);
|
||||
|
||||
GameState::Initialize();
|
||||
@ -1309,6 +1307,8 @@ void Crawler::LoadLevel(MapName map){
|
||||
totalBossEncounterMobs=0;
|
||||
Inventory::Clear("Monster Loot");
|
||||
Inventory::Clear("Stage Loot");
|
||||
Inventory::AddItem("Bandages",3);
|
||||
Inventory::AddItem("Blue Slime Remains",10,true);
|
||||
|
||||
#pragma region Monster Spawn Data Setup
|
||||
for(auto key:MAP_DATA[map].SpawnerData){
|
||||
|
@ -185,10 +185,7 @@ bool Inventory::UseItem(IT it,uint32_t amt){
|
||||
|
||||
//Returns true if the item has been consumed completely and there are 0 remaining of that type in our inventory.
|
||||
bool Inventory::RemoveItem(IT it,ITCategory inventory,uint32_t amt){
|
||||
//There are two places to manipulate items in (Both the sorted inventory and the actual inventory)
|
||||
if (!_inventory.count(it))return false;
|
||||
if (amt>=_inventory.at(it).Amt()){
|
||||
int count=0;
|
||||
#pragma region Calculate Inventory to Manipulate
|
||||
std::vector<Item>&inv=sortedInv.at(inventory);
|
||||
bool eraseFromLootWindow=false;
|
||||
if(inventory=="Monster Loot") {
|
||||
@ -199,10 +196,17 @@ bool Inventory::RemoveItem(IT it,ITCategory inventory,uint32_t amt){
|
||||
inv=sortedInv.at("Stage Loot");
|
||||
eraseFromLootWindow=true;
|
||||
}
|
||||
int count=0;
|
||||
for(Item&item:inv){
|
||||
if(item.Name()==it)break;
|
||||
count++;
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
//There are two places to manipulate items in (Both the sorted inventory and the actual inventory)
|
||||
if (!inv.at(count).Amt())return false;
|
||||
|
||||
if (amt>=inv.at(count).Amt()){
|
||||
inv.erase(inv.begin()+count);
|
||||
if(!eraseFromLootWindow){
|
||||
_inventory.erase(it);
|
||||
@ -211,7 +215,10 @@ bool Inventory::RemoveItem(IT it,ITCategory inventory,uint32_t amt){
|
||||
Menu::InventorySlotsUpdated(inventory);
|
||||
return true;
|
||||
}else{
|
||||
_inventory.at(it).amt-=amt;
|
||||
inv.at(count).amt-=amt;
|
||||
if(!eraseFromLootWindow){
|
||||
_inventory.at(it).amt-=amt;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ SUCH DAMAGE.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 1
|
||||
#define VERSION_BUILD 2979
|
||||
#define VERSION_BUILD 2981
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
Loading…
x
Reference in New Issue
Block a user