Hey so I have another problem. As part of my game both the enemy and player roll dexterity at the start. This dexterity is later used to make a roll number. The problem is, I only ever get 0.
cout << "The enemy got " << enemyStartRoll << " and you got " << playerStartRoll << "!" << endl;
That is where I get a zero and this is where I roll the players start number:
Note: these are both codes from different .cpp files but I've used extern with some of the variables to get them across classes. I have included the header too if anyone asks.
Nevermind, I'm constantly an idiot. I forgot to even call the function to generate the enemies dexterity at any point and I also forgot to call the functions to generate the starting roll numbers too. It's early so I guess I'm tired.
Be careful when doing rangePlayerRoll*rand() that it don't cause an overflow. To be safe you should cast one of the operands to double or do the division before multiplication. playerStartRoll = 1+int(rangePlayerRoll*(rand()/(RAND_MAX + 1.0)));