Traveling Merchant Purchase Window and systems implemented.
This commit is contained in:
+10
-1
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user