From 75fd63dbcd6df890256a5db9eb95c19fda139155 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Fri, 1 Mar 2024 18:28:29 +0000 Subject: [PATCH] Restock loadout items from previous setup automatically. --- Adventures in Lestoria/AdventuresInLestoria.cpp | 8 ++++++++ Adventures in Lestoria/AdventuresInLestoria.h | 1 + Adventures in Lestoria/OverworldMapLevelWindow.cpp | 2 ++ 3 files changed, 11 insertions(+) diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 5f8608bb..cefac87c 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -3225,6 +3225,14 @@ const std::weak_ptrAiL::GetLoadoutItem(int slot){ return loadout[slot]; } +void AiL::RestockLoadoutItems(){ + for(int i=0;iActualName); + } + } +} + void AiL::SetLoadoutItem(int slot,std::string itemName){ if(slot<0||slot>GetLoadoutSize()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(GetLoadoutSize()-1)+")."); if(Inventory::GetItemCount(itemName)>0){ diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 7e0d3c69..9ebf863e 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -273,6 +273,7 @@ public: const std::weak_ptrGetLoadoutItem(int slot); void SetLoadoutItem(int slot,std::string itemName); int GetLoadoutSize()const; + void RestockLoadoutItems(); //Returns true if the item can be used (we have >0 of it) bool UseLoadoutItem(int slot); //Blanks out this loadout item. diff --git a/Adventures in Lestoria/OverworldMapLevelWindow.cpp b/Adventures in Lestoria/OverworldMapLevelWindow.cpp index 37acb39b..0a4ec093 100644 --- a/Adventures in Lestoria/OverworldMapLevelWindow.cpp +++ b/Adventures in Lestoria/OverworldMapLevelWindow.cpp @@ -67,6 +67,8 @@ void Menu::InitializeOverworldMapLevelWindow(){ Tutorial::SetNextTask(TutorialTaskName::BLACKSMITH); } + game->RestockLoadoutItems(); + if(game->MAP_DATA[State_OverworldMap::GetCurrentConnectionPoint().map].skipLoadoutScreen|| State_OverworldMap::GetCurrentConnectionPoint().type.starts_with("STORY")){ State_OverworldMap::StartLevel();