Re: Alignment

From: Welcor (welcor@dune.net)
Date: 11/27/01


I cleaned up your code a bit - and fixed the bug..
----- Original Message -----
From: "David Cole" <tiznor@HOTMAIL.COM>
>
> ALIGN_GOOD = 1000
> ALIGN_NEUTRAL = 0
> ALIGN_EVIL = -1000
>
 void set_alignment(struct descriptor_data *d)
{
  switch (GET_RACE(d->character)) {
    case RACE_HUMAN:
    case RACE_ELF:
    case RACE_DWARF:
    case RACE_KENDER:
    case RACE_GNOME:
    case RACE_HALF_ELF:
    case RACE_HALF_KENDER:
      GET_ALIGNMENT(d->character) = ALIGN_GOOD;
      break;
    case RACE_BARBARIAN:
      GET_ALIGNMENT(d->character) = ALIGN_NEUTRAL;
      break;
    case RACE_DUERGAR:
    case RACE_DROW:
    case RACE_OGRE:
    case RACE_TROLL:
    case RACE_ORC:
    case RACE_HALF_ORC:
      GET_ALIGNMENT(d->character) = ALIGN_EVIL;
      break;
    default:
      /* caller messed up */
      GET_ALIGNMENT(d->character) = ALIGN_NEUTRAL;
  }
  switch (GET_CLASS(d->character)) {
    case CLASS_NECROMANCER:
      GET_ALIGNMENT(d->character) = ALIGN_EVIL;
      break;
  }
}

Use break; instead of return to stay in the function!

Welcor

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST