Companion to ANA and SANA

From: Mike Breuer (mbreuer@new.rr.com)
Date: 03/11/01


-- snip --
(various discussion on ANA/SANA macros)
-- snip --

As long as we're on the topic of definate articles, I thought I'd share a
macro that I have found useful for stripping articles from the beginning of
a string.  I believe I also added the strn_cmp function, but I can't
remember for certain.  If anyone needs it, I'll post that too.

#define NOARTICLE(str) ((!strn_cmp((str), "the ", 4)) \
                        ? (str) + 4 \
                        : ((!strn_cmp((str), "an ", 3)) \
                           ? (str) + 3 \
                           : ((!strn_cmp((str), "a ", 2)) \
                              ? (str) + 2 \
                              : (str) \
                             ) \
                          ) \
                       )

I use this to spruce up the damage messages:

You masacre the dragon to small fragments with your deadly elven short
sword.

Instead of:

You masacre the dragon to small fragments with your deadly slash.

--
   +---------------------------------------------------------------+
   | 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/04/01 PST