Restock loadout items from previous setup automatically.

mac-build
sigonasr2, Sig, Sigo 9 months ago
parent f8639d96f9
commit 75fd63dbcd
  1. 8
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 1
      Adventures in Lestoria/AdventuresInLestoria.h
  3. 2
      Adventures in Lestoria/OverworldMapLevelWindow.cpp

@ -3225,6 +3225,14 @@ const std::weak_ptr<Item>AiL::GetLoadoutItem(int slot){
return loadout[slot]; return loadout[slot];
} }
void AiL::RestockLoadoutItems(){
for(int i=0;i<GetLoadoutSize();i++){
if(!ISBLANK(GetLoadoutItem(i))){
SetLoadoutItem(i,GetLoadoutItem(i).lock()->ActualName);
}
}
}
void AiL::SetLoadoutItem(int slot,std::string itemName){ 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(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){ if(Inventory::GetItemCount(itemName)>0){

@ -273,6 +273,7 @@ public:
const std::weak_ptr<Item>GetLoadoutItem(int slot); const std::weak_ptr<Item>GetLoadoutItem(int slot);
void SetLoadoutItem(int slot,std::string itemName); void SetLoadoutItem(int slot,std::string itemName);
int GetLoadoutSize()const; int GetLoadoutSize()const;
void RestockLoadoutItems();
//Returns true if the item can be used (we have >0 of it) //Returns true if the item can be used (we have >0 of it)
bool UseLoadoutItem(int slot); bool UseLoadoutItem(int slot);
//Blanks out this loadout item. //Blanks out this loadout item.

@ -67,6 +67,8 @@ void Menu::InitializeOverworldMapLevelWindow(){
Tutorial::SetNextTask(TutorialTaskName::BLACKSMITH); Tutorial::SetNextTask(TutorialTaskName::BLACKSMITH);
} }
game->RestockLoadoutItems();
if(game->MAP_DATA[State_OverworldMap::GetCurrentConnectionPoint().map].skipLoadoutScreen|| if(game->MAP_DATA[State_OverworldMap::GetCurrentConnectionPoint().map].skipLoadoutScreen||
State_OverworldMap::GetCurrentConnectionPoint().type.starts_with("STORY")){ State_OverworldMap::GetCurrentConnectionPoint().type.starts_with("STORY")){
State_OverworldMap::StartLevel(); State_OverworldMap::StartLevel();

Loading…
Cancel
Save