Re: Help with guilds and multiclassing.

From: Thomas Arp (t_arp@stofanet.dk)
Date: 04/06/03


From: "peter dahlgren"
> i am having this problem with the guilds and guildguards...
> my GET_CLASS(ch) has been turned into an array that looks like
> this GET_CLASS(ch, i) with a max of 6 slots... the first class
> chosen at startup is always GET_CLASS(ch, 0). in spec_procs.c
> i tried to put in a for loop to check for all slots, didn't
> work... then i simply put in GET_CLASS(ch, 0) to check if it
> worked better... but no.

> any ideas? the same thing goes for the guild masters...
>
> here is how the code for the skills/spells look in SPECIAL(guild)
>
> for (i = 0; i < MAX_MULTICLASSES; i++)
>   {
>     if (skill_num < 1 ||
>        GET_CLASS_LEVEL(ch, i) <
>            spell_info[skill_num].min_level[(int) GET_CLASS(ch, i)]) {
>       send_to_char(ch, "You do not know of that %s.\r\n", SPLSKL(ch));
>       return (TRUE);
>     }
>   }
>
> i use this in spell_parser aswell.. please help me
>

To make your code a bit faster, don't put the skill_num check inside
the loop. I assume you set unused classes to CLASS_UNDEFINED. Then
try this approach:

int found = FALSE, i;

if (skill_num < 1) {
  send_to_char(ch, "no such skill!\r\n");
  return;
}

for (i = 0;i < MAX_MULTICLASSES && !found; i++) {
  if (GET_CLASS(ch, i) == CLASS_UNDEFINED)
    continue;

  if (GET_CLASS_LEVEL(ch, i) >=
      spell_info[skill_num].min_level[(int) GET_CLASS(ch, i)])
    found = TRUE;
}

if (!found) {
  send_to_char(ch, "You can't learn that %s!\r\n", SPLSKL(ch));
  return;
}

[do stuff here ; i and skill_num are valid]

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/26/03 PDT