Re: [CODE] syntax error : 'if'

From: Fizal (amustapa@gamebox.net)
Date: 07/04/00


At 02:03 PM +0200 4/7/2000, Jan Pedersen wrote:
>Hi
>
>Where i marked the below text with ---> i get a syntax error : 'if' when i
compile
>i dunno why, any ideas ?
...
>#define CHECK_ZONE_VIEW_PERM(num)
>---> if (IN_NEXT_ZONE(num) || last_in_zone == -1) {
>     zone_rnum = real_zone(num);
...

All definitions like above must be done in a single line. But, if you're
going to use multiple lines to define something you'll have to put a
backslash \ at the end of the line to indicate that there's a continuation
on the next line. Therefore, your definition should be something like this:

#define CHECK_ZONE_VIEW_PERM(num)                       \
     if (IN_NEXT_ZONE(num) || last_in_zone == -1) {     \
     zone_rnum = real_zone(num);                        \
            last_in_zone = zone_table[zone_rnum].top;   \
            if (!can_view_zone(ch, zone_rnum)) {        \
              sprintf(buf + strlen(buf), "&RZone #%d: Access
denied.&w\r\n",  \
                zone_table[zone_rnum].number);          \
              first = last_in_zone + 1;                 \
              first += 100 - (first % 100);             \
              continue;                                 \
            }                                           \
          }

---

Afizal Mustapa
Petaling Jaya, Selangor, Malaysia.
(amustapa@hotmail.com)


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT