Removing color codes.

From: Rasdan (rasdan@PEAK.ORG)
Date: 03/23/98


Hey all,

After hearing discussion on removing color codes from input, and also
after having experienced the very thing many of you referred to, I went
ahead and did it for easy_color 2.2 (or whatever). All I remove is the &
codes since few people, if anyone, know them anyway. If you see them being
used, removing them as well is just adding a simple else statement :)

I know this isn't the best way to do it, but it works fine :)
Here it is:
Modify command_interpreter in interpreter.c
At the top of the function add this:
int len; /* For determining the length of argument */

Add this immediately after it removes the hide bit.

  len = strlen(argument);

  if (GET_LEVEL(ch) < LVL_IMPL) {
    /* Strip colors */
    *buf2 = '\0';
    for (i = 0; i < len; i++) {
      if (argument[i] == '&') {
        i += 2;  /* So it will ignore the letter after the AND too */
      } else
        sprintf(buf4, "%s%c", buf4, argument[j]);
    }
    sprintf(argument, "%s", buf4);
  }

/* Notes:
 * This makes the '&' an impossible char for a player to send to the mud.
 * if this is unacceptable to you, then you can have the '&' only be
 * printed if it follows another '&' or you could even have '&&' be
 * replaced by the word ' and '.
 * That way people can do stuff like mike&&I to shortcut: Mike and I.
 * It's up to you :)
 *
 * Rasdan
 */
                                  /   \
        _                 )      ((   ))     (
       (@)               /|\      ))_((     /|\                 _
       |-|`\            / | \    (/\|/\)   / | \               (@)
       | | ------------/--|-voV---\`|'/--Vov-|--\--------------|-|
       |-|                  '^`   (o o)  '^`                   | |
       | |  James C. Thomas Jr.   `\Y/'  Founder of Finality   |-|
       |-|            rasdan@finality.drachen.com              | |
       | |             finality.drachen.com 4000               |-|
       |_|_____________________________________________________| |
       (@)       l   /\ /         ( (       \ /\   l         `\|-|
                 l /   V           \ \       V   \ l           (@)
                 l/                _) )_          \I
                                   `\ /'
                                     `


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



This archive was generated by hypermail 2b30 : 12/15/00 PST