Traveling Merchant Purchase Window and systems implemented.

This commit is contained in:
2023-12-19 18:46:59 -06:00
parent 71fe49162d
commit eae8239501
19 changed files with 225 additions and 30 deletions
+10 -1
View File
@@ -72,6 +72,8 @@ InputGroup Player::KEY_ITEM3;
ItemAttributable PlayerStats::equipStats;
ItemAttributable PlayerStats::baseStats;
std::set<MenuComponent*>Player::moneyListeners;
Player::Player()
:lastReleasedMovementKey(DOWN),facingDirection(DOWN),state(State::NORMAL){
Initialize();
@@ -915,4 +917,11 @@ uint32_t Player::GetMoney()const{
};
void Player::SetMoney(uint32_t newMoney){
money=newMoney;
};
for(auto&component:moneyListeners){
component->OnPlayerMoneyUpdate(newMoney);
}
};
void Player::AddMoneyListener(MenuComponent*component){
if(moneyListeners.count(component))ERR("WARNING! Trying to add a second copy of component "<<std::quoted(component->GetName()));
moneyListeners.insert(component);
}