Re: [CODE] syntax error : 'if'

From: Tony Robbins (robbinsw@ucs.orst.edu)
Date: 07/04/00


[snip]
> 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)                       \
+    do { \
>      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;                                 \
>             }                                           \
>           }                                             \
+       }
[snip]

That's an awfully bad macro to use.  You should make that a function.
You're relying that a number of different variables will exist where you
want to use it.

Anyway, another thing, you may need to enclose that whole thing in a do {
xxx } setup.  I'm not sure why, exactly, but a lot of the larger macros in
CircleMUD require it.


-k.


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