Restock loadout items from previous setup automatically.
This commit is contained in:
parent
f1dc45ea95
commit
84e713b9a2
@ -3225,6 +3225,14 @@ const std::weak_ptr<Item>AiL::GetLoadoutItem(int 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){
|
||||
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){
|
||||
|
@ -273,6 +273,7 @@ public:
|
||||
const std::weak_ptr<Item>GetLoadoutItem(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.
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user