htw
Developer
Try something like:
Code:if (GetCharInfo2()->Class <= 16) { if (ClassInfo[GetCharInfo2()->Class].CanCast) Domedstuff(); } else if (GetCharInfo()->ManaMax > 0) Domedstuff ();
This is what I'm using currently.
Code:inline float PercentMana(PSPAWNINFO &pSpawn) { if ((float)pSpawn->ManaMax <= 0) return 100.0f; return (float)pSpawn->ManaCurrent / (float)pSpawn->ManaMax * 100.0f; }
I expected that would work.
If you are interested, I would just recommend a couple of things to do. ManaMax is 0, no need to cast it as float in your if().
Do you need the float? Personally, I would just change it to an int, and floor() a x+.5 or something. E.g., since the calls compare to things like MedAt and MedTill, which are ints, you can be assured there are no floating point precision errors.
Also, I would suggest the return check make sure ManaMax > 0 before the division, as you will be causing a division by zero error that won't signal.
The binary / operator yields the quotient, and the binary % operator yields the remainder from the division of the first expression by the second. If the second operand of / or % is zero the behavior is undefined.
Up to you, just a couple basic ideas.
htw