diff -c src/act_comm.c ../SmaugFUSS.mxp/src/act_comm.c *** src/act_comm.c 2003-07-31 13:17:28.000000000 +1000 --- ../SmaugFUSS.mxp/src/act_comm.c 2004-02-01 15:26:46.000000000 +1100 *************** *** 1259,1270 **** knows_language(ch, ch->speaking, victim)); if ( speakswell < 85 ) ! act( AT_TELL, "$n tells you '$t'", ch, translate(speakswell, argument, lang_names[speaking]), victim, TO_VICT ); else ! act( AT_TELL, "$n tells you '$t'", ch, argument, victim, TO_VICT ); } else ! act( AT_TELL, "$n tells you '$t'", ch, argument, victim, TO_VICT ); MOBtrigger = TRUE; --- 1259,1273 ---- knows_language(ch, ch->speaking, victim)); if ( speakswell < 85 ) ! act( AT_TELL, MXPTAG ("player $n") "$n" MXPTAG ("/player") ! " tells you '$t'", ch, translate(speakswell, argument, lang_names[speaking]), victim, TO_VICT ); else ! act( AT_TELL, MXPTAG ("player $n") "$n" MXPTAG ("/player") ! " tells you '$t'", ch, argument, victim, TO_VICT ); } else ! act( AT_TELL, MXPTAG ("player $n") "$n" MXPTAG ("/player") ! " tells you '$t'", ch, argument, victim, TO_VICT ); MOBtrigger = TRUE; diff -c src/act_info.c ../SmaugFUSS.mxp/src/act_info.c *** src/act_info.c 2003-11-14 09:28:36.000000000 +1100 --- ../SmaugFUSS.mxp/src/act_info.c 2004-02-01 15:38:33.000000000 +1100 *************** *** 246,262 **** * Show a list to a character. * Can coalesce duplicated items. */ ! void show_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, bool fShort, bool fShowNothing ) { char **prgpstrShow; int *prgnShow; int *pitShow; char *pstrShow; OBJ_DATA *obj; int nShow; int iShow; int count, offcount, tmp, ms, cnt; bool fCombine; if ( !ch->desc ) return; --- 246,267 ---- * Show a list to a character. * Can coalesce duplicated items. */ ! void show_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, bool fShort, bool fShowNothing, const int iDefaultAction ) { char **prgpstrShow; + char **prgpstrName; /* for MXP */ + char **prgpstrShortName; /* for MXP */ int *prgnShow; int *pitShow; char *pstrShow; + char *pstrName; /* for MXP */ + char *pstrShortName; /* for MXP */ OBJ_DATA *obj; int nShow; int iShow; int count, offcount, tmp, ms, cnt; bool fCombine; + char * pAction = NULL; if ( !ch->desc ) return; *************** *** 275,280 **** --- 280,296 ---- } return; } + + /* work out which MXP tag to use */ + + switch (iDefaultAction) + { + case eItemGet: pAction = "Get"; break; /* item on ground */ + case eItemDrop: pAction = "Drop"; break; /* item in inventory */ + case eItemBid: pAction = "Bid"; break; /* auction item */ + + } /* end of switch on action */ + /* * Alloc space for output lines. */ *************** *** 313,318 **** --- 329,336 ---- } CREATE( prgpstrShow, char*, count + ((offcount > 0) ? offcount : 0) ); + CREATE( prgpstrName, char*, count + ((offcount > 0) ? offcount : 0) ); + CREATE( prgpstrShortName, char*, count + ((offcount > 0) ? offcount : 0) ); CREATE( prgnShow, int, count + ((offcount > 0) ? offcount : 0) ); CREATE( pitShow, int, count + ((offcount > 0) ? offcount : 0) ); nShow = 0; *************** *** 329,334 **** --- 347,354 ---- if ( tmp > 0 && number_bits(1) == 0 ) { prgpstrShow [nShow] = str_dup( hallucinated_object(ms, fShort) ); + prgpstrName [nShow] = str_dup( hallucinated_object(ms, TRUE) ); + prgpstrShortName [nShow] = str_dup( hallucinated_object(ms, TRUE) ); prgnShow [nShow] = 1; pitShow [nShow] = number_range( ITEM_LIGHT, ITEM_BOOK ); nShow++; *************** *** 339,344 **** --- 359,366 ---- && (obj->item_type != ITEM_TRAP || IS_AFFECTED(ch, AFF_DETECTTRAPS) ) ) { pstrShow = format_obj_to_char( obj, ch, fShort ); + pstrName = obj->name; + pstrShortName = obj->short_descr; fCombine = FALSE; if ( IS_NPC(ch) || xIS_SET(ch->act, PLR_COMBINE) ) *************** *** 365,370 **** --- 387,394 ---- if ( !fCombine ) { prgpstrShow [nShow] = str_dup( pstrShow ); + prgpstrName [nShow] = str_dup( pstrName ); + prgpstrShortName [nShow] = str_dup( pstrShortName ); prgnShow [nShow] = obj->count; nShow++; } *************** *** 376,381 **** --- 400,407 ---- for ( x = 0; x < tmp; x++ ) { prgpstrShow [nShow] = str_dup( hallucinated_object(ms, fShort) ); + prgpstrName [nShow] = str_dup( hallucinated_object(ms, TRUE) ); + prgpstrShortName [nShow] = str_dup( hallucinated_object(ms, TRUE) ); prgnShow [nShow] = 1; pitShow [nShow] = number_range( ITEM_LIGHT, ITEM_BOOK ); nShow++; *************** *** 417,423 **** --- 443,453 ---- } if ( fShowNothing ) send_to_char( " ", ch ); + if (pAction) + ch_printf (ch, MXPTAG ("%s '%s' '%s'"), pAction, prgpstrName[iShow], prgpstrShortName[iShow]); send_to_char( prgpstrShow[iShow], ch ); + if (pAction) + ch_printf (ch, MXPTAG ("/%s"), pAction); /* if ( IS_NPC(ch) || xIS_SET(ch->act, PLR_COMBINE) ) */ { if ( prgnShow[iShow] != 1 ) *************** *** 426,431 **** --- 456,463 ---- send_to_char( "\n\r", ch ); DISPOSE( prgpstrShow[iShow] ); + DISPOSE( prgpstrName[iShow] ); + DISPOSE( prgpstrShortName[iShow] ); } if ( fShowNothing && nShow == 0 ) *************** *** 440,445 **** --- 472,479 ---- * Clean up. */ DISPOSE( prgpstrShow ); + DISPOSE( prgpstrName ); + DISPOSE( prgpstrShortName ); DISPOSE( prgnShow ); DISPOSE( pitShow ); return; *************** *** 830,836 **** { ch_printf( ch, "\n\rYou peek at %s inventory:\n\r", victim->sex == 1 ? "his" : victim->sex == 2 ? "her" : "its" ); ! show_list_to_char( victim->first_carrying, ch, TRUE, TRUE ); learn_from_success( ch, gsn_peek ); } else --- 864,870 ---- { ch_printf( ch, "\n\rYou peek at %s inventory:\n\r", victim->sex == 1 ? "his" : victim->sex == 2 ? "her" : "its" ); ! show_list_to_char( victim->first_carrying, ch, TRUE, TRUE, eItemNothing ); learn_from_success( ch, gsn_peek ); } else *************** *** 963,969 **** --- 997,1007 ---- if ( arg1[0] == '\0' || ( !IS_NPC(ch) && !xIS_SET(ch->act, PLR_BRIEF) ) ) + { + send_to_char( MXPTAG ("rdesc"), ch); send_to_char( ch->in_room->description, ch ); + send_to_char( MXPTAG ("/rdesc"), ch); + } if ( !IS_NPC(ch) && xIS_SET(ch->act, PLR_AUTOMAP) ) /* maps */ { *************** *** 977,983 **** do_exits( ch, "auto" ); ! show_list_to_char( ch->in_room->first_content, ch, FALSE, FALSE ); show_char_to_char( ch->in_room->first_person, ch ); return; } --- 1015,1021 ---- do_exits( ch, "auto" ); ! show_list_to_char( ch->in_room->first_content, ch, FALSE, FALSE, eItemGet ); show_char_to_char( ch->in_room->first_person, ch ); return; } *************** *** 1014,1020 **** act( AT_PLAIN, "$n lifts $p and looks beneath it:", ch, obj, NULL, TO_ROOM ); obj->count = count; if ( IS_OBJ_STAT( obj, ITEM_COVERING ) ) ! show_list_to_char( obj->first_content, ch, TRUE, TRUE ); else send_to_char( "Nothing.\n\r", ch ); if( EXA_prog_trigger ) oprog_examine_trigger( ch, obj ); --- 1052,1058 ---- act( AT_PLAIN, "$n lifts $p and looks beneath it:", ch, obj, NULL, TO_ROOM ); obj->count = count; if ( IS_OBJ_STAT( obj, ITEM_COVERING ) ) ! show_list_to_char( obj->first_content, ch, TRUE, TRUE, eItemNothing ); else send_to_char( "Nothing.\n\r", ch ); if( EXA_prog_trigger ) oprog_examine_trigger( ch, obj ); *************** *** 1105,1111 **** else act( AT_PLAIN, "$p holds:", ch, obj, NULL, TO_CHAR ); obj->count = count; ! show_list_to_char( obj->first_content, ch, TRUE, TRUE ); if( EXA_prog_trigger ) oprog_examine_trigger( ch, obj ); break; } --- 1143,1149 ---- else act( AT_PLAIN, "$p holds:", ch, obj, NULL, TO_CHAR ); obj->count = count; ! show_list_to_char( obj->first_content, ch, TRUE, TRUE, eItemNothing ); if( EXA_prog_trigger ) oprog_examine_trigger( ch, obj ); break; } *************** *** 1662,1667 **** --- 1700,1706 ---- EXIT_DATA *pexit; bool found; bool fAuto; + int spaces; set_char_color( AT_EXITS, ch ); buf[0] = '\0'; *************** *** 1685,1696 **** if ( fAuto ) { strcat( buf, " " ); strcat( buf, dir_name[pexit->vdir] ); } else { ! sprintf( buf + strlen(buf), "%-5s - %s\n\r", capitalize( dir_name[pexit->vdir] ), room_is_dark( pexit->to_room ) ? "Too dark to tell" : pexit->to_room->name --- 1724,1745 ---- if ( fAuto ) { strcat( buf, " " ); + strcat (buf, MXPTAG ("Ex")); strcat( buf, dir_name[pexit->vdir] ); + strcat (buf, MXPTAG ("/Ex")); } else { ! /* I don't want to underline spaces, so I'll calculate the number we need */ ! spaces = 5 - strlen (dir_name[pexit->vdir]); ! if (spaces < 0) ! spaces = 0; ! sprintf( buf + strlen(buf), "%s%s%s%*s - %s\n\r", ! MXPTAG ("Ex"), capitalize( dir_name[pexit->vdir] ), + MXPTAG ("/Ex"), + spaces, /* number of spaces */ + "", room_is_dark( pexit->to_room ) ? "Too dark to tell" : pexit->to_room->name *************** *** 2723,2729 **** sprintf( invis_str, "(%d) ", wch->pcdata->wizinvis ); else invis_str[0] = '\0'; ! sprintf( buf, "%*s%-15s %s%s%s%s%s%s%s%s.%s%s%s\n\r", (fGroup ? whogr->indent : 0), "", class, invis_str, --- 2772,2780 ---- sprintf( invis_str, "(%d) ", wch->pcdata->wizinvis ); else invis_str[0] = '\0'; ! sprintf( buf, "%*s%-15s %s%s%s%s%s%s" ! MXPTAG ("player '%s'") "%s" MXPTAG ("/player") ! "%s.%s%s%s\n\r", (fGroup ? whogr->indent : 0), "", class, invis_str, *************** *** 2732,2737 **** --- 2783,2789 ---- xIS_SET(wch->act, PLR_ATTACKER) ? "(ATTACKER) " : "", xIS_SET(wch->act, PLR_KILLER) ? "(KILLER) " : "", xIS_SET(wch->act, PLR_THIEF) ? "(THIEF) " : "", + wch->name, char_name, wch->pcdata->title, extra_title, diff -c src/act_obj.c ../SmaugFUSS.mxp/src/act_obj.c *** src/act_obj.c 2003-04-03 14:34:54.000000000 +1000 --- ../SmaugFUSS.mxp/src/act_obj.c 2004-02-01 15:26:46.000000000 +1100 *************** *** 30,36 **** */ void show_list_to_char args( ( OBJ_DATA *list, CHAR_DATA *ch, ! bool fShort, bool fShowNothing ) ); void write_corpses args( ( CHAR_DATA *ch, char *name, OBJ_DATA *objrem ) ); /* --- 30,36 ---- */ void show_list_to_char args( ( OBJ_DATA *list, CHAR_DATA *ch, ! bool fShort, bool fShowNothing, const int iDefaultAction ) ); void write_corpses args( ( CHAR_DATA *ch, char *name, OBJ_DATA *objrem ) ); /* *************** *** 2689,2695 **** { set_char_color( AT_OBJECT, ch ); send_to_char( "Contents:\n\r", ch ); ! show_list_to_char( obj->first_content, ch, TRUE, FALSE ); } if (IS_IMMORTAL(ch)) --- 2689,2695 ---- { set_char_color( AT_OBJECT, ch ); send_to_char( "Contents:\n\r", ch ); ! show_list_to_char( obj->first_content, ch, TRUE, FALSE, eItemBid ); } if (IS_IMMORTAL(ch)) diff -c src/color.c ../SmaugFUSS.mxp/src/color.c *** src/color.c 2004-01-15 06:50:39.000000000 +1100 --- ../SmaugFUSS.mxp/src/color.c 2004-02-01 15:41:29.000000000 +1100 *************** *** 62,67 **** --- 62,70 ---- #include #include "mud.h" + int count_mxp_tags (const int bMXP, const char *txt, int length); + void convert_mxp_tags (const int bMXP, char * dest, const char *src, int length); + char * const pc_displays[MAX_COLORS] = { "black", "dred", "dgreen", "orange", *************** *** 998,1003 **** --- 1001,1008 ---- void write_to_pager( DESCRIPTOR_DATA *d, const char *txt, int length ) { int pageroffset; /* Pager fix by thoric */ + int origlength; + if( length <= 0 ) length = strlen( txt ); *************** *** 1005,1010 **** --- 1010,1020 ---- if( length == 0 ) return; + origlength = length; + /* work out how much we need to expand/contract it */ + length += count_mxp_tags (d->mxp, txt, length); + + if( !d->pagebuf ) { d->pagesize = MAX_STRING_LENGTH; *************** *** 1038,1044 **** RECREATE( d->pagebuf, char, d->pagesize ); } d->pagepoint = d->pagebuf + pageroffset; /* pager fix (goofup fixed 08/21/97) */ ! strncpy( d->pagebuf + d->pagetop, txt, length ); /* Leave this one alone! BAD THINGS(TM) will happen if you don't! */ d->pagetop += length; d->pagebuf[d->pagetop] = '\0'; return; --- 1048,1055 ---- RECREATE( d->pagebuf, char, d->pagesize ); } d->pagepoint = d->pagebuf + pageroffset; /* pager fix (goofup fixed 08/21/97) */ ! // strncpy( d->pagebuf + d->pagetop, txt, length ); /* Leave this one alone! BAD THINGS(TM) will happen if you don't! */ ! convert_mxp_tags (d->mxp, d->pagebuf + d->pagetop, txt, origlength ); d->pagetop += length; d->pagebuf[d->pagetop] = '\0'; return; diff -c src/comm.c ../SmaugFUSS.mxp/src/comm.c *** src/comm.c 2004-01-15 07:01:22.000000000 +1100 --- ../SmaugFUSS.mxp/src/comm.c 2004-02-01 15:40:58.000000000 +1100 *************** *** 30,35 **** --- 30,36 ---- #endif #include "mud.h" + /* * Socket and TCP/IP stuff. */ *************** *** 44,49 **** --- 45,51 ---- #define TELOPT_ECHO '\x01' #define GA '\xF9' + #define SE '\xF0' #define SB '\xFA' #define WILL '\xFB' #define WONT '\xFC' *************** *** 63,75 **** #define closesocket close #endif #ifdef sun int gethostname ( char *name, int namelen ); #endif ! const char echo_off_str [] = { IAC, WILL, TELOPT_ECHO, '\0' }; ! const char echo_on_str [] = { IAC, WONT, TELOPT_ECHO, '\0' }; ! const char go_ahead_str [] = { IAC, GA, '\0' }; void auth_maxdesc args( ( int *md, fd_set *ins, fd_set *outs, fd_set *excs ) ); --- 65,84 ---- #define closesocket close #endif + #define TELOPT_MXP '\x5B' + #ifdef sun int gethostname ( char *name, int namelen ); #endif ! const unsigned char echo_off_str [] = { IAC, WILL, TELOPT_ECHO, '\0' }; ! const unsigned char echo_on_str [] = { IAC, WONT, TELOPT_ECHO, '\0' }; ! const unsigned char go_ahead_str [] = { IAC, GA, '\0' }; ! const unsigned char will_mxp_str [] = { IAC, WILL, TELOPT_MXP, '\0' }; ! const unsigned char start_mxp_str [] = { IAC, SB, TELOPT_MXP, IAC, SE, '\0' }; ! const unsigned char do_mxp_str [] = { IAC, DO, TELOPT_MXP, '\0' }; ! const unsigned char dont_mxp_str [] = { IAC, DONT, TELOPT_MXP, '\0' }; ! void auth_maxdesc args( ( int *md, fd_set *ins, fd_set *outs, fd_set *excs ) ); *************** *** 325,330 **** --- 334,402 ---- return 0; } + /* set up MXP */ + void turn_on_mxp (DESCRIPTOR_DATA *d) + { + d->mxp = TRUE; /* turn it on now */ + write_to_buffer( d, start_mxp_str, 0 ); + write_to_buffer( d, MXPMODE (6), 0 ); /* permanent secure mode */ + write_to_buffer( d, MXPTAG ("!-- Set up MXP elements --"), 0); + /* Exit tag */ + write_to_buffer( d, MXPTAG ("!ELEMENT Ex '' FLAG=RoomExit"), 0); + /* Room description tag */ + write_to_buffer( d, MXPTAG ("!ELEMENT rdesc '

' FLAG=RoomDesc"), 0); + /* Get an item tag (for things on the ground) */ + write_to_buffer( d, MXPTAG + ("!ELEMENT Get \"\" ATT='name desc'"), + 0); + /* Drop an item tag (for things in the inventory) */ + write_to_buffer( d, MXPTAG + ("!ELEMENT Drop \"\" ATT='name desc'"), + 0); + /* Bid an item tag (for things in the auction) */ + write_to_buffer( d, MXPTAG + ("!ELEMENT Bid \"\" " + "ATT='name desc'"), + 0); + /* List an item tag (for things in a shop) */ + write_to_buffer( d, MXPTAG + ("!ELEMENT List \"\" " + "ATT='name desc'"), + 0); + /* Player tag (for who lists, tells etc.) */ + write_to_buffer( d, MXPTAG + ("!ELEMENT Player \"\" " + "ATT='name'"), + 0); + } /* end of turn_on_mxp */ + int init_socket( int port ) { *************** *** 528,533 **** --- 600,606 ---- struct timeval last_time; char cmdline[MAX_INPUT_LENGTH]; DESCRIPTOR_DATA *d; + /* time_t last_check = 0; */ #ifndef WIN32 *************** *** 615,620 **** --- 688,694 ---- } read_from_buffer( d ); + if ( d->incomm[0] != '\0' ) { d->fcommand = TRUE; *************** *** 823,828 **** --- 897,903 ---- dnew->user = STRALLOC("(unknown)"); dnew->newstate = 0; dnew->prevcolor = 0x07; + dnew->mxp = FALSE; /* NJG - initially MXP is off */ CREATE( dnew->outbuf, char, dnew->outsize ); *************** *** 1101,1106 **** --- 1176,1182 ---- void read_from_buffer( DESCRIPTOR_DATA *d ) { int i, j, k; + unsigned char * p; /* * Hold horses if pending command already. *************** *** 1108,1113 **** --- 1184,1214 ---- if ( d->incomm[0] != '\0' ) return; + /* + + Look for incoming telnet negotiation + */ + + + for (p = d->inbuf; *p; p++) + if (*p == IAC) + { + if (memcmp (p, do_mxp_str, strlen (do_mxp_str)) == 0) + { + turn_on_mxp (d); + /* remove string from input buffer */ + memmove (p, &p [strlen (do_mxp_str)], strlen (&p [strlen (do_mxp_str)]) + 1); + p--; /* adjust to allow for discarded bytes */ + } /* end of turning on MXP */ + else if (memcmp (p, dont_mxp_str, strlen (dont_mxp_str)) == 0) + { + d->mxp = FALSE; + /* remove string from input buffer */ + memmove (p, &p [strlen (dont_mxp_str)], strlen (&p [strlen (dont_mxp_str)]) + 1); + p--; /* adjust to allow for discarded bytes */ + } /* end of turning off MXP */ + } /* end of finding an IAC */ + /* * Look for at least one new line. */ *************** *** 1295,1307 **** --- 1396,1586 ---- } } + /* + + MXP code by Nick Gammon. + + See: http://www.gammon.com.au + Queries: http://www.gammon.com.au/forum/ + + * Count number of mxp tags need converting + * ie. < becomes < + * > becomes > + * & becomes & + */ + + int count_mxp_tags (const int bMXP, const char *txt, int length) + { + char c; + const char * p; + int count; + int bInTag = FALSE; + int bInEntity = FALSE; + + for (p = txt, count = 0; + length > 0; + p++, length--) + { + c = *p; + + if (bInTag) /* in a tag, eg. */ + { + if (!bMXP) + count--; /* not output if not MXP */ + if (c == MXP_ENDc) + bInTag = FALSE; + } /* end of being inside a tag */ + else if (bInEntity) /* in a tag, eg. */ + { + if (!bMXP) + count--; /* not output if not MXP */ + if (c == ';') + bInEntity = FALSE; + } /* end of being inside a tag */ + else switch (c) + { + + case MXP_BEGc: + bInTag = TRUE; + if (!bMXP) + count--; /* not output if not MXP */ + break; + + case MXP_ENDc: /* shouldn't get this case */ + if (!bMXP) + count--; /* not output if not MXP */ + break; + + case MXP_AMPc: + bInEntity = TRUE; + if (!bMXP) + count--; /* not output if not MXP */ + break; + + default: + if (bMXP) + { + switch (c) + { + case '<': /* < becomes < */ + case '>': /* > becomes > */ + count += 3; + break; + + case '&': + count += 4; /* & becomes & */ + break; + + case '"': /* " becomes " */ + count += 5; + break; + } /* end of inner switch */ + } /* end of MXP enabled */ + } /* end of switch on character */ + + } /* end of counting special characters */ + + return count; + } /* end of count_mxp_tags */ + + void convert_mxp_tags (const int bMXP, char * dest, const char *src, int length) + { + char c; + const char * ps; + char * pd; + int bInTag = FALSE; + int bInEntity = FALSE; + + for (ps = src, pd = dest; + length > 0; + ps++, length--) + { + c = *ps; + if (bInTag) /* in a tag, eg. */ + { + if (c == MXP_ENDc) + { + bInTag = FALSE; + if (bMXP) + *pd++ = '>'; + } + else if (bMXP) + *pd++ = c; /* copy tag only in MXP mode */ + } /* end of being inside a tag */ + else if (bInEntity) /* in a tag, eg. */ + { + if (bMXP) + *pd++ = c; /* copy tag only in MXP mode */ + if (c == ';') + bInEntity = FALSE; + } /* end of being inside a tag */ + else switch (c) + { + case MXP_BEGc: + bInTag = TRUE; + if (bMXP) + *pd++ = '<'; + break; + + case MXP_ENDc: /* shouldn't get this case */ + if (bMXP) + *pd++ = '>'; + break; + + case MXP_AMPc: + bInEntity = TRUE; + if (bMXP) + *pd++ = '&'; + break; + + default: + if (bMXP) + { + switch (c) + { + case '<': + memcpy (pd, "<", 4); + pd += 4; + break; + + case '>': + memcpy (pd, ">", 4); + pd += 4; + break; + + case '&': + memcpy (pd, "&", 5); + pd += 5; + break; + + case '"': + memcpy (pd, """, 6); + pd += 6; + break; + + default: + *pd++ = c; + break; /* end of default */ + + } /* end of inner switch */ + } + else + *pd++ = c; /* not MXP - just copy character */ + break; + + } /* end of switch on character */ + + } /* end of converting special characters */ + } /* end of convert_mxp_tags */ /* * Append onto an output buffer. */ void write_to_buffer( DESCRIPTOR_DATA *d, const char *txt, int length ) { + int origlength; + if ( !d ) { bug( "Write_to_buffer: NULL descriptor" ); *************** *** 1327,1332 **** --- 1606,1615 ---- length = strlen(txt); } */ + origlength = length; + + /* work out how much we need to expand/contract it */ + length += count_mxp_tags (d->mxp, txt, length); /* * Initial \n\r if needed. *************** *** 1359,1365 **** /* * Copy. */ ! strncpy( d->outbuf + d->outtop, txt, length ); d->outtop += length; d->outbuf[d->outtop] = '\0'; return; --- 1642,1648 ---- /* * Copy. */ ! convert_mxp_tags (d->mxp, d->outbuf + d->outtop, txt, origlength ); d->outtop += length; d->outbuf[d->outtop] = '\0'; return; *************** *** 1443,1448 **** --- 1726,1732 ---- d->connected = CON_PRESS_ENTER; } + /* * Deal with sockets that haven't logged in yet. */ *************** *** 1594,1600 **** --- 1878,1887 ---- return; } + /* telnet negotiation to see if they support MXP */ + write_to_buffer( d, will_mxp_str, 0 ); + chk = check_reconnect( d, argument, FALSE ); if ( chk == BERR ) return; *************** *** 2856,2861 **** --- 3143,3156 ---- } else prompt = ch->pcdata->prompt; + + /* reset MXP to default operation */ + if (d->mxp) + { + strcpy (pbuf, ESC "[3z"); + pbuf += 4; + } + if ( ansi ) { strcpy( pbuf, ANSI_RESET ); diff -c src/fight.c ../SmaugFUSS.mxp/src/fight.c *** src/fight.c 2002-12-30 14:36:54.000000000 +1100 --- ../SmaugFUSS.mxp/src/fight.c 2004-02-01 15:26:46.000000000 +1100 *************** *** 4255,4257 **** --- 4255,4258 ---- raw_kill( ch, victim ); return; } + diff -c src/interp.c ../SmaugFUSS.mxp/src/interp.c *** src/interp.c 2003-07-31 13:22:55.000000000 +1000 --- ../SmaugFUSS.mxp/src/interp.c 2004-02-01 15:26:46.000000000 +1100 *************** *** 19,24 **** --- 19,25 ---- #include #include #include + #define __retms__ #include #include "mud.h" diff -c src/Makefile ../SmaugFUSS.mxp/src/Makefile *** src/Makefile 2003-11-14 09:28:39.000000000 +1100 --- ../SmaugFUSS.mxp/src/Makefile 2004-02-01 15:34:27.000000000 +1100 *************** *** 22,28 **** #your core files may not be as much of a benefit if you do. #OPT_FLAG = -finline-functions -funroll-loops -fdefer-pop -fstrength-reduce ! C_FLAGS = $(OPT_FLAG) -O -g2 -Wall $(PROF) $(NOCRYPT) $(SOLARIS_FLAG) L_FLAGS = $(OPT_FLAG) $(PROF) $(SOLARIS_LINK) $(NEED_CRYPT) O_FILES = act_comm.o act_info.o act_move.o act_obj.o act_wiz.o boards.o \ --- 22,28 ---- #your core files may not be as much of a benefit if you do. #OPT_FLAG = -finline-functions -funroll-loops -fdefer-pop -fstrength-reduce ! C_FLAGS = $(OPT_FLAG) -O -g3 -Wall $(PROF) $(NOCRYPT) $(SOLARIS_FLAG) L_FLAGS = $(OPT_FLAG) $(PROF) $(SOLARIS_LINK) $(NEED_CRYPT) O_FILES = act_comm.o act_info.o act_move.o act_obj.o act_wiz.o boards.o \ diff -c src/mud.h ../SmaugFUSS.mxp/src/mud.h *** src/mud.h 2004-01-15 06:50:03.000000000 +1100 --- ../SmaugFUSS.mxp/src/mud.h 2004-02-01 15:26:46.000000000 +1100 *************** *** 41,46 **** --- 41,47 ---- #include #endif + #define NOCRYPT typedef int ch_ret; typedef int obj_ret; *************** *** 737,742 **** --- 738,744 ---- sh_int idle; sh_int lines; sh_int scrlen; + sh_int mxp; bool fcommand; char inbuf [MAX_INBUF_SIZE]; char incomm [MAX_INPUT_LENGTH]; *************** *** 4376,4382 **** char * format_obj_to_char args( ( OBJ_DATA *obj, CHAR_DATA *ch, bool fShort ) ); void show_list_to_char args( ( OBJ_DATA *list, CHAR_DATA *ch, ! bool fShort, bool fShowNothing ) ); bool is_ignoring args( (CHAR_DATA *ch, CHAR_DATA *ign_ch) ); void show_race_line args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); --- 4378,4384 ---- char * format_obj_to_char args( ( OBJ_DATA *obj, CHAR_DATA *ch, bool fShort ) ); void show_list_to_char args( ( OBJ_DATA *list, CHAR_DATA *ch, ! bool fShort, bool fShowNothing, const int iDefaultAction ) ); bool is_ignoring args( (CHAR_DATA *ch, CHAR_DATA *ign_ch) ); void show_race_line args( ( CHAR_DATA *ch, CHAR_DATA *victim ) ); *************** *** 5144,5149 **** --- 5146,5199 ---- #define LV_TOGGLE_BIT(vector, index) \ (*(vector + index/CHAR_SIZE) ^= (1 << index%CHAR_SIZE)) + + + /* mxp stuff - added by Nick Gammon - 18 June 2001 */ + + /* + To simply using MXP we'll use special tags where we want to use MXP tags + and then change them to <, > and & at the last moment. + + eg. MXP_BEG "send" MXP_END becomes: + MXP_AMP "version;" becomes: &version; + + */ + + /* strings */ + #define MXP_BEG "\x03" /* becomes < */ + #define MXP_END "\x04" /* becomes > */ + #define MXP_AMP "\x05" /* becomes & */ + + /* characters */ + #define MXP_BEGc '\x03' /* becomes < */ + #define MXP_ENDc '\x04' /* becomes > */ + #define MXP_AMPc '\x05' /* becomes & */ + + // constructs an MXP tag with < and > around it + #define MXPTAG(arg) MXP_BEG arg MXP_END + + #define ESC "\x1B" /* esc character */ + + #define MXPMODE(arg) ESC "[" #arg "z" + + /* flags for show_list_to_char */ + + enum { + eItemNothing, /* item is not readily accessible */ + eItemGet, /* item on ground */ + eItemDrop, /* item in inventory */ + eItemBid /* auction item */ + }; + + #define MXP_open 0 /* only MXP commands in the "open" category are allowed. */ + #define MXP_secure 1 /* all tags and commands in MXP are allowed within the line. */ + #define MXP_locked 2 /* no MXP or HTML commands are allowed in the line. The line is not parsed for any tags at all. */ + #define MXP_reset 3 /* close all open tags */ + #define MXP_secure_once 4 /* next tag is secure only */ + #define MXP_perm_open 5 /* open mode until mode change */ + #define MXP_perm_secure 6 /* secure mode until mode change */ + #define MXP_perm_locked 7 /* locked mode until mode change */ + #ifdef WIN32 void gettimeofday(struct timeval *tv, struct timezone *tz); diff -c src/player.c ../SmaugFUSS.mxp/src/player.c *** src/player.c 2002-12-30 15:02:07.000000000 +1100 --- ../SmaugFUSS.mxp/src/player.c 2004-02-01 15:26:46.000000000 +1100 *************** *** 1397,1403 **** { set_char_color( AT_RED, ch ); send_to_char( "You are carrying:\n\r", ch ); ! show_list_to_char( ch->first_carrying, ch, TRUE, TRUE ); return; } --- 1397,1403 ---- { set_char_color( AT_RED, ch ); send_to_char( "You are carrying:\n\r", ch ); ! show_list_to_char( ch->first_carrying, ch, TRUE, TRUE, eItemDrop ); return; } diff -c src/shops.c ../SmaugFUSS.mxp/src/shops.c *** src/shops.c 2003-04-04 00:42:18.000000000 +1000 --- ../SmaugFUSS.mxp/src/shops.c 2004-02-01 15:26:46.000000000 +1100 *************** *** 807,814 **** lower = -1; } ! pager_printf( ch, "[%2d %5d] %s.\n\r", ! obj->level, cost, capitalize( obj->short_descr ) ); } } --- 807,819 ---- lower = -1; } ! pager_printf( ch, "[%2d %5d] " ! MXPTAG ("list '%s' '%s'") ! "%s" ! MXPTAG ("/list") ".\n\r", ! obj->level, cost, obj->name, ! obj->short_descr, ! capitalize( obj->short_descr ) ); } } diff -c src/skills.c ../SmaugFUSS.mxp/src/skills.c *** src/skills.c 2002-12-30 14:44:15.000000000 +1100 --- ../SmaugFUSS.mxp/src/skills.c 2004-02-01 15:26:46.000000000 +1100 *************** *** 59,65 **** void show_char_to_char( CHAR_DATA *list, CHAR_DATA *ch ); void show_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, bool fShort, ! bool fShowN ); int ris_save( CHAR_DATA *ch, int chance, int ris ); bool check_illegal_psteal( CHAR_DATA *ch, CHAR_DATA *victim ); --- 59,65 ---- void show_char_to_char( CHAR_DATA *list, CHAR_DATA *ch ); void show_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, bool fShort, ! bool fShowN, const int iDefaultAction ); int ris_save( CHAR_DATA *ch, int chance, int ris ); bool check_illegal_psteal( CHAR_DATA *ch, CHAR_DATA *victim ); *************** *** 4523,4529 **** set_char_color( AT_RMNAME, ch ); send_to_char( ch->in_room->name, ch ); send_to_char( "\n\r", ch ); ! show_list_to_char( ch->in_room->first_content, ch, FALSE, FALSE ); show_char_to_char( ch->in_room->first_person, ch ); switch( ch->in_room->sector_type ) --- 4523,4529 ---- set_char_color( AT_RMNAME, ch ); send_to_char( ch->in_room->name, ch ); send_to_char( "\n\r", ch ); ! show_list_to_char( ch->in_room->first_content, ch, FALSE, FALSE, eItemNothing ); show_char_to_char( ch->in_room->first_person, ch ); switch( ch->in_room->sector_type )