Issue, confusion and general aggravation with ZONE_FLAGGED

From: Mathew Earle Reuther (graymere@zipcon.net)
Date: 09/03/02


Ok, so I've got zone flags in (as per Welcor's urging and my original
intent) and am trying to get them to work fully.  One of the things I'm
doing is using both status mode and zone flags to determine if a mortal
can enter a zone.

(Note, I know that it was strongly suggested I not use status mode, as it
contains a 1 or 0 toggle, but I've kept it in because I can limit that
toggle to high level immortals, thus preventing builders from activating
their own zones.)

So, that said, here's my issue:

ACMD(do_areas)
{
  int i;
  char buf[MAX_STRING_LENGTH];

  skip_spaces(&argument);

  *buf = '\0';

  if (!*argument) {
    for (i = 0; i <= top_of_zone_table; i++)
      display_zone_to_buf(ch, buf, i);
    page_string(ch->desc, buf, 1);
    return;
  }
}

void display_zone_to_buf(struct char_data *ch, char *bufptr, int zone)
{
  if (ZONE_FLAGGED(zone, ZONE_LOCKED)) {
    sprintf(bufptr, "%s %s%-30.30s  %s( %s%3d %sto %s%3d%s ) [ %s%s%s ]
[%s locked %s]\r\n", bufptr,
                   CCCYN(ch, C_NRM), zone_table[zone].name, CCNRM(ch,
C_NRM),
                   CCYEL(ch, C_NRM), zone_table[zone].lvl1, CCNRM(ch,
C_NRM),
                   CCYEL(ch, C_NRM), zone_table[zone].lvl2, CCNRM(ch,
C_NRM),
                   CCGRN(ch, C_NRM), zone_table[zone].status_mode ?
"available" : "in review",
                   CCNRM(ch, C_NRM), CCRED(ch, C_NRM), CCNRM(ch, C_NRM));
  } else {
    sprintf(bufptr, "%s %s%-30.30s  %s( %s%3d %sto %s%3d%s ) [ %s%s%s
]\r\n", bufptr,
                   CCCYN(ch, C_NRM), zone_table[zone].name, CCNRM(ch,
C_NRM),
                   CCYEL(ch, C_NRM), zone_table[zone].lvl1, CCNRM(ch,
C_NRM),
                   CCYEL(ch, C_NRM), zone_table[zone].lvl2, CCNRM(ch,
C_NRM),
                   CCGRN(ch, C_NRM), zone_table[zone].status_mode ?
"available" : "in review",
                   CCNRM(ch, C_NRM));
  }
}


The do_areas command displays a list of all areas.  It passes off to the
display_zone_to_buf function in order to have the actual information
displayed for the zone.  If I cut the display_zone_to_buf down to merely
the second chunk (after the else) it works fine (but of course displays
nothing extra when a zone is locked).

My question is, why does it give me a parse error on the first line of the
function?  I have successfully used my ZONE_FLAGGED macro elsewhere in the
code.  For fun, here's my entries from utils.h:

utils.h:#define ZONE_FLAGS(zone) (zone_table[(zone)].zone_flags)
utils.h:#define ZONE_FLAGGED(zone, flag) (IS_SET(ZONE_FLAGS(zone), (flag))

The actual compile error is:

act.informative.c: In function `display_zone_to_buf':
act.informative.c:1755: parse error before `{'
(1755 is the IF statement line)

Help?  Anyone?  I'm going nuts here trying to figure out what is needed to
get this thing functional!  (This is about the 4th permutation I've tried.
The previous ones were much smaller in lines of code, this one is twice
the size almost of the others, but it SEEMED like it was the most blunt
and cludgy way to do it . . . which often means I can make it work.)

Thanks in advance for any ideas!

-Mathew

--
   +---------------------------------------------------------------+
   | 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