Hrmm I would have never thought of that, thou I'm well versed in coming up with formulas now. I must admit the switch statement on the other hand, I'm making lots of use of cleaning up all my existing code.
Indeed, I just wasnt too comfortable with switch statements yet, but I understand them now that I'v seen them work with somthing I did with somthing else heh, and yeah it looks a hell of alot nicer, thanks nick.
It compiled clean no warnings or anything under cygwin, and linux. Hell I dont even know why I added the ";" orginaly. Once I got past a little hump in the coding process...I just kept going way late into the night maby thats to blame.
Amended on Sun 11 Jul 2004 08:59 AM (UTC) by Greven
Message
Oh, heh, I see it. After each of your if statements, you have ";". This effectively says "If this is condition is true, do the next statement. That statement is empty, so execute nothing. Now that the if check is done, execute the next block of code in the {}'s, since these are not attached to an if check". Try removing the ; and see what happens.
I just junked the new heal code, it wasnt that important anyway, but then a similar problem arose in another part of my code I tested, so I did this test.
One obvious problem here is that if the ch->mlevel is (say) 3, then the variable "heal" is undefined, and thus could indeed be out of your acceptable range.
Cluttered code is an occupational hazard, who knows, we might can even help clean it up a bit. Post what you're trying to do and let's see what we can see. From the looks of what you posted a case structure could make it easier to track anyway but I'd want to see all of it before saying that for certain.
Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Would it be possible to paste the code? For a heal I can't think of a good reason why the number would deviate from the range paramater, least not offhand in smaug anyway.
Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.