On Wed, 18 Feb 1998, Chuck Reed wrote:
> base = (GET_LEVEL(ch) / total_levels) * GET_EXP(victim);
>
> However, one small problem. When I do the GET_LEVEL(ch) / total_levels it
> usually turns out a 0.*** like its supposed to. I thought that it would
> just accept that and continue the operation with the decimal, multiply by
> GET_EXP, get another decimal (like 1300.76) and knock it down to an integer
> there. Any idea of how to get away with this? I could do it if I knew
> some kind of trunc() function, but i don't know of any.
Cast it as an int.
Like so:
base = (int) (GET_LEVEL(ch) / total_levels) * GET_EXP(victim);
John Evans <evansj@hi-line.net> -- http://www.hi-line.net/~evansj/
Any sufficiently advanced technology is indistinguishable from magic.
--Arthur C. Clarke
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST