I'm having trouble with my no_mana function i want i to stop the player from enetering the skill menu becuase he is out of mana. Even tho it does what i wanted if i input 2 after the MP reaches 0 and then i input 1,3,4. It still lets the player enter the skill menu. I think this has to do with me returning combatMenu() in the no mana function but i'm not sure.
you have some weirdness... nomana returns a value but is a void function so that does nothing and should warn you about it.
what I would do is maybe something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
bool no_mana()
{
if (HeroMaxMP <= 0)
{
//other code
returntrue; //out of mana
}
returnfalse; //not out of mana
}
...
case 2:
{
if(!no_mana())
SkillMenu();
but you may need to adjust the idea since you wanted some result from the other menu in no-mana... tinker with the idea until it all works together
I can only image what went wrong with it. If you have some new code, post it, and we can look again... its no trouble... just start a new post (in this thread) with the updated code.
avoid exit(0). It is not hurting anything here, but it is bad practice to abuse it.
exit is meant to end the program with an error code in case of unrecoverable error detected. You should try to wire the program so that it gets back to main and returns (0) from there as a 'normal program exit' approach.
later, you will encounter terminate() which is like exit except it attempts to clean up first. Like exit, terminate is for errors, not normal operations.