Re: [Code] Thaco Table bug

From: Thomas Arp (t_arp@stofanet.dk)
Date: 10/24/02


From: "Jeremy M." <jkm4802@HOTMAIL.COM>
> class.c:820: `mod' undeclared (first use in this function)

As others stated, mod should be declared as an int in the beginning of
the function.
>
> The code it has problems with is:
>
>   switch (chclass) {
>     case CLASS_MAGIC_USER:
>                         mod = 45;
>                         return ((level * mod)*(level * mod));
>     break;
>     case CLASS_CLERIC:
>                         mod = 44;
>                         return ((level * mod)*(level * mod));
>     break;
>     case CLASS_THIEF:
>                         mod = 43;
>                         return ((level * mod)*(level * mod));
>     break;
>     case CLASS_WARRIOR:
>                         mod = 42;
>                         return ((level * mod)*(level * mod));
>     break;
>   }
>
> Any suggestions or help would be appreciated :)

Actually I do have a suggestion:
   int mod;

   switch (chclass) {
     case CLASS_MAGIC_USER:       mod = 45*45; break;
     case CLASS_CLERIC:           mod = 44*44; break;
     case CLASS_THIEF :           mod = 43*43; break;
     case CLASS_WARRIOR: default: mod = 42*42; break;
   }

   return ( level * level * mod );

I'd say that's easier to read and debug.

Welcor

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT