Add Inventory Clear functions. Prep Monster Loot and Stage Loot inventory types.

pull/28/head
sigonasr2 1 year ago
parent 6c16405908
commit 1745911eb5
  1. 3
      Crawler/Crawler.cpp
  2. 2
      Crawler/InventoryScrollableWindowComponent.h
  3. 9
      Crawler/Item.cpp
  4. 1
      Crawler/Item.h
  5. 2
      Crawler/Menu.cpp
  6. 2
      Crawler/MenuItemButton.h
  7. 2
      Crawler/Version.h

@ -174,6 +174,7 @@ bool Crawler::OnUserCreate(){
Inventory::AddItem("Blue Slime Remains",22);
LoadLevel(LEVEL_NAMES["starting_map"_S]);
Inventory::AddItem("Blue Slime Remains",10);
ChangePlayerClass(WARRIOR);
GameState::Initialize();
@ -1303,6 +1304,8 @@ void Crawler::LoadLevel(MapName map){
totalDamageDealt=0;
encounterStarted=false;
totalBossEncounterMobs=0;
Inventory::Clear("Monster Loot");
Inventory::Clear("Stage Loot");
#pragma region Monster Spawn Data Setup
for(auto key:MAP_DATA[map].SpawnerData){

@ -126,7 +126,7 @@ protected:
};
MenuItemButton*button=NEW MenuItemButton{parentMenu,{{float(totalSpacing*x),float(totalSpacing*y)},{float(buttonSize),float(buttonSize)}},Inventory::get("Consumables"),itemIndex,useItemFunc,parentMenu,"itemName","itemDescription"};
AddComponent(Menu::menus[parentMenu],"item"+std::to_string(itemIndex),button);
AddComponent(Menu::menus[parentMenu],"item_"+cat+"_"+std::to_string(itemIndex),button);
}else
if(components.size()>inv.size()){ //There are empty spots, so let's clean up.
RemoveEmptySlots();

@ -1,3 +1,4 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
@ -29,6 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#pragma endregion
#include "Item.h"
#include "safemap.h"
#include "DEFINES.h"
@ -272,3 +274,10 @@ ItemScript&ItemInfo::OnUseAction(){
bool Item::IsBlank(){
return amt==0||it==nullptr;
}
void Inventory::Clear(ITCategory itemCategory){
std::vector<IT>itemList=get(itemCategory); //We have to make a copy here because RemoveItem() will modify the list provided by get() inline.
for(IT&item:itemList){
RemoveItem(item,GetItemCount(item));
}
}

@ -75,6 +75,7 @@ public:
static bool UseItem(IT it,uint32_t amt=1);
static bool RemoveItem(IT it,uint32_t amt=1);
static std::vector<IT>&get(ITCategory itemCategory);
static void Clear(ITCategory itemCategory);
static bool SwapItems(ITCategory itemCategory,uint32_t slot1,uint32_t slot2);
//Makes sure this is a valid category. Will error out if it doesn't exist! Use for ERROR HANDLING!

@ -1,3 +1,4 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
@ -29,6 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#pragma endregion
#include "Crawler.h"
#include "MenuComponent.h"
#include "DEFINES.h"

@ -1,3 +1,4 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
@ -29,6 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#pragma endregion
#pragma once
#include "Menu.h"
#include "MenuLabel.h"

@ -33,7 +33,7 @@ SUCH DAMAGE.
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
#define VERSION_BUILD 2954
#define VERSION_BUILD 2961
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save