Questions about the currency "Gold"

Questions about the currency "Gold"

I have some questions when calling the "currency" (Gold Value) of a character, I was watching and the currency that I have with a character in the text file, but when loading the data file (SaveLoad.cpp) does not load or save the currency with (pc-> stats.currency;) works with (menu-> inv-> currency). As shows no value (stats->currency;)  called with a variable MenuInventory (currency)

 

I have also looked to (stats->currency = currency;) (same)

 

From MenuStash with a button (test) I want to add gold to currency:

 

if (TestGold-> checkClick ()) {

LootManager :: getInstance () -> playCurrencySound ();

stats-> currency + = 100;

}

 

when I press the button, the sound it makes, but the currency did not increase, I tried adding (class MenuManager) and try calling him MenuManager

 

menu-> inv-> currency + = 100;

menu->inv->addCurrency(100);

 

But just when I press the button, the game break, I tried to change everything that contained "menu-> inv-> currency" by "stats.currency" in MenuInventory, SaveLoad etc... and it worked. (I can see that every time I hit the button, the currency of the inventory up 100)

 

I think the change is not caused by not updating the currency of inventory when enter a value from (stats->currency;)

 

The question I have is how I can call the currency without having to change all currency called from the MenuInventory and SaveLoad

 

Sorry for my english, i,m use Google translator