# # Patch name: TrivStuff # Patch version: 8 # Author's name: Thorvald Natvig # Author's email: slicer@bimbo.hive.no # Version of PennMUSH: 1.7.2p14 # Date patch made: lør aug 15 02:19:54 CEST 1998 # Author is willing to support (yes/no): yes # Patch format: context diff # # # This is a contributed PennMUSH patch. Its use is subject to the # same restrictions found in PennMUSH's hdrs/copyrite.h file. # # No warranty is given for this patch. It is not necessarily going # to work on your system, with any version of PennMUSH other than # the one above, etc. # # If the author given above was willing to support the patch, you # should write to the author if you have any questions or problems. Do # *NOT* send email messages to Javelin or any PennMUSH mailing list about # this patch! # # Below this line is the author's description of the patch, # followed by the patch itself. If the patch is in context diff # format, you'll probably apply it by typing: patch < patchfile # in your top-level MUSH directory, unless instructed otherwise # below. # This header and patchfile is autogenerated - Patch Version 8 Patch comments (if any): *** ../clean/options.h.dist Fri Aug 14 17:49:38 1998 --- options.h.dist Tue Jul 21 22:58:07 1998 *************** *** 327,332 **** --- 327,344 ---- /* #define MAILER /* */ + /* This allows the &COLNAME attribute, which will be used instead of the + * name and can contain ansi and HTML colorcodes. + * Also defines the @CNAME command. + */ + /* #define USE_COLNAME /* */ + + /* This enables a master object, whose [oa]whatever will be appended to ALL + * objects. Like @adescribe, @omove etc etc. + */ + /* #define USE_MASTEROBJECT /* */ + + /*------------------------- Log Files ----------------------------*/ /* The main log is given on the command line, after the config file. *** ../clean/hdrs/atr_tab.h Fri Aug 14 17:49:43 1998 --- hdrs/atr_tab.h Tue Jul 21 22:58:07 1998 *************** *** 36,41 **** --- 36,44 ---- {(char *) "AUSE", AF_NOPROG, NULL, 0}, {(char *) "AWAY", AF_NOPROG, NULL, 0}, {(char *) "CHARGES", AF_NOPROG, NULL, 0}, + #ifdef USE_COLNAME + {(char *) "COLNAME", AF_NOPROG | AF_MDARK | AF_WIZARD | AF_PRIVATE, NULL, 0}, + #endif {(char *) "COMMENT", AF_NOPROG | AF_MDARK | AF_WIZARD, NULL, 0}, {(char *) "CONFORMAT", AF_NOPROG, NULL, 0}, {(char *) "COST", AF_NOPROG, NULL, 0}, *** ../clean/hdrs/conf.h Fri Aug 14 17:49:47 1998 --- hdrs/conf.h Tue Jul 21 22:58:07 1998 *************** *** 180,185 **** --- 180,188 ---- #endif int base_room; int use_dns; + #ifdef USE_MASTEROBJECT + int master_object; + #endif int haspower_restricted; int safer_ufun; char dump_warning_1min[256]; *************** *** 281,286 **** --- 284,292 ---- (Wizard(p) && (g->viewperms & CGP_WIZARD)) || \ (Hasprivs(p) && (g->viewperms & CGP_ADMIN))) + #ifdef USE_MASTEROBJECT + #define MASTER_OBJECT (options.master_object) + #endif #define DUMP_INTERVAL (options.dump_interval) #define DUMP_NOFORK_MESSAGE (options.dump_message) *** ../clean/hdrs/externs.h Fri Aug 14 17:49:50 1998 --- hdrs/externs.h Tue Jul 21 22:58:07 1998 *************** *** 418,423 **** --- 418,429 ---- void do_gensort _((char **s, int n, int sort_type)); + #ifdef USE_COLNAME + const char *colname _((dbref thing, int showzone)); + #else + #define colname(x,y) Name(x) + #endif + /* This is from utils.c, but put at the end because it confuses indent */ typedef Signal_t(*Sigfunc) _((int)); *** ../clean/hdrs/flags.h Fri Aug 14 17:49:51 1998 --- hdrs/flags.h Tue Jul 21 22:58:07 1998 *************** *** 161,166 **** --- 161,170 ---- #define ROOM_UNINSPECT 0x1000 /* Not inspected */ #endif + #ifdef USE_COLNAME + #define ROOM_SHOWZONE 0x4000000 + #endif + /*-------------------------------------------------------------------------- * Exit flags *** ../clean/src/command.c Fri Aug 14 17:50:08 1998 --- src/command.c Sat Aug 15 01:32:10 1998 *************** *** 82,87 **** --- 82,90 ---- #ifdef CHAT_SYSTEM {"@CLOCK", "JOIN SPEAK MOD SEE HIDE", cmd_clock, CMD_T_ANY | CMD_T_EQSPLIT, 0, 0, 0}, #endif + #ifdef USE_COLNAME + {"@CNAME", NULL, cmd_colname, CMD_T_ANY | CMD_T_EQSPLIT, 0, 0, 0}, + #endif {"@DBCK", NULL, cmd_dbck, CMD_T_ANY, WIZARD, 0, 0}, {"@DECOMPILE", "DB TF FLAGS ATTRIBS", cmd_decompile, CMD_T_ANY, 0, 0, 0}, {"@DESTROY", "OVERRIDE", cmd_destroy, CMD_T_ANY, 0, 0, 0}, *** ../clean/src/conf.c Fri Aug 14 17:50:11 1998 --- src/conf.c Sat Aug 15 01:32:10 1998 *************** *** 54,59 **** --- 54,62 ---- {"mud_name", cf_str, (int *) options.mud_name, 128, 0, "net"}, {"port", cf_int, &options.port, 32000, 0, "net"}, {"use_dns", cf_bool, &options.use_dns, 2, 0, "net"}, + #ifdef USE_MASTEROBJECT + {"master_object", cf_int, &options.master_object, 100000, 0, "cosmetic"}, + #endif {"ip_addr", cf_str, (int *) options.ip_addr, 64, 0, "net"}, {"input_database", cf_str, (int *) options.input_db, 256, 0, "files"}, {"output_database", cf_str, (int *) options.output_db, 256, 0, "files"}, *************** *** 488,493 **** --- 491,499 ---- options.warn_interval = 3600; #endif options.use_dns = 1; + #ifdef USE_MASTEROBJECT + options.master_object = 1; + #endif options.haspower_restricted = 0; options.safer_ufun = 1; strcpy(options.dump_warning_1min, "GAME: Database will be dumped in 1 minute."); *************** *** 905,908 **** --- 911,921 ---- #else notify(player, " Extended ANSI functions are not enabled."); #endif + + #ifdef USE_COLNAME + notify(player, " The COLNAME attribute is in use."); + #else + notify(player, " The COLNAME attribute is not in use."); + #endif + } *** ../clean/src/flags.c Fri Aug 14 17:50:22 1998 --- src/flags.c Sat Aug 15 01:32:08 1998 *************** *** 164,175 **** --- 164,179 ---- {"MONITOR", 'M', TYPE_ROOM, ROOM_LISTEN, F_ANY, F_ANY}, {"Z_TEL", 'Z', TYPE_ROOM, ROOM_Z_TEL, F_ANY, F_ANY}, {"NO_TEL", 'N', TYPE_ROOM, ROOM_NO_TEL, F_ANY, F_ANY}, + #ifdef USE_COLNAME + {"SHOWZONE", 's', TYPE_ROOM, ROOM_SHOWZONE, F_ANY, F_ANY}, + #endif #ifdef UNINSPECTED_FLAG {"UNINSPECTED", 'u', TYPE_ROOM, ROOM_UNINSPECT, F_ROYAL, F_ROYAL}, #endif {"CLOUDY", 'x', TYPE_EXIT, EXIT_CLOUDY, F_ANY, F_ANY}, + {"ACCESSED", '\0', NOTYPE, ACCESSED, F_INTERNAL | F_DARK, F_INTERNAL | F_DARK}, {"MARKED", '\0', NOTYPE, MARKED, F_INTERNAL | F_DARK, *************** *** 429,434 **** --- 433,443 ---- {"NO_T", "NO_TEL"}, {"Z_TE", "Z_TEL"}, {"Z_T", "Z_TEL"}, + #ifdef USE_COLNAME + {"SHOWZON", "SHOWZONE"}, + {"SHOWZO", "SHOWZONE"}, + {"SHOWZ", "SHOWZONE"}, + #endif #ifdef UNINSPECTED_FLAG {"UNINSPECT", "UNINSPECTED"}, {"UNINSPEC", "UNINSPECTED"}, *** ../clean/src/function.c Fri Aug 14 17:50:23 1998 --- src/function.c Sun Aug 2 19:06:43 1998 *************** *** 134,141 **** {"CON", fun_con, 1, 1, FN_REG}, {"CONN", fun_conn, 1, 1, FN_REG}, {"CONTROLS", fun_controls, 2, 2, FN_REG}, ! {"CONVSECS", fun_convsecs, 1, 1, FN_REG}, ! {"CONVTIME", fun_convtime, 1, 1, FN_REG}, {"COR", fun_cor, 2, INT_MAX, FN_NOPARSE}, {"CREATE", fun_create, 1, 2, FN_REG}, #ifdef CREATION_TIMES --- 134,141 ---- {"CON", fun_con, 1, 1, FN_REG}, {"CONN", fun_conn, 1, 1, FN_REG}, {"CONTROLS", fun_controls, 2, 2, FN_REG}, ! {"CONVSECS", fun_convsecs, 1, 2, FN_REG}, ! {"CONVTIME", fun_convtime, 1, 2, FN_REG}, {"COR", fun_cor, 2, INT_MAX, FN_NOPARSE}, {"CREATE", fun_create, 1, 2, FN_REG}, #ifdef CREATION_TIMES *************** *** 208,213 **** --- 208,215 ---- {"ISNUM", fun_isnum, 1, 1, FN_REG}, {"ISWORD", fun_isword, 1, 1, FN_REG}, {"ITER", fun_iter, 2, 4, FN_NOPARSE}, + {"IR", fun_ir, 1, 1, FN_REG}, + {"IV", fun_iv, 1, 1, FN_REG}, {"ITEMS", fun_items, 2, 2, FN_REG}, {"LAST", fun_last, 1, 2, FN_REG}, {"LATTR", fun_lattr, 1, 1, FN_REG}, *************** *** 336,342 **** {"T", fun_t, 1, 1, FN_REG}, {"TABLE", fun_table, 1, 5, FN_REG}, {"TEL", fun_tel, 2, 2, FN_REG}, ! {"TIME", fun_time, 0, 0, FN_REG}, {"TIMESTRING", fun_timestring, 1, 2, FN_REG}, {"TRIM", fun_trim, 1, 3, FN_REG}, {"TRUNC", fun_trunc, 1, 1, FN_REG}, --- 338,344 ---- {"T", fun_t, 1, 1, FN_REG}, {"TABLE", fun_table, 1, 5, FN_REG}, {"TEL", fun_tel, 2, 2, FN_REG}, ! {"TIME", fun_time, 0, 1, FN_REG}, {"TIMESTRING", fun_timestring, 1, 2, FN_REG}, {"TRIM", fun_trim, 1, 3, FN_REG}, {"TRUNC", fun_trunc, 1, 1, FN_REG}, *************** *** 386,391 **** --- 388,396 ---- {"SQRT", fun_sqrt, 1, 1, FN_REG}, {"TAN", fun_tan, 1, 1, FN_REG}, #endif /* FLOATING_POINTS */ + {"FORCE", fun_force, 2, 2, FN_REG}, + {"TRIGGER", fun_trigger, 1, 11, FN_REG}, + {"WAIT", fun_wait, 2, 2, FN_REG}, {"HTML", fun_html, 1, 1, FN_REG}, {"TAG", fun_tag, 1, INT_MAX, FN_REG}, {"ENDTAG", fun_endtag, 1, 1, FN_REG}, *** ../clean/src/funlist.c Fri Aug 14 17:50:25 1998 --- src/funlist.c Tue Jul 28 01:36:27 1998 *************** *** 64,74 **** } #ifdef CAN_NEWSTYLE ! static int ! list2arr(char *r[], int max, char *list, char sep) #else ! static int ! list2arr(r, max, list, sep) char *r[]; int max; char *list; --- 64,72 ---- } #ifdef CAN_NEWSTYLE ! static int list2arr(char *r[], int max, char *list, char sep) #else ! static int list2arr(r, max, list, sep) char *r[]; int max; char *list; *************** *** 89,99 **** } #ifdef CAN_NEWSTYLE ! static void ! arr2list(char *r[], int max, char *list, char **lp, char sep) #else ! static void ! arr2list(r, max, list, lp, sep) char *r[]; int max; char *list; --- 87,95 ---- } #ifdef CAN_NEWSTYLE ! static void arr2list(char *r[], int max, char *list, char **lp, char sep) #else ! static void arr2list(r, max, list, lp, sep) char *r[]; int max; char *list; *************** *** 114,121 **** **lp = '\0'; } ! static void ! swap(p, q) char **p; char **q; { --- 110,116 ---- **lp = '\0'; } ! static void swap(p, q) char **p; char **q; { *************** *** 477,484 **** arr2list(words, n, buff, bp, sep); } ! static int ! autodetect_list(ptrs, nptrs) char *ptrs[]; int nptrs; { --- 472,478 ---- arr2list(words, n, buff, bp, sep); } ! static int autodetect_list(ptrs, nptrs) char *ptrs[]; int nptrs; { *************** *** 532,539 **** return sort_type; } ! static int ! get_list_type(args, nargs, type_pos, ptrs, nptrs) char *args[]; int nargs; int type_pos; --- 526,532 ---- return sort_type; } ! static int get_list_type(args, nargs, type_pos, ptrs, nptrs) char *args[]; int nargs; int type_pos; *************** *** 559,566 **** return autodetect_list(ptrs, nptrs); } ! static int ! a_comp(s1, s2) const void *s1, *s2; { return strcmp(*(char **) s1, *(char **) s2); --- 552,558 ---- return autodetect_list(ptrs, nptrs); } ! static int a_comp(s1, s2) const void *s1, *s2; { return strcmp(*(char **) s1, *(char **) s2); *************** *** 572,579 **** int num; }; ! static int ! i_comp(s1, s2) const void *s1, *s2; { if (((i_rec *) s1)->num > ((i_rec *) s2)->num) --- 564,570 ---- int num; }; ! static int i_comp(s1, s2) const void *s1, *s2; { if (((i_rec *) s1)->num > ((i_rec *) s2)->num) *************** *** 590,597 **** NVAL num; }; ! static int ! f_comp(s1, s2) const void *s1, *s2; { if (((f_rec *) s1)->num > ((f_rec *) s2)->num) --- 581,587 ---- NVAL num; }; ! static int f_comp(s1, s2) const void *s1, *s2; { if (((f_rec *) s1)->num > ((f_rec *) s2)->num) *************** *** 606,613 **** static char ucomp_buff[BUFFER_LEN]; static PE_Info *ucomp_pe_info; ! static int ! u_comp(s1, s2) const void *s1, *s2; { char result[BUFFER_LEN], *rp; --- 596,602 ---- static char ucomp_buff[BUFFER_LEN]; static PE_Info *ucomp_pe_info; ! static int u_comp(s1, s2) const void *s1, *s2; { char result[BUFFER_LEN], *rp; *************** *** 634,641 **** return n; } ! void ! do_gensort(s, n, sort_type) char *s[]; int n; int sort_type; --- 623,629 ---- return n; } ! void do_gensort(s, n, sort_type) char *s[]; int n; int sort_type; *************** *** 707,714 **** arr2list(ptrs, nptrs, buff, bp, sep); } ! static void ! sane_qsort(array, left, right, compare) void *array[]; int left, right; int (*compare) _((const void *, const void *)); --- 695,701 ---- arr2list(ptrs, nptrs, buff, bp, sep); } ! static void sane_qsort(array, left, right, compare) void *array[]; int left, right; int (*compare) _((const void *, const void *)); *************** *** 1400,1407 **** safe_str(s, buff, bp); } ! static void ! do_itemfuns(buff, bp, str, num, word, sep, flag) char *buff; /* the return buffer */ char **bp; /* the active point in the return buffer */ char *str; /* the original string */ --- 1387,1393 ---- safe_str(s, buff, bp); } ! static void do_itemfuns(buff, bp, str, num, word, sep, flag) char *buff; /* the return buffer */ char **bp; /* the active point in the return buffer */ char *str; /* the original string */ *************** *** 1660,1665 **** --- 1646,1657 ---- } } + #define MAXITERS 2048 + + static char *iter_rep[MAXITERS]; + static int iter_place[MAXITERS]; + static int inum; + /* ARGSUSED */ FUNCTION(fun_iter) { *************** *** 1672,1679 **** char list[BUFFER_LEN]; char *tbuf1, *tbuf2, *lp; char const *sp; ! int place; if (nargs >= 3) { /* We have a delimiter. We've got to parse the third arg in place */ char insep[BUFFER_LEN]; --- 1664,1675 ---- char list[BUFFER_LEN]; char *tbuf1, *tbuf2, *lp; char const *sp; ! int *place; + if (inum >= MAXITERS) { + safe_str("#-1 TOO MANY ITERS", buff, bp); + return; + } if (nargs >= 3) { /* We have a delimiter. We've got to parse the third arg in place */ char insep[BUFFER_LEN]; *************** *** 1705,1725 **** if (!*lp) return; ! place = 0; while (lp) { ! if (place) safe_str(outsep, buff, bp); ! place++; ! tbuf1 = split_token(&lp, sep); tbuf2 = replace_string("##", tbuf1, args[1]); ! tbuf1 = replace_string("#@", unparse_integer(place), tbuf2); mush_free((Malloc_t) tbuf2, "replace_string.buff"); sp = tbuf1; process_expression(buff, bp, &sp, executor, caller, enactor, PE_DEFAULT, PT_DEFAULT, pe_info); mush_free((Malloc_t) tbuf1, "replace_string.buff"); } } /* ARGSUSED */ FUNCTION(fun_map) --- 1701,1764 ---- if (!*lp) return; ! inum++; ! place = &iter_place[inum]; ! *place = 0; while (lp) { ! if (*place) safe_str(outsep, buff, bp); ! *place = *place + 1; ! iter_rep[inum] = tbuf1 = split_token(&lp, sep); tbuf2 = replace_string("##", tbuf1, args[1]); ! tbuf1 = replace_string("#@", unparse_integer(*place), tbuf2); mush_free((Malloc_t) tbuf2, "replace_string.buff"); sp = tbuf1; process_expression(buff, bp, &sp, executor, caller, enactor, PE_DEFAULT, PT_DEFAULT, pe_info); mush_free((Malloc_t) tbuf1, "replace_string.buff"); } + *place = 0; + iter_rep[inum] = NULL; + inum--; + } + + /* ARGSUSED */ + FUNCTION(fun_ir) + { + int i; + + if (!is_integer(args[0])) { + safe_str("#-1 ARGUMENT MUST BE INTEGER", buff, bp); + return; + } + i = parse_integer(args[0]); + + if (i < 0 || i >= inum) { + safe_str("#-1 ARGUMENT OUT OF RANGE", buff, bp); + return; + } + safe_str(iter_rep[inum - i], buff, bp); + } + + /* ARGSUSED */ + FUNCTION(fun_iv) + { + int i; + + if (!is_integer(args[0])) { + safe_str("#-1 ARGUMENT MUST BE INTEGER", buff, bp); + return; + } + i = parse_integer(args[0]); + + if (i < 0 || i >= inum) { + safe_str("#-1 ARGUMENT OUT OF RANGE", buff, bp); + return; } + safe_str(unparse_number(iter_place[inum - i]), buff, bp); + } + + /* ARGSUSED */ FUNCTION(fun_map) *** ../clean/src/funmisc.c Fri Aug 14 17:50:27 1998 --- src/funmisc.c Sat Aug 15 02:15:55 1998 *************** *** 16,21 **** --- 16,22 ---- #include "parse.h" #include "function.h" #include "confmagic.h" + #include "game.h" #ifdef WIN32 #pragma warning( disable : 4761) /* NJG: disable warning re conversion */ *************** *** 435,438 **** --- 436,475 ---- safe_chr(' ', buff, bp); safe_str(ptrs[i], buff, bp); } + } + + /* ARGSUSED */ + FUNCTION(fun_trigger) + { + char *arg[11]; + int i; + if (!command_check_byname(executor, "@trigger")) { + safe_str("#-1 PERMISSION DENIED", buff, bp); + return; + } + for(i=1;i<10;i++) { + arg[i]=args[i]; + } + arg[10]=NULL; + do_trigger(executor, args[0], arg); + } + + /* ARGSUSED */ + FUNCTION(fun_force) + { + if (!command_check_byname(executor, "@force")) { + safe_str("#-1 PERMISSION DENIED", buff, bp); + return; + } + do_force(executor, args[0], args[1]); + } + + /* ARGSUSED */ + FUNCTION(fun_wait) + { + if (!command_check_byname(executor, "@wait")) { + safe_str("#-1 PERMISSION DENIED", buff, bp); + return; + } + do_wait(executor, executor, args[0], args[1]); } *** ../clean/src/funtime.c Fri Aug 14 17:50:28 1998 --- src/funtime.c Sun Jul 26 21:26:10 1998 *************** *** 14,25 **** extern time_t mudtime; int do_convtime _((char *str, struct tm * ttm)); /* ARGSUSED */ FUNCTION(fun_time) { char *s; ! s = (char *) ctime(&mudtime); s[strlen(s) - 1] = '\0'; if (s[8] == ' ') s[8] = '0'; --- 14,46 ---- extern time_t mudtime; int do_convtime _((char *str, struct tm * ttm)); + time_t tz_charadj(string) + char *string; + { + ATTR *a; + dbref who; + if (is_dbref(string)) { + who = parse_dbref(string); + a = atr_get(who, "TIMEZONE"); + if (a) { + return parse_integer(uncompress(a->value)) * 3600; + } + } else if (is_integer(string)) { + return parse_integer(string) * 3600; + } + return 0; + } + + /* ARGSUSED */ FUNCTION(fun_time) { char *s; + time_t tt; ! tt = mudtime + ((nargs == 1) ? tz_charadj(args[0]) : 0); ! ! s = (char *) ctime(&tt); s[strlen(s) - 1] = '\0'; if (s[8] == ' ') s[8] = '0'; *************** *** 44,50 **** safe_str(e_int, buff, bp); return; } ! tt = parse_integer(args[0]); if (tt < 0) { safe_str("#-1 ARGUMENT MUST BE POSITIVE", buff, bp); return; --- 65,71 ---- safe_str(e_int, buff, bp); return; } ! tt = parse_integer(args[0]) + ((nargs == 2) ? tz_charadj(args[1]) : 0); if (tt < 0) { safe_str("#-1 ARGUMENT MUST BE POSITIVE", buff, bp); return; *************** *** 117,124 **** "Dec", }; ! int ! do_convtime(str, ttm) char *str; struct tm *ttm; { --- 138,144 ---- "Dec", }; ! int do_convtime(str, ttm) char *str; struct tm *ttm; { *************** *** 198,206 **** if (do_convtime(args[0], &ttm)) { #ifdef SUN_OS ! safe_str(unparse_integer(timelocal(&ttm)), buff, bp); #else ! safe_str(unparse_integer(mktime(&ttm)), buff, bp); #endif /* SUN_OS */ } else { safe_str("-1", buff, bp); --- 218,226 ---- if (do_convtime(args[0], &ttm)) { #ifdef SUN_OS ! safe_str(unparse_integer(timelocal(&ttm) - ((nargs == 2) ? tz_charadj(args[1]) : 0)), buff, bp); #else ! safe_str(unparse_integer(mktime(&ttm) - ((nargs == 2) ? tz_charadj(args[1]) : 0)), buff, bp); #endif /* SUN_OS */ } else { safe_str("-1", buff, bp); *** ../clean/src/look.c Fri Aug 14 17:50:34 1998 --- src/look.c Tue Jul 21 22:58:07 1998 *************** *** 154,160 **** for (; thing != NOTHING; thing = Next(thing)) { if (Name(thing) && !Dark(thing) && (!Dark(loc) || Light(thing))) { ! strcpy(pbuff, Name(thing)); if ((p = strchr(pbuff, ';'))) *p = '\0'; p = nbuf; --- 154,160 ---- for (; thing != NOTHING; thing = Next(thing)) { if (Name(thing) && !Dark(thing) && (!Dark(loc) || Light(thing))) { ! strcpy(pbuff, colname(thing,0)); if ((p = strchr(pbuff, ';'))) *p = '\0'; p = nbuf; *************** *** 180,186 **** else { safe_str(" leads to ", tbuf1, &s1); if (Name(Location(thing))) ! safe_str(Name(Location(thing)), tbuf1, &s1); safe_chr('.', tbuf1, &s1); } *s1 = '\0'; --- 180,186 ---- else { safe_str(" leads to ", tbuf1, &s1); if (Name(Location(thing))) ! safe_str(colname(Location(thing),0), tbuf1, &s1); safe_chr('.', tbuf1, &s1); } *s1 = '\0'; *** ../clean/src/predicat.c Fri Aug 14 17:50:42 1998 --- src/predicat.c Tue Jul 21 22:58:07 1998 *************** *** 180,185 **** --- 180,189 ---- int j; char *preserve[10]; int need_pres = 0; + #ifdef USE_MASTEROBJECT + char tbuf[BUFFER_LEN]; + int oldhalt; + #endif loc = (loc == NOTHING) ? db[player].location : loc; *************** *** 200,205 **** --- 204,229 ---- free((Malloc_t) asave); } else if (def && *def) notify_by(thing, player, def); + #ifdef USE_MASTEROBJECT + d = atr_get(MASTER_OBJECT, what); + if (d) { + oldhalt = Halted(thing); + Flags(thing) &= ~HALT; + if (!need_pres) { + need_pres = 1; + save_global_regs("did_it_save", preserve); + } + asave = safe_uncompress(d->value); + ap = asave; + bp = buff; + process_expression(buff, &bp, &ap, thing, player, player, + PE_DEFAULT, PT_DEFAULT, NULL); + *bp = '\0'; + notify_by(thing, player, buff); + free((Malloc_t) asave); + Flags(thing) |= oldhalt; + } + #endif } /* message to neighbors */ if (!Dark(player)) { *************** *** 228,233 **** --- 252,282 ---- tprintf("%s %s", Name(player), odef)); } } + #ifdef USE_MASTEROBJECT + d = atr_get(MASTER_OBJECT, owhat); + if (d) { + oldhalt = Halted(thing); + Flags(thing) &= ~HALT; + if (!need_pres) { + need_pres = 1; + save_global_regs("did_it_save", preserve); + } + asave = safe_uncompress(d->value); + ap = asave; + bp = buff; + safe_str(Name(player), buff, &bp); + safe_chr(' ', buff, &bp); + sp = bp; + process_expression(buff, &bp, &ap, thing, player, player, + PE_DEFAULT, PT_DEFAULT, NULL); + *bp = '\0'; + if (bp != sp) + notify_except2(Contents(loc), player, thing, buff); + free((Malloc_t) asave); + Flags(thing) |= oldhalt; + } + #endif + } } } *************** *** 238,243 **** --- 287,301 ---- rnxt[j] = NULL; } charge_action(player, thing, awhat); + #ifdef USE_MASTEROBJECT + if ((d = atr_get(MASTER_OBJECT, awhat))) { + if (!Halted(thing)) { + strcpy(tbuf, uncompress(d->value)); + parse_que(thing, tbuf, player); + } + } + #endif + } dbref *** ../clean/src/set.c Fri Aug 14 17:50:46 1998 --- src/set.c Sat Aug 15 01:32:08 1998 *************** *** 148,153 **** --- 148,157 ---- } delete_player(thing, NULL); SET(Name(thing), newname); + #ifdef USE_COLNAME + /* Make sure the COLNAME attr is deleted. */ + atr_clr(thing, "COLNAME", thing); + #endif add_player(thing, NULL); if (USE_RWHO) rwhocli_userlogin(tbuf1, newname, time((time_t *) 0)); *************** *** 162,167 **** --- 166,175 ---- /* everything ok, change the name */ SET(Name(thing), newname); + #ifdef USE_COLNAME + /* Make sure the COLNAME attr is deleted. */ + atr_clr(thing, "COLNAME", thing); + #endif notify(player, "Name set."); } } *** ../clean/src/unparse.c Fri Aug 14 17:50:52 1998 --- src/unparse.c Tue Jul 21 22:58:07 1998 *************** *** 85,91 **** --- 85,95 ---- return "*HOME*"; default: Access(loc); + #ifdef USE_COLNAME + strcpy(tbuf1, colname(loc,1)); + #else strcpy(tbuf1, Name(loc)); + #endif if ((Typeof(loc) == TYPE_EXIT) && obey_myopic) { if ((p = strchr(tbuf1, ';'))) *p = '\0'; *************** *** 97,118 **** --- 101,126 ---- /* show everything */ if (SUPPORT_PUEBLO) couldunparse = 1; + #ifndef EXTENDED_ANSI #ifdef EXTENDED_ANSI if (ANSI_NAMES && ShowAnsi(player)) sprintf(buf, "%s%s%s(#%d%s)", ANSI_HILITE, tbuf1, ANSI_NORMAL, loc, unparse_flags(loc, player)); else #endif + #endif sprintf(buf, "%s(#%d%s)", tbuf1, loc, unparse_flags(loc, player)); return buf; } else { /* show only the name */ + #ifndef EXTENDED_ANSI #ifdef EXTENDED_ANSI if (ANSI_NAMES && ShowAnsi(player)) { sprintf(buf, "%s%s%s", ANSI_HILITE, tbuf1, ANSI_NORMAL); return buf; } else + #endif #endif return tbuf1; } *** ../clean/src/utils.c Fri Aug 14 17:50:53 1998 --- src/utils.c Tue Jul 21 22:58:07 1998 *************** *** 32,37 **** --- 32,39 ---- #include "mushdb.h" #include "mymalloc.h" #include "confmagic.h" + #include "command.h" + #include "ansi.h" extern ATTR *atr_get _((dbref thing, const char *atr)); *************** *** 346,348 **** --- 348,422 ---- } return n; } + + #ifdef USE_COLNAME + const char * + colname(thing, showzone) + dbref thing; + int showzone; + { + ATTR *a; + static char buff[BUFFER_LEN]; + char *p; + + a = atr_get_noparent(thing, "COLNAME"); + if (!a) + sprintf(buff, "%s%s%s", ANSI_HILITE, Name(thing), ANSI_NORMAL); + else + strcpy(buff, uncompress(a->value)); + if (showzone && IS(thing, TYPE_ROOM, ROOM_SHOWZONE) && GoodObject(Zone(thing))) { + p=buff+strlen(buff); + a = atr_get_noparent(Zone(thing), "COLNAME"); + if (!a) + sprintf(p, " [%s%s%s]", ANSI_HILITE, Name(Zone(thing)), ANSI_NORMAL); + else + sprintf(p, " [%s]", uncompress(a->value)); + } + return buff; + } + + COMMAND(cmd_colname) { + dbref target; + char *p; + char buff[BUFFER_LEN]; + char nbuff[BUFFER_LEN]; + char *t; + + target=noisy_match_result(player, arg_left, NOTYPE, MAT_EVERYTHING | MAT_ME | MAT_HERE); + if (target == NOTHING) + return; + + if (!controls(player, target)) { + notify(player, "Permission denied."); + return; + } + + if (!arg_right || !*arg_right) { + atr_clr(target, "COLNAME", GOD); + notify(player, "Colname cleared."); + } else { + t=buff; + p=arg_right; + while (*p) { + if (*p == ESC_CHAR) + while (*p && *p++ != 'm') ; + else + *t++=*p++; + } + *t='\0'; + strcpy(nbuff, Name(target)); + if (Typeof(target) == TYPE_EXIT) { + t=index(nbuff, ';'); + if (t) + *t='\0'; + } + if (!strstr(buff, nbuff)) { + notify(player, tprintf("New name \"%s\" doesn't contain old name \"%s\".",buff,Name(target))); + return; + } + atr_add(target, "COLNAME", arg_right, GOD, AF_NOPROG | AF_MDARK | AF_WIZARD | AF_PRIVATE); + notify(player, "Colname set."); + } + } + + #endif