[CODE] Guild guards spec proc bug

From: Welcor (welcor@dune.net)
Date: 06/24/01


Hi all

I've discovered that when you add new classes, and wish to have more
than one class train at the same guildmaster, you run into a problem;

We added a lich class who should train at the mage guild along with the
mages. To let them in, we added the following in class.c:
...
  {CLASS_MAGIC_USER, 3075, SCMD_UP},
+  {CLASS_LICH,     3075, SCMD_UP},
...

The guildguard specproc, however, wasn't capable of handling the
situation, and refused to let liches enter the guild (it returned
prematurely).  Here's a quick fix:

SPECIAL(guild_guard)
{
-  int i;
+  int i, found = FALSE, block = FALSE;
  struct char_data *guard = (struct char_data *) me;
  const char *buf = "The guard humiliates you, and blocks your
way.\r\n";
  const char *buf2 = "The guard humiliates $n, and blocks $s way.";

  if (!IS_MOVE(cmd) || AFF_FLAGGED(guard, AFF_BLIND))
    return (FALSE);

  if (GET_LEVEL(ch) >= LVL_IMMORT)
    return (FALSE);

+  if (IS_NPC(ch))
+    return (FALSE);

-  for (i = 0; guild_info[i][0] != -1; i++) {
-    if ((IS_NPC(ch) || GET_CLASS(ch) != guild_info[i][0]) &&
-         GET_ROOM_VNUM(IN_ROOM(ch)) == guild_info[i][1] &&
-         cmd == guild_info[i][2]) {

+  for (i = 0;!found && guild_info[i][0] != -1; i++)
+    if (GET_ROOM_VNUM(IN_ROOM(ch)) == guild_info[i][1])
+      if (GET_CLASS(ch) != guild_info[i][0]) {
+        if (cmd == guild_info[i][2])
+          block = TRUE;
+      } else {
+        found = TRUE;
+        block = FALSE;
+      }
+ 
+  if (block) {
      send_to_char(buf, ch);
      act(buf2, FALSE, ch, 0, 0, TO_ROOM);
      return (TRUE);
    }
  }

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/05/01 PST