This is patch04 to PennMUSH 1.7.6. After applying this patch, you will have version 1.7.6p4 To apply this patch, save it to a file in your top-level MUSH directory, and do the following: patch -p1 < 1.7.6-patch04 make install If you use GNU patch 2.2, you probably want the above to be 'patch -b -p1', not just 'patch -p1'. Unix (or cygwin) users need not worry about failed hunks in src/switchinc.c, hdrs/switches.h, hdrs/cmds.h, or hdrs/funs.h. These files are automatically rebuilt on compile. Then @shutdown and restart your MUSH. - Alan/Javelin In this patch: Minor Changes: * English-style matching now applies to exits in the room (so '1st down' can match the first 'down' exit if you're not carrying anything that matches 'down'). New english-style matching adjective 'toward' restricts the match to exits (so: 'look toward 1st down'). Fixes: * Code cleanup to fix several potential buffer overflows. * The wildcard matcher had problems with backslash escapes in some cases, making matching a : in a $command very hard. Reported by Wayne@PDX. * @chzone could cause crashes on some systems. Reported by Wayne@PDX. * When two exits match, one is no longer chosen at random. Instead, the ambiguity should be reported as an error. Reported by Intrevis@M*U*S*H. * The dbref returned by locate when given the X parameter is no longer random, but the last one found (as per the help). * Serious bug in reading locks from the db on startup corrected. * The profiling timer is turned off duing dumps, as some systems (FreeBSD?) appear to continue to use it and interrupt dumps due to cpu limiting. Reported by Nathan Schuette. Prereq: 1.7.6p3 *** 1_7_6.82/Patchlevel Sun, 22 Dec 2002 17:19:09 -0600 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.1.1.3 600) --- 1_7_6.99(w)/Patchlevel Thu, 02 Jan 2003 23:31:05 -0600 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.1.1.4 600) *************** *** 1,2 **** Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.6p3 --- 1,2 ---- Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.6p4 *** 1_7_6.82/CHANGES Tue, 24 Dec 2002 15:13:59 -0600 dunemush (pennmush/g/17_CHANGES 1.10.1.6.1.2.1.2.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.9.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1 600) --- 1_7_6.99(w)/CHANGES Mon, 06 Jan 2003 11:36:30 -0600 dunemush (pennmush/g/17_CHANGES 1.10.1.6.1.2.1.2.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.9.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1 600) *************** *** 18,23 **** --- 18,47 ---- ========================================================================== + Version 1.7.6 patchlevel 4 January 2, 2003 + + Minor Changes: + * English-style matching now applies to exits in the room + (so '1st down' can match the first 'down' exit if you're not carrying + anything that matches 'down'). New english-style matching adjective + 'toward' restricts the match to exits (so: 'look toward 1st down'). + Fixes: + * Code cleanup to fix several potential buffer overflows. + * The wildcard matcher had problems with backslash escapes in + some cases, making matching a : in a $command very hard. + Reported by Wayne@PDX. + * @chzone could cause crashes on some systems. Reported by Wayne@PDX. + * When two exits match, one is no longer chosen at random. + Instead, the ambiguity should be reported as an error. + Reported by Intrevis@M*U*S*H. + * The dbref returned by locate when given the X parameter is + no longer random, but the last one found (as per the help). + * Serious bug in reading locks from the db on startup corrected. + * The profiling timer is turned off duing dumps, as some systems + (FreeBSD?) appear to continue to use it and interrupt dumps + due to cpu limiting. Reported by Nathan Schuette. + + Version 1.7.6 patchlevel 3 December 22, 2002 Minor changes: *** 1_7_6.82/game/txt/hlp/pennvers.hlp Tue, 24 Dec 2002 15:13:59 -0600 dunemush (pennmush/12_pennvers.h 1.169.1.42.1.3.1.2.2.2.1.1.1.3.1.1.1.5.1.4.1.1.1.1.1.1.1.1.1.5.1.1.1.3.1.1.1.3.1.1.1.54.1.10.1.2.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.7.1.1.1.1.1.2.1.1.1.4.1.1 600) --- 1_7_6.99(w)/game/txt/hlp/pennvers.hlp Mon, 06 Jan 2003 12:48:02 -0600 dunemush (pennmush/12_pennvers.h 1.169.1.42.1.3.1.2.2.2.1.1.1.3.1.1.1.5.1.4.1.1.1.1.1.1.1.1.1.5.1.1.1.3.1.1.1.3.1.1.1.54.1.10.1.2.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.7.1.1.1.1.1.2.1.1.1.4.1.2.1.1.1.1.1.1.1.2.1.1 600) *************** *** 1,5 **** & changes ! & 1.7.6p3 This is a list of changes in this patchlevel which are probably of interest to players. More information about new commands and functions can probably be gotten via 'help '. 'help credits' --- 1,5 ---- & changes ! & 1.7.6p4 This is a list of changes in this patchlevel which are probably of interest to players. More information about new commands and functions can probably be gotten via 'help '. 'help credits' *************** *** 11,16 **** --- 11,41 ---- A list of the patchlevels associated with each release can be read in 'help patchlevels'. + Version 1.7.6 patchlevel 4 January 2, 2003 + + Minor Changes: + * English-style matching now applies to exits in the room + (so '1st down' can match the first 'down' exit if you're not carrying + anything that matches 'down'). New english-style matching adjective + 'toward' restricts the match to exits (so: 'look toward 1st down'). + Fixes: + * Code cleanup to fix several potential buffer overflows. + * The wildcard matcher had problems with backslash escapes in + some cases, making matching a : in a $command very hard. + Reported by Wayne@PDX. + * @chzone could cause crashes on some systems. Reported by Wayne@PDX. + * When two exits match, one is no longer chosen at random. + Instead, the ambiguity should be reported as an error. + Reported by Intrevis@M*U*S*H. + * The dbref returned by locate when given the X parameter is + no longer random, but the last one found (as per the help). + * Serious bug in reading locks from the db on startup corrected. + * The profiling timer is turned off duing dumps, as some systems + (FreeBSD?) appear to continue to use it and interrupt dumps + due to cpu limiting. Reported by Nathan Schuette. + + + & 1.7.6p3 Version 1.7.6 patchlevel 3 December 22, 2002 Minor changes: *************** *** 5796,5802 **** For information on a specific patchlevel of one of the versions listed, type 'help p'. For example, 'help 1.7.2p3' ! 1.7.6: 0, 1, 2, 3 1.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 1.7.4: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 --- 5821,5827 ---- For information on a specific patchlevel of one of the versions listed, type 'help p'. For example, 'help 1.7.2p3' ! 1.7.6: 0, 1, 2, 3, 4 1.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 1.7.4: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 *** 1_7_6.82/game/txt/hlp/penntop.hlp Tue, 26 Nov 2002 14:28:59 -0600 dunemush (pennmush/13_penntop.hl 1.2.1.27.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.12 600) --- 1_7_6.99(w)/game/txt/hlp/penntop.hlp Mon, 30 Dec 2002 23:30:31 -0600 dunemush (pennmush/13_penntop.hl 1.2.1.27.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.12.1.1 600) *************** *** 1781,1790 **** Adjectives include: * my - an object you're carrying * this - an object in your location (also: this here ) * 1st, 2nd, etc. - one of a set of objects with the same names. Objects are ordered in the order in which they're listed in your ! inventory or room contents. ! You may combine some adjectives (my 1st box, this here 2nd box. & &HELP This is the AHELP index. & RESTRICT --- 1781,1791 ---- Adjectives include: * my - an object you're carrying * this - an object in your location (also: this here ) + * toward - an exit in your location * 1st, 2nd, etc. - one of a set of objects with the same names. Objects are ordered in the order in which they're listed in your ! inventory, room contents, and exit list (in that order). ! You may combine some adjectives (my 1st box, this here 2nd box). & &HELP This is the AHELP index. & RESTRICT *** 1_7_6.82/game/txt/hlp/pennfunc.hlp Tue, 24 Dec 2002 15:13:59 -0600 dunemush (pennmush/16_pennfunc.h 1.2.1.50.1.1.1.1.1.2.1.7.1.8.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.1.1.1.1.3.1.1.1.1.1.1 600) --- 1_7_6.99(w)/game/txt/hlp/pennfunc.hlp Mon, 30 Dec 2002 18:33:47 -0600 dunemush (pennmush/16_pennfunc.h 1.2.1.50.1.1.1.1.1.2.1.7.1.8.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.1.1.1.1.3.1.1.1.1.1.1.1.1 600) *************** *** 1823,1829 **** T - Things F - Return #-1 if what's found is of a different type than the preferred one. ! X - Never return #-2. Use the last dbref found if the match is ambiguous. If you specify more than one type, the last one will be preferred. Unless you specify an F option, if an object of a different type is found and --- 1823,1829 ---- T - Things F - Return #-1 if what's found is of a different type than the preferred one. ! X - Never return #-2. Use the last dbref found if the match is ambiguous. If you specify more than one type, the last one will be preferred. Unless you specify an F option, if an object of a different type is found and *** 1_7_6.82/src/wiz.c Sun, 22 Dec 2002 01:03:36 -0600 dunemush (pennmush/b/23_wiz.c 1.44.1.1.1.1.1.2.1.7.1.1.1.1.1.1.1.1.1.1.1.8.1.2.2.2.1.2.1.1.1.1.1.1.1.2.1.1 660) --- 1_7_6.99(w)/src/wiz.c Mon, 06 Jan 2003 15:51:33 -0600 dunemush (pennmush/b/23_wiz.c 1.44.1.1.1.1.1.2.1.7.1.1.1.1.1.1.1.1.1.1.1.8.1.2.2.2.1.2.1.1.1.1.1.1.1.2.1.1.1.1 660) *************** *** 1899,1904 **** --- 1899,1905 ---- if (paranoid_checkpt < 1) paranoid_checkpt = 1; } + fork_and_dump(0); #ifndef WIN32 /* Some broken libcs appear to retain the itimer across exec! * So we make sure that if we get a SIGPROF in our next incarnation, *************** *** 1906,1912 **** */ ignore_signal(SIGPROF); #endif - fork_and_dump(0); dump_reboot_db(); #ifdef INFO_SLAVE kill_info_slave(); --- 1907,1912 ---- *** 1_7_6.82/src/wild.c Tue, 20 Aug 2002 09:48:05 -0500 dunemush (pennmush/b/24_wild.c 1.11.1.1.1.8 660) --- 1_7_6.99(w)/src/wild.c Mon, 06 Jan 2003 15:51:33 -0600 dunemush (pennmush/b/24_wild.c 1.11.1.1.1.8.1.1.1.4.1.1 660) *************** *** 52,57 **** --- 52,58 ---- (const char *tstr, const char *dstr, int arg, char *wbuf, int cs); static int wild(const char *s, const char *d, int p, int cs); static int check_literals(const char *tstr, const char *dstr, int cs); + static char *strip_backslashes(const char *str); /* --------------------------------------------------------------------------- * quick_wild: do a wildcard match, without remembering the wild data. *************** *** 525,532 **** char *sp, *dp; strncpy(dbuf1, dstr, BUFFER_LEN - 1); dbuf1[BUFFER_LEN - 1] = '\0'; ! strncpy(tbuf1, tstr, BUFFER_LEN - 1); ! tbuf1[BUFFER_LEN - 1] = '\0'; if (!cs) { upcasestr(tbuf1); upcasestr(dbuf1); --- 526,532 ---- char *sp, *dp; strncpy(dbuf1, dstr, BUFFER_LEN - 1); dbuf1[BUFFER_LEN - 1] = '\0'; ! strcpy(tbuf1, strip_backslashes(tstr)); if (!cs) { upcasestr(tbuf1); upcasestr(dbuf1); *************** *** 543,545 **** --- 543,562 ---- } return 1; } + + + static char * + strip_backslashes(const char *str) + { + /* Remove backslashes from a string, and return it in a static buffer */ + static char buf[BUFFER_LEN]; + int i = 0; + + while (*str && (i < BUFFER_LEN - 1)) { + if (*str == '\\' && *(str + 1)) + str++; + buf[i++] = *str++; + } + buf[i] = '\0'; + return buf; + } *** 1_7_6.82/src/unparse.c Sun, 10 Nov 2002 14:27:19 -0600 dunemush (pennmush/b/28_unparse.c 1.16.1.7 660) --- 1_7_6.99(w)/src/unparse.c Mon, 06 Jan 2003 15:51:33 -0600 dunemush (pennmush/b/28_unparse.c 1.16.1.7.1.1 660) *************** *** 85,91 **** real_unparse(dbref player, dbref loc, int obey_myopic, int use_nameformat, int use_nameaccent) { ! static char buf[BUFFER_LEN]; static char tbuf1[BUFFER_LEN]; char *p; int got_nameformat = 0; --- 85,91 ---- real_unparse(dbref player, dbref loc, int obey_myopic, int use_nameformat, int use_nameaccent) { ! static char buf[BUFFER_LEN], *bp; static char tbuf1[BUFFER_LEN]; char *p; int got_nameformat = 0; *************** *** 123,138 **** /* show everything */ if (SUPPORT_PUEBLO) couldunparse = 1; if (ANSI_NAMES && ShowAnsi(player) && !got_nameformat) ! sprintf(buf, "%s%s%s(#%d%s)", ANSI_HILITE, tbuf1, ! ANSI_NORMAL, loc, unparse_flags(loc, player)); else ! sprintf(buf, "%s(#%d%s)", tbuf1, loc, unparse_flags(loc, player)); return buf; } else { /* show only the name */ if (ANSI_NAMES && ShowAnsi(player) && !got_nameformat) { ! sprintf(buf, "%s%s%s", ANSI_HILITE, tbuf1, ANSI_NORMAL); return buf; } else return tbuf1; --- 123,143 ---- /* show everything */ if (SUPPORT_PUEBLO) couldunparse = 1; + bp = buf; if (ANSI_NAMES && ShowAnsi(player) && !got_nameformat) ! safe_format(buf, &bp, "%s%s%s(#%d%s)", ANSI_HILITE, tbuf1, ! ANSI_NORMAL, loc, unparse_flags(loc, player)); else ! safe_format(buf, &bp, "%s(#%d%s)", tbuf1, loc, ! unparse_flags(loc, player)); ! *bp = '\0'; return buf; } else { /* show only the name */ if (ANSI_NAMES && ShowAnsi(player) && !got_nameformat) { ! bp = buf; ! safe_format(buf, &bp, "%s%s%s", ANSI_HILITE, tbuf1, ANSI_NORMAL); ! *bp = '\0'; return buf; } else return tbuf1; *** 1_7_6.82/src/set.c Sat, 30 Nov 2002 15:49:22 -0600 dunemush (pennmush/b/38_set.c 1.26.1.5.1.1.2.1.1.1.1.1.1.11 660) --- 1_7_6.99(w)/src/set.c Mon, 06 Jan 2003 15:51:32 -0600 dunemush (pennmush/b/38_set.c 1.26.1.5.1.1.2.1.1.1.1.1.1.11.1.1 660) *************** *** 368,374 **** return 0; } /* Don't allow circular zones */ ! { dbref tmp; for (tmp = Zone(zone); GoodObject(tmp); tmp = Zone(tmp)) { if (tmp == thing) { --- 368,374 ---- return 0; } /* Don't allow circular zones */ ! if (GoodObject(zone)) { dbref tmp; for (tmp = Zone(zone); GoodObject(tmp); tmp = Zone(tmp)) { if (tmp == thing) { *** 1_7_6.82/src/rob.c Sat, 30 Nov 2002 15:49:22 -0600 dunemush (pennmush/b/42_rob.c 1.18.1.2.1.3.1.3.1.6 660) --- 1_7_6.99(w)/src/rob.c Mon, 06 Jan 2003 15:51:32 -0600 dunemush (pennmush/b/42_rob.c 1.18.1.2.1.3.1.3.1.7 660) *************** *** 23,29 **** do_kill(dbref player, const char *what, int cost, int slay) { dbref victim; ! char tbuf1[BUFFER_LEN], tbuf2[BUFFER_LEN]; if (slay && !Wizard(player)) { notify(player, T("You do not have such power.")); --- 23,29 ---- do_kill(dbref player, const char *what, int cost, int slay) { dbref victim; ! char tbuf1[BUFFER_LEN], tbuf2[BUFFER_LEN], *tp; if (slay && !Wizard(player)) { notify(player, T("You do not have such power.")); *************** *** 76,83 **** if (((get_random_long(0, KILL_BASE_COST) < cost) || slay) && !Wizard(victim)) { /* you killed him */ ! sprintf(tbuf1, T("You killed %s!"), Name(victim)); ! sprintf(tbuf2, "killed %s!", Name(victim)); do_halt(victim, "", victim); did_it(player, victim, "DEATH", tbuf1, "ODEATH", tbuf2, "ADEATH", NOTHING); --- 76,87 ---- if (((get_random_long(0, KILL_BASE_COST) < cost) || slay) && !Wizard(victim)) { /* you killed him */ ! tp = tbuf1; ! safe_format(tbuf1, &tp, T("You killed %s!"), Name(victim)); ! *tp = '\0'; ! tp = tbuf2; ! safe_format(tbuf2, &tp, "killed %s!", Name(victim)); ! *tp = '\0'; do_halt(victim, "", victim); did_it(player, victim, "DEATH", tbuf1, "ODEATH", tbuf2, "ADEATH", NOTHING); *** 1_7_6.82/src/player.c Wed, 16 Oct 2002 18:01:52 -0500 dunemush (pennmush/b/47_player.c 1.15.1.1.1.1.1.4.1.6 660) --- 1_7_6.99(w)/src/player.c Mon, 06 Jan 2003 15:51:32 -0600 dunemush (pennmush/b/47_player.c 1.15.1.1.1.1.1.4.1.6.1.1 660) *************** *** 504,513 **** const char *host; { char *s; ! char last_place[MAX_COMMAND_LEN]; s = ctime(&mudtime); ! s[strlen(s) - 1] = 0; ! sprintf(last_place, T("%s on %s"), host, s); (void) atr_add(player, "LASTFAILED", last_place, GOD, NOTHING); } --- 504,515 ---- const char *host; { char *s; ! char last_place[BUFFER_LEN], *bp; s = ctime(&mudtime); ! s[strlen(s) - 1] = '\0'; ! bp = last_place; ! safe_format(last_place, &bp, T("%s on %s"), host, s); ! *bp = '\0'; (void) atr_add(player, "LASTFAILED", last_place, GOD, NOTHING); } *** 1_7_6.82/src/move.c Mon, 07 Oct 2002 22:44:39 -0500 dunemush (pennmush/b/51_move.c 1.1.1.18.1.5.1.13.1.3.1.9.1.1.1.1.1.2.1.1.1.1.1.5 660) --- 1_7_6.99(w)/src/move.c Mon, 06 Jan 2003 15:51:32 -0600 dunemush (pennmush/b/51_move.c 1.1.1.18.1.5.1.13.1.3.1.9.1.1.1.1.1.2.1.1.1.1.1.9 660) *************** *** 292,299 **** if (!strcasecmp(direction, "home") && !Fixed(player)) return 1; ! /* otherwise match on exits */ ! return (last_match_result(player, direction, TYPE_EXIT, MAT_EXIT) != NOTHING); } static dbref --- 292,300 ---- if (!strcasecmp(direction, "home") && !Fixed(player)) return 1; ! /* otherwise match on exits - don't use GoodObject here! */ ! return (match_result(player, direction, TYPE_EXIT, MAT_ENGLISH | MAT_EXIT) != ! NOTHING); } static dbref *************** *** 309,315 **** char buff[BUFFER_LEN], *bp; ATTR *a; dbref dest_room; - /* We'd like a DESTINATION attribute, but we'll settle for EXITTO, * for portability */ --- 310,315 ---- *************** *** 318,324 **** a = atr_get(exit_obj, "EXITTO"); if (!a) return NOTHING; - abuf = safe_uncompress(a->value); if (!abuf) return NOTHING; --- 318,323 ---- *************** *** 332,338 **** PE_DEFAULT, PT_DEFAULT, NULL); *bp = '\0'; dest_room = parse_dbref(buff); - free((Malloc_t) abuf); return (dest_room); } --- 331,336 ---- *************** *** 345,351 **** int type; /* type 0 is normal, type 1 is global, type 2 is zone */ { dbref exit_m, loc, var_dest; - if (!strcasecmp(direction, "home")) { /* send him home */ /* but steal all his possessions */ --- 343,348 ---- *************** *** 370,383 **** if (DO_GLOBALS && (type == 1)) exit_m = match_result(player, direction, TYPE_EXIT, ! MAT_EXIT | MAT_GLOBAL | MAT_CHECK_KEYS); else if (DO_GLOBALS && (type == 2)) exit_m = match_result(player, direction, TYPE_EXIT, ! MAT_EXIT | MAT_REMOTES | MAT_CHECK_KEYS); else exit_m = ! match_result(player, direction, TYPE_EXIT, MAT_EXIT | MAT_CHECK_KEYS); switch (exit_m) { case NOTHING: /* try to force the object */ --- 367,381 ---- if (DO_GLOBALS && (type == 1)) exit_m = match_result(player, direction, TYPE_EXIT, ! MAT_ENGLISH | MAT_EXIT | MAT_GLOBAL | MAT_CHECK_KEYS); else if (DO_GLOBALS && (type == 2)) exit_m = match_result(player, direction, TYPE_EXIT, ! MAT_ENGLISH | MAT_EXIT | MAT_REMOTES | MAT_CHECK_KEYS); else exit_m = ! match_result(player, direction, TYPE_EXIT, ! MAT_ENGLISH | MAT_EXIT | MAT_CHECK_KEYS); switch (exit_m) { case NOTHING: /* try to force the object */ *************** *** 418,424 **** did_it(player, exit_m, "SUCCESS", NULL, "OSUCCESS", NULL, "ASUCCESS", NOTHING); did_it(player, exit_m, "DROP", NULL, "ODROP", NULL, "ADROP", var_dest); - switch (Typeof(var_dest)) { case TYPE_ROOM: --- 416,421 ---- *************** *** 430,436 **** if (Location(player) != loc) follower_command(player, loc, tprintf("%s #%d", "move", exit_m)); break; - case TYPE_PLAYER: case TYPE_THING: if (IsGarbage(var_dest)) { --- 427,432 ---- *************** *** 466,476 **** { dbref thing; dbref loc; ! ! if ((thing = noisy_match_result(player, what, TYPE_EXIT, MAT_EXIT)) == ! NOTHING) return; - loc = Home(thing); if (!controls(player, loc)) { notify(player, T("You cannot modify exits in that room.")); --- 462,471 ---- { dbref thing; dbref loc; ! if ((thing = ! noisy_match_result(player, what, TYPE_EXIT, ! MAT_ENGLISH | MAT_EXIT)) == NOTHING) return; loc = Home(thing); if (!controls(player, loc)) { notify(player, T("You cannot modify exits in that room.")); *************** *** 490,508 **** { dbref loc = Location(player); dbref thing; ! char tbuf1[BUFFER_LEN], tbuf2[BUFFER_LEN]; long match_flags = MAT_NEIGHBOR | MAT_ABSOLUTE | MAT_CHECK_KEYS | MAT_NEAR | MAT_ENGLISH; char *myenv[10]; int i; - if (!IsRoom(loc) && !EnterOk(loc) && !controls(player, loc)) { notify(player, T("Permission denied.")); return; } if (!Long_Fingers(player)) match_flags |= MAT_CONTROL; - if (match_result(player, what, TYPE_THING, match_flags) == NOTHING) { if (POSSESSIVE_GET) { /* take care of possessive get (stealing) */ --- 485,501 ---- { dbref loc = Location(player); dbref thing; ! char tbuf1[BUFFER_LEN], tbuf2[BUFFER_LEN], *tp; long match_flags = MAT_NEIGHBOR | MAT_ABSOLUTE | MAT_CHECK_KEYS | MAT_NEAR | MAT_ENGLISH; char *myenv[10]; int i; if (!IsRoom(loc) && !EnterOk(loc) && !controls(player, loc)) { notify(player, T("Permission denied.")); return; } if (!Long_Fingers(player)) match_flags |= MAT_CONTROL; if (match_result(player, what, TYPE_THING, match_flags) == NOTHING) { if (POSSESSIVE_GET) { /* take care of possessive get (stealing) */ *************** *** 524,533 **** notify_format(Location(thing), T("%s was taken from you."), Name(thing)); notify_format(thing, T("%s took you."), Name(player)); ! sprintf(tbuf1, T("You take %s from %s."), Name(thing), ! Name(Location(thing))); ! sprintf(tbuf2, T("takes %s from %s."), Name(thing), ! Name(Location(thing))); moveto(thing, player); did_it(player, thing, "SUCCESS", tbuf1, "OSUCCESS", tbuf2, "ASUCCESS", NOTHING); --- 517,530 ---- notify_format(Location(thing), T("%s was taken from you."), Name(thing)); notify_format(thing, T("%s took you."), Name(player)); ! tp = tbuf1; ! safe_format(tbuf1, &tp, T("You take %s from %s."), Name(thing), ! Name(Location(thing))); ! *tp = '\0'; ! tp = tbuf2; ! safe_format(tbuf2, &tp, T("takes %s from %s."), Name(thing), ! Name(Location(thing))); ! *tp = '\0'; moveto(thing, player); did_it(player, thing, "SUCCESS", tbuf1, "OSUCCESS", tbuf2, "ASUCCESS", NOTHING); *************** *** 570,577 **** if (could_doit(player, thing)) { moveto(thing, player); notify_format(thing, T("%s took you."), Name(player)); ! sprintf(tbuf1, T("You take %s."), Name(thing)); ! sprintf(tbuf2, T("takes %s."), Name(thing)); did_it(player, thing, "SUCCESS", tbuf1, "OSUCCESS", tbuf2, "ASUCCESS", NOTHING); myenv[0] = (char *) mush_malloc(BUFFER_LEN, "dbref"); --- 567,578 ---- if (could_doit(player, thing)) { moveto(thing, player); notify_format(thing, T("%s took you."), Name(player)); ! tp = tbuf1; ! safe_format(tbuf1, &tp, T("You take %s."), Name(thing)); ! *tp = '\0'; ! tp = tbuf2; ! safe_format(tbuf2, &tp, T("takes %s."), Name(thing)); ! *tp = '\0'; did_it(player, thing, "SUCCESS", tbuf1, "OSUCCESS", tbuf2, "ASUCCESS", NOTHING); myenv[0] = (char *) mush_malloc(BUFFER_LEN, "dbref"); *************** *** 604,614 **** { dbref loc; dbref thing; ! char tbuf1[BUFFER_LEN], tbuf2[BUFFER_LEN]; ! if ((loc = Location(player)) == NOTHING) return; - switch (thing = match_result(player, name, TYPE_THING, MAT_POSSESSION | MAT_ABSOLUTE | MAT_CONTROL | --- 605,613 ---- { dbref loc; dbref thing; ! char tbuf1[BUFFER_LEN], tbuf2[BUFFER_LEN], *tp; if ((loc = Location(player)) == NOTHING) return; switch (thing = match_result(player, name, TYPE_THING, MAT_POSSESSION | MAT_ABSOLUTE | MAT_CONTROL | *************** *** 647,654 **** } break; } ! sprintf(tbuf1, T("You drop %s."), Name(thing)); ! sprintf(tbuf2, T("drops %s."), Name(thing)); did_it(player, thing, "DROP", tbuf1, "ODROP", tbuf2, "ADROP", NOTHING); } --- 646,657 ---- } break; } ! tp = tbuf1; ! safe_format(tbuf1, &tp, T("You drop %s."), Name(thing)); ! *tp = '\0'; ! tp = tbuf2; ! safe_format(tbuf2, &tp, T("drops %s."), Name(thing)); ! *tp = '\0'; did_it(player, thing, "DROP", tbuf1, "ODROP", tbuf2, "ADROP", NOTHING); } *************** *** 661,671 **** dbref thing; dbref loc; long match_flags = MAT_CHECK_KEYS | MAT_NEIGHBOR | MAT_ENGLISH | MAT_ABSOLUTE; - if ((thing = noisy_match_result(player, what, TYPE_THING, match_flags)) == NOTHING) return; - switch (Typeof(thing)) { case TYPE_ROOM: case TYPE_EXIT: --- 664,672 ---- *************** *** 707,713 **** { dbref loc; loc = Location(player); ! if (IsRoom(loc) || IsGarbage(loc) || IsGarbage(Location(loc)) || NoLeave(loc) || !eval_lock(player, loc, Leave_Lock) ) { did_it(player, loc, "LFAIL", T("You can't leave."), "OLFAIL", --- 708,715 ---- { dbref loc; loc = Location(player); ! if (IsRoom(loc) || IsGarbage(loc) || IsGarbage(Location(loc)) ! || NoLeave(loc) || !eval_lock(player, loc, Leave_Lock) ) { did_it(player, loc, "LFAIL", T("You can't leave."), "OLFAIL", *************** *** 719,740 **** follower_command(player, loc, "leave"); } ! dbref global_exit(player, direction) dbref player; const char *direction; { ! return (last_match_result ! (player, direction, TYPE_EXIT, MAT_GLOBAL | MAT_EXIT) != NOTHING); } ! dbref remote_exit(player, direction) dbref player; const char *direction; { ! return (last_match_result ! (player, direction, TYPE_EXIT, MAT_REMOTES | MAT_EXIT) != NOTHING); } void --- 721,742 ---- follower_command(player, loc, "leave"); } ! int global_exit(player, direction) dbref player; const char *direction; { ! return (GoodObject ! (match_result(player, direction, TYPE_EXIT, MAT_GLOBAL | MAT_EXIT))); } ! int remote_exit(player, direction) dbref player; const char *direction; { ! return (GoodObject ! (match_result(player, direction, TYPE_EXIT, MAT_REMOTES | MAT_EXIT))); } void *************** *** 748,754 **** if (!Mobile(player)) return; - if (!strcasecmp(command, "home") && Fixed(player)) { notify(player, T("You can't do that IC!")); return; --- 750,755 ---- *************** *** 756,765 **** if (DO_GLOBALS) { if (can_move(player, command)) do_move(player, command, 0); ! else if ((Zone(Location(player)) != NOTHING) && ! remote_exit(player, command)) do_move(player, command, 2); ! else if ((Location(player) != MASTER_ROOM) && global_exit(player, command)) do_move(player, command, 1); else do_move(player, command, 0); --- 757,767 ---- if (DO_GLOBALS) { if (can_move(player, command)) do_move(player, command, 0); ! else ! if ((Zone(Location(player)) != NOTHING) && remote_exit(player, command)) do_move(player, command, 2); ! else if ((Location(player) != MASTER_ROOM) ! && global_exit(player, command)) do_move(player, command, 1); else do_move(player, command, 0); *************** *** 786,795 **** notify(player, T("I can't tell which one to follow.")); return; } ! if (!GoodObject(leader) || !GoodObject(Location(player)) || ! (IsPlayer(leader) && !Connected(leader)) || ! ((DarkLegal(leader) || (Dark(Location(player)) && !Light(leader))) && ! !See_All(player))) { notify(player, T("You don't see that here.")); return; } --- 788,798 ---- notify(player, T("I can't tell which one to follow.")); return; } ! if (!GoodObject(leader) || !GoodObject(Location(player)) ! || (IsPlayer(leader) && !Connected(leader)) ! || ((DarkLegal(leader) ! || (Dark(Location(player)) && !Light(leader))) ! && !See_All(player))) { notify(player, T("You don't see that here.")); return; } *************** *** 808,815 **** } /* Ok, are we allowed to follow them? */ if (!eval_lock(player, leader, Follow_Lock)) { ! notify_format(player, T("You're not allowed to follow %s."), ! Name(leader)); return; } /* Ok, looks good */ --- 811,818 ---- } /* Ok, are we allowed to follow them? */ if (!eval_lock(player, leader, Follow_Lock)) { ! notify_format(player, ! T("You're not allowed to follow %s."), Name(leader)); return; } /* Ok, looks good */ *************** *** 903,911 **** return; } /* Are we following or leading them? */ ! if (!is_following(who, player) && !is_following(player, who)) { ! notify_format(player, T("%s isn't following you, nor vice versa."), ! Name(who)); return; } /* Ok, looks good */ --- 906,915 ---- return; } /* Are we following or leading them? */ ! if (!is_following(who, player) ! && !is_following(player, who)) { ! notify_format(player, ! T("%s isn't following you, nor vice versa."), Name(who)); return; } /* Ok, looks good */ *************** *** 928,934 **** ATTR *a; char tbuf1[BUFFER_LEN]; char *bp; - a = atr_get_noparent(leader, "FOLLOWERS"); if (!a) { (void) atr_add(leader, "FOLLOWERS", unparse_dbref(follower), GOD, NOTHING); --- 932,937 ---- *************** *** 951,957 **** ATTR *a; char tbuf1[BUFFER_LEN]; char *bp; - a = atr_get_noparent(follower, "FOLLOWING"); if (!a) { (void) atr_add(follower, "FOLLOWING", unparse_dbref(leader), GOD, NOTHING); --- 954,959 ---- *************** *** 992,1006 **** ATTR *a; char tbuf1[BUFFER_LEN]; char flwr[BUFFER_LEN]; - a = atr_get_noparent(leader, "FOLLOWERS"); if (!a) return; /* No followers, so no deletion */ /* Let's take it apart and put it back together w/o follower */ strcpy(flwr, unparse_dbref(follower)); strcpy(tbuf1, uncompress(AL_STR(a))); ! (void) atr_add(leader, "FOLLOWERS", remove_word(tbuf1, flwr, ' '), GOD, ! NOTHING); } /* Delete someone from a player's FOLLOWING attribute */ --- 994,1007 ---- ATTR *a; char tbuf1[BUFFER_LEN]; char flwr[BUFFER_LEN]; a = atr_get_noparent(leader, "FOLLOWERS"); if (!a) return; /* No followers, so no deletion */ /* Let's take it apart and put it back together w/o follower */ strcpy(flwr, unparse_dbref(follower)); strcpy(tbuf1, uncompress(AL_STR(a))); ! (void) atr_add(leader, "FOLLOWERS", ! remove_word(tbuf1, flwr, ' '), GOD, NOTHING); } /* Delete someone from a player's FOLLOWING attribute */ *************** *** 1012,1026 **** ATTR *a; char tbuf1[BUFFER_LEN]; char ldr[BUFFER_LEN]; - a = atr_get_noparent(follower, "FOLLOWING"); if (!a) return; /* Not following, so no deletion */ /* Let's take it apart and put it back together w/o leader */ strcpy(ldr, unparse_dbref(leader)); strcpy(tbuf1, uncompress(AL_STR(a))); ! (void) atr_add(follower, "FOLLOWING", remove_word(tbuf1, ldr, ' '), GOD, ! NOTHING); } static void --- 1013,1026 ---- ATTR *a; char tbuf1[BUFFER_LEN]; char ldr[BUFFER_LEN]; a = atr_get_noparent(follower, "FOLLOWING"); if (!a) return; /* Not following, so no deletion */ /* Let's take it apart and put it back together w/o leader */ strcpy(ldr, unparse_dbref(leader)); strcpy(tbuf1, uncompress(AL_STR(a))); ! (void) atr_add(follower, "FOLLOWING", ! remove_word(tbuf1, ldr, ' '), GOD, NOTHING); } static void *************** *** 1035,1042 **** if (noisy) { strcpy(msg, tprintf(T("You stop following %s."), Name(leader))); notify_format(leader, T("%s stops following you."), Name(follower)); ! did_it(follower, leader, "UNFOLLOW", msg, "OUNFOLLOW", NULL, ! "AUNFOLLOW", NOTHING); } } --- 1035,1042 ---- if (noisy) { strcpy(msg, tprintf(T("You stop following %s."), Name(leader))); notify_format(leader, T("%s stops following you."), Name(follower)); ! did_it(follower, leader, "UNFOLLOW", msg, "OUNFOLLOW", ! NULL, "AUNFOLLOW", NOTHING); } } *************** *** 1052,1058 **** char *bp; dbref who; int first = 1; - a = atr_get_noparent(player, "FOLLOWERS"); if (!a) return (char *) ""; --- 1052,1057 ---- *************** *** 1085,1091 **** char *bp; dbref who; int first = 1; - a = atr_get_noparent(player, "FOLLOWING"); if (!a) return (char *) ""; --- 1084,1089 ---- *************** *** 1140,1146 **** char *s, *sp; char tbuf1[BUFFER_LEN]; dbref flwr; - a = atr_get_noparent(leader, "FOLLOWERS"); if (!a) return; /* No one's following me */ --- 1138,1143 ---- *************** *** 1167,1173 **** char *s, *sp; char tbuf1[BUFFER_LEN]; dbref ldr; - a = atr_get_noparent(follower, "FOLLOWING"); if (!a) return; /* I'm not following anyone */ --- 1164,1169 ---- *************** *** 1196,1202 **** char *s, *sp; char tbuf1[BUFFER_LEN]; char combuf[BUFFER_LEN]; - if (!com || !*com) return; strcpy(combuf, com); --- 1192,1197 ---- *************** *** 1208,1217 **** while (s) { sp = split_token(&s, ' '); follower = parse_dbref(sp); ! if (GoodObject(follower) && (Location(follower) == loc) && ! (Connected(follower) || IsThing(follower)) && ! (!(DarkLegal(leader) || (Dark(Location(follower)) && !Light(leader))) || ! See_All(follower))) { /* This is a follower who was in the room with the leader. Follow. */ notify_format(follower, T("You follow %s."), Name(leader)); process_command(follower, combuf, follower, 0); --- 1203,1213 ---- while (s) { sp = split_token(&s, ' '); follower = parse_dbref(sp); ! if (GoodObject(follower) && (Location(follower) == loc) ! && (Connected(follower) || IsThing(follower)) ! && (!(DarkLegal(leader) ! || (Dark(Location(follower)) && !Light(leader))) ! || See_All(follower))) { /* This is a follower who was in the room with the leader. Follow. */ notify_format(follower, T("You follow %s."), Name(leader)); process_command(follower, combuf, follower, 0); *** 1_7_6.82/src/match.c Sat, 30 Nov 2002 15:49:22 -0600 dunemush (pennmush/c/2_match.c 1.24.1.1.1.4 660) --- 1_7_6.99(w)/src/match.c Mon, 06 Jan 2003 15:51:32 -0600 dunemush (pennmush/c/2_match.c 1.24.1.1.1.4.1.1.1.1.1.1.1.1.1.1 660) *************** *** 82,88 **** const int type, const long int flags, dbref *last_match, int *match_count); static dbref match_exit(const dbref who, const char *name, ! const int type, const long int flags); static dbref match_exit_internal(const dbref match_who, const char *match_name, const int type, const long int flags, const dbref loc, --- 82,88 ---- const int type, const long int flags, dbref *last_match, int *match_count); static dbref match_exit(const dbref who, const char *name, ! const int type, const long int flags, int *match_count); static dbref match_exit_internal(const dbref match_who, const char *match_name, const int type, const long int flags, const dbref loc, *************** *** 98,103 **** --- 98,104 ---- static dbref choose_thing(const dbref match_who, const int preferred_type, long int flags, dbref thing1, dbref thing2, int *match_count); + extern int check_alias(const char *command, const char *list); /* game.c */ /* A wrapper for returning a match, AMBIGUOUS, or NOTHING *************** *** 210,256 **** match = match_remote_contents(who, name, type, flags, &last_match, &match_count); if (GoodObject(match)) { ! exact_match_count++; exact_match = match; } } if (flags & MAT_NEIGHBOR) { match = match_neighbor(who, name, type, flags, &last_match, &match_count); if (GoodObject(match)) { ! exact_match_count++; exact_match = match; } } if (flags & MAT_POSSESSION) { match = match_possession(who, name, type, flags, &last_match, &match_count); if (GoodObject(match)) { ! exact_match_count++; exact_match = match; } } if (flags & MAT_EXIT) { ! match = match_exit(who, name, type, flags); if (GoodObject(match)) { ! exact_match_count++; exact_match = match; } } if (flags & MAT_CONTAINER) { match = match_container(who, name, type, flags, &last_match, &match_count); if (GoodObject(match)) { ! exact_match_count++; exact_match = match; } } if (flags & MAT_CARRIED_EXIT) { match = match_exit_internal(who, name, type, flags, who, &match_count); if (GoodObject(match)) { ! exact_match_count++; exact_match = match; } } ! if ((flags & MAT_ENGLISH) && !GoodObject(last_match) ! && !GoodObject(exact_match)) { match = match_english(who, name, flags); if (GoodObject(match)) { exact_match_count++; --- 211,257 ---- match = match_remote_contents(who, name, type, flags, &last_match, &match_count); if (GoodObject(match)) { ! exact_match_count += match_count; exact_match = match; } } if (flags & MAT_NEIGHBOR) { match = match_neighbor(who, name, type, flags, &last_match, &match_count); if (GoodObject(match)) { ! exact_match_count += match_count; exact_match = match; } } if (flags & MAT_POSSESSION) { match = match_possession(who, name, type, flags, &last_match, &match_count); if (GoodObject(match)) { ! exact_match_count += match_count; exact_match = match; } } if (flags & MAT_EXIT) { ! match = match_exit(who, name, type, flags, &match_count); if (GoodObject(match)) { ! exact_match_count += match_count; exact_match = match; } } if (flags & MAT_CONTAINER) { match = match_container(who, name, type, flags, &last_match, &match_count); if (GoodObject(match)) { ! exact_match_count += match_count; exact_match = match; } } if (flags & MAT_CARRIED_EXIT) { match = match_exit_internal(who, name, type, flags, who, &match_count); if (GoodObject(match)) { ! exact_match_count += match_count; exact_match = match; } } ! if ((flags & MAT_ENGLISH) && !GoodObject(exact_match) ! && !((flags & MAT_LAST) && GoodObject(last_match))) { match = match_english(who, name, flags); if (GoodObject(match)) { exact_match_count++; *************** *** 365,370 **** --- 366,372 ---- alias_match = lookup_player(match_name); DOLIST(first, first) { if (first == absolute) { + (*match_count)++; return first; } else if (!strcasecmp(Name(first), match_name) || (GoodObject(alias_match) && (alias_match == first))) { *************** *** 372,383 **** /* if there are multiple exact matches, don't match any but * make sure match_count is high enough that we report ambiguity */ - *match_count += 2; *last_match = choose_thing(match_who, type, flags, the_match, first, match_count); return NOTHING; ! } else the_match = first; } else if (string_match(Name(first), match_name)) { *last_match = choose_thing(match_who, type, flags, *last_match, first, match_count); --- 374,386 ---- /* if there are multiple exact matches, don't match any but * make sure match_count is high enough that we report ambiguity */ *last_match = choose_thing(match_who, type, flags, the_match, first, match_count); return NOTHING; ! } else { the_match = first; + (*match_count)++; + } } else if (string_match(Name(first), match_name)) { *last_match = choose_thing(match_who, type, flags, *last_match, first, match_count); *************** *** 418,441 **** } static dbref ! match_exit(who, name, type, flags) const dbref who; const char *name; const int type; const long flags; { dbref loc; loc = (IsRoom(who)) ? who : Location(who); if (DO_GLOBALS) { if (flags & MAT_REMOTES) { if (GoodObject(loc)) ! return match_exit_internal(who, name, type, flags, Zone(loc), NULL); else return NOTHING; } else if (flags & MAT_GLOBAL) ! return match_exit_internal(who, name, type, flags, MASTER_ROOM, NULL); } ! return match_exit_internal(who, name, type, flags, loc, NULL); } static dbref --- 421,447 ---- } static dbref ! match_exit(who, name, type, flags, match_count) const dbref who; const char *name; const int type; const long flags; + int *match_count; { dbref loc; loc = (IsRoom(who)) ? who : Location(who); if (DO_GLOBALS) { if (flags & MAT_REMOTES) { if (GoodObject(loc)) ! return match_exit_internal(who, name, type, flags, Zone(loc), ! match_count); else return NOTHING; } else if (flags & MAT_GLOBAL) ! return match_exit_internal(who, name, type, flags, MASTER_ROOM, ! match_count); } ! return match_exit_internal(who, name, type, flags, loc, match_count); } static dbref *************** *** 449,456 **** { dbref exit_tmp; dbref absolute; - const char *match; - const char *p; dbref the_match = NOTHING; if (!GoodObject(loc) || !match_name || !*match_name) --- 455,460 ---- *************** *** 459,497 **** return NOTHING; absolute = match_absolute(match_name); DOLIST(exit_tmp, Exits(loc)) { ! if (exit_tmp == absolute) { the_match = exit_tmp; ! } else { ! match = Name(exit_tmp); ! while (*match) { ! /* check out this one */ ! for (p = match_name; (*p && DOWNCASE(*p) == DOWNCASE(*match) ! && *match != EXIT_DELIMITER); p++, match++) ; ! /* did we get it? */ ! if (*p == '\0') { ! /* make sure there's nothing afterwards */ ! while (isspace((unsigned char) *match)) ! match++; ! if (*match == '\0' || *match == EXIT_DELIMITER) { ! /* we got it */ ! the_match = ! choose_thing(match_who, type, flags, the_match, exit_tmp, ! match_count); ! goto next_exit; ! } ! } ! /* we didn't get it, find next match */ ! while (*match && *match++ != EXIT_DELIMITER) ; ! while (isspace((unsigned char) *match)) ! match++; ! } ! } ! next_exit: ! ; } return the_match; } static dbref match_remote_contents(who, name, type, flags, last_match, match_count) const dbref who; --- 463,478 ---- return NOTHING; absolute = match_absolute(match_name); DOLIST(exit_tmp, Exits(loc)) { ! if (exit_tmp == absolute) the_match = exit_tmp; ! else if (check_alias(match_name, Name(exit_tmp))) ! the_match = ! choose_thing(match_who, type, flags, the_match, exit_tmp, match_count); } return the_match; } + static dbref match_remote_contents(who, name, type, flags, last_match, match_count) const dbref who; *************** *** 531,536 **** --- 512,518 ---- { int do_loc; int do_cont; + int do_exits, doing_exits; int num, matchnum; char *dupname, *p; char *mname; *************** *** 549,566 **** do_cont = 1; else do_cont = 0; if (do_loc && (!strncasecmp(dupname, "this here ", 10))) { dupname += 10; ! do_cont = 0; } else if (do_loc && (!strncasecmp(dupname, "here ", 5) || !strncasecmp(dupname, "this ", 5))) { dupname += 5; ! do_cont = 0; } else if (do_cont && (!strncasecmp(dupname, "my ", 3) || !strncasecmp(dupname, "me ", 3))) { dupname += 3; ! do_loc = 0; } while (*dupname == ' ') --- 531,555 ---- do_cont = 1; else do_cont = 0; + if (flags & MAT_EXIT) + do_exits = 1; + else + do_exits = 0; if (do_loc && (!strncasecmp(dupname, "this here ", 10))) { dupname += 10; ! do_cont = do_exits = 0; } else if (do_loc && (!strncasecmp(dupname, "here ", 5) || !strncasecmp(dupname, "this ", 5))) { dupname += 5; ! do_cont = do_exits = 0; } else if (do_cont && (!strncasecmp(dupname, "my ", 3) || !strncasecmp(dupname, "me ", 3))) { dupname += 3; ! do_loc = do_exits = 0; ! } else if (do_exits && (!strncasecmp(dupname, "toward ", 7))) { ! dupname += 7; ! do_loc = do_cont = 0; } while (*dupname == ' ') *************** *** 607,624 **** num = 1; } ! while (do_cont || do_loc) { if (do_cont) { item = Contents(who); do_cont = 0; ! } else { item = Contents(Location(who)); do_loc = 0; } matchnum = 0; DOLIST(item, item) { ! if (!strcasecmp(Name(item), dupname) ! || string_match(Name(item), dupname)) { matchnum++; if (matchnum == num) { mush_free(p, "string"); --- 596,619 ---- num = 1; } ! doing_exits = 0; ! while (do_cont || do_loc || do_exits) { if (do_cont) { item = Contents(who); do_cont = 0; ! } else if (do_loc) { item = Contents(Location(who)); do_loc = 0; + } else { + item = Exits(Location(who)); + doing_exits = 1; + do_exits = 0; } matchnum = 0; DOLIST(item, item) { ! if (doing_exits ? (check_alias(dupname, Name(item))) ! : (!strcasecmp(Name(item), dupname) ! || string_match(Name(item), dupname))) { matchnum++; if (matchnum == num) { mush_free(p, "string"); *************** *** 631,636 **** --- 626,632 ---- return NOTHING; } + static dbref choose_thing(match_who, preferred_type, flags, thing1, thing2, match_count) const dbref match_who; *************** *** 671,675 **** } if (match_count) (*match_count)++; ! return (get_random_long(0, 1) ? thing1 : thing2); } --- 667,671 ---- } if (match_count) (*match_count)++; ! return (thing1 > thing2 ? thing1 : thing2); } *** 1_7_6.82/src/look.c Sun, 22 Dec 2002 01:03:36 -0600 dunemush (pennmush/c/4_look.c 1.21.1.2.1.9.1.1 660) --- 1_7_6.99(w)/src/look.c Mon, 06 Jan 2003 15:51:32 -0600 dunemush (pennmush/c/4_look.c 1.21.1.2.1.9.1.1.1.1 660) *************** *** 599,610 **** dbref player; { static char buf[BUFFER_LEN]; CHANLIST *c; if (Chanlist(player)) { ! strcpy(buf, T("Channels:")); ! for (c = Chanlist(player); c; c = c->next) ! sprintf(buf, "%s %s", buf, ChanName(c->chan)); } else strcpy(buf, T("Channels: *NONE*")); return buf; --- 599,615 ---- dbref player; { static char buf[BUFFER_LEN]; + char *bp; CHANLIST *c; if (Chanlist(player)) { ! bp = buf; ! safe_str(T("Channels:"), buf, &bp); ! for (c = Chanlist(player); c; c = c->next) { ! safe_chr(' ', buf, &bp); ! safe_str(ChanName(c->chan), buf, &bp); ! } ! *bp = '\0'; } else strcpy(buf, T("Channels: *NONE*")); return buf; *** 1_7_6.82/src/log.c Sat, 30 Nov 2002 17:42:23 -0600 dunemush (pennmush/c/5_log.c 1.10.1.2.2.4.1.1.2.1 660) --- 1_7_6.99(w)/src/log.c Mon, 06 Jan 2003 15:51:32 -0600 dunemush (pennmush/c/5_log.c 1.10.1.2.2.4.1.1.2.2 660) *************** *** 44,64 **** quick_unparse(object) dbref object; { ! static char buff[BUFFER_LEN]; switch (object) { case NOTHING: ! sprintf(buff, T("*NOTHING*")); break; case AMBIGUOUS: ! sprintf(buff, T("*VARIABLE*")); break; case HOME: ! sprintf(buff, T("*HOME*")); break; default: ! sprintf(buff, "%s(#%d%s)", ! Name(object), object, unparse_flags(object, GOD)); } return buff; --- 44,66 ---- quick_unparse(object) dbref object; { ! static char buff[BUFFER_LEN], *bp; switch (object) { case NOTHING: ! strcpy(buff, T("*NOTHING*")); break; case AMBIGUOUS: ! strcpy(buff, T("*VARIABLE*")); break; case HOME: ! strcpy(buff, T("*HOME*")); break; default: ! bp = buff; ! safe_format(buff, &bp, "%s(#%d%s)", ! Name(object), object, unparse_flags(object, GOD)); ! *bp = '\0'; } return buff; *** 1_7_6.82/src/lock.c Tue, 17 Dec 2002 15:56:03 -0600 dunemush (pennmush/c/6_lock.c 1.17.1.13.1.1 660) --- 1_7_6.99(w)/src/lock.c Mon, 06 Jan 2003 15:51:31 -0600 dunemush (pennmush/c/6_lock.c 1.17.1.13.1.1.1.1 660) *************** *** 382,387 **** --- 382,429 ---- return 1; } + /* Set the lock type on thing to boolexp. + * Used only on db load, when we can't safely test the player's + * permissions because they're not loaded yet. + */ + int + add_lock_raw(dbref player, dbref thing, lock_type type, struct boolexp *key, + int flags) + { + lock_list *ll, **t; + lock_type real_type = type; + + if (!GoodObject(thing)) { + return 0; + } + + ll = next_free_lock(); + if (!ll) { + /* Oh, this sucks */ + do_log(LT_ERR, 0, 0, "Unable to malloc memory for lock_list!"); + } else { + real_type = st_insert(type, &lock_names); + ll->type = real_type; + ll->key = key; + ll->creator = player; + if (flags == -1) { + const lock_list *l2 = get_lockproto(real_type); + if (l2) + ll->flags = l2->flags; + else + ll->flags = 0; + } else { + ll->flags = flags; + } + t = &Locks(thing); + while (*t && strcmp(L_TYPE(*t), L_TYPE(ll)) < 0) + t = &L_NEXT(*t); + L_NEXT(ll) = *t; + *t = ll; + } + return 1; + } + /* Very primitive. */ static void free_one_lock_list(lock_list *ll) *** 1_7_6.82/src/game.c Tue, 17 Dec 2002 00:16:47 -0600 dunemush (pennmush/c/10_game.c 1.50.1.8.1.1.1.1.2.1.1.1.2.1.1.4.1.1.1.1.1.1.1.1.1.1.2.1.1.2.1.1.1.1.1.1.1.2.1.1.1.2.1.1.1.1.1.1.1.1.1.5.1.3.1.2.1.2.1.1 660) --- 1_7_6.99(w)/src/game.c Mon, 06 Jan 2003 15:51:31 -0600 dunemush (pennmush/c/10_game.c 1.50.1.8.1.1.1.1.2.1.1.1.2.1.1.4.1.1.1.1.1.1.1.1.1.1.2.1.1.2.1.1.1.1.1.1.1.2.1.1.1.2.1.1.1.1.1.1.1.1.1.5.1.3.1.2.1.2.1.1.1.1 660) *************** *** 327,332 **** --- 327,335 ---- char tmpfl[2048]; FILE *f = NULL; + #ifndef WIN32 + ignore_signal(SIGPROF); + #endif #ifdef I_SETJMP if (setjmp(db_err)) { /* The dump failed. Disk might be full or something went bad with the *************** *** 334,339 **** --- 337,345 ---- do_rawlog(LT_ERR, T("ERROR! Database save failed.")); flag_broadcast(WIZARD | ROYALTY, 0, T("GAME: ERROR! Database save failed!")); + #ifdef HAS_ITIMER + install_sig_handler(SIGPROF, signal_cpu_limit); + #endif } else { #endif local_dump_database(); *************** *** 408,414 **** #ifdef I_SETJMP } #endif ! } void --- 414,422 ---- #ifdef I_SETJMP } #endif ! #ifdef HAS_ITIMER ! install_sig_handler(SIGPROF, signal_cpu_limit); ! #endif } void *** 1_7_6.82/src/flags.c Sun, 01 Dec 2002 13:48:44 -0600 dunemush (pennmush/c/20_flags.c 1.1.1.1.1.1.1.1.1.1.1.1.1.6.1.2.1.1.1.1.1.2.2.2.2.1.2.1.1.3.1.2.1.1.1.1.1.1.1.1.1.3.1.9.1.2.2.1.1.2 660) --- 1_7_6.99(w)/src/flags.c Mon, 06 Jan 2003 15:51:31 -0600 dunemush (pennmush/c/20_flags.c 1.1.1.1.1.1.1.1.1.1.1.1.1.6.1.2.1.1.1.1.1.2.2.2.2.1.2.1.1.3.1.2.1.1.1.1.1.1.1.1.1.3.1.9.1.2.2.1.1.2.1.1.1.1 660) *************** *** 701,720 **** if (IsThing(thing) && (f->type == TYPE_THING) && GoodObject(Location(thing)) && (hear || listener) && !Hearer(thing) && !Listener(thing)) { ! sprintf(tbuf1, T("%s is no longer listening."), Name(thing)); notify_except(Contents(Location(thing)), NOTHING, tbuf1); notify_except(Contents(thing), NOTHING, tbuf1); } if (IsRoom(thing) && (f->type == TYPE_ROOM) && (f->flag == ROOM_LISTEN) && !hear && !Listener(thing)) { ! sprintf(tbuf1, T("%s is no longer listening."), Name(thing)); notify_except(Contents(thing), NOTHING, tbuf1); } if ((f->flag == AUDIBLE) && (f->type == NOTYPE)) { switch (Typeof(thing)) { case TYPE_EXIT: if (Audible(Source(thing))) { ! sprintf(tbuf1, T("Exit %s is no longer broadcasting."), Name(thing)); notify_except(Contents(Source(thing)), NOTHING, tbuf1); } break; --- 701,727 ---- if (IsThing(thing) && (f->type == TYPE_THING) && GoodObject(Location(thing)) && (hear || listener) && !Hearer(thing) && !Listener(thing)) { ! tp = tbuf1; ! safe_format(tbuf1, &tp, T("%s is no longer listening."), Name(thing)); ! *tp = '\0'; notify_except(Contents(Location(thing)), NOTHING, tbuf1); notify_except(Contents(thing), NOTHING, tbuf1); } if (IsRoom(thing) && (f->type == TYPE_ROOM) && (f->flag == ROOM_LISTEN) && !hear && !Listener(thing)) { ! tp = tbuf1; ! safe_format(tbuf1, &tp, T("%s is no longer listening."), Name(thing)); ! *tp = '\0'; notify_except(Contents(thing), NOTHING, tbuf1); } if ((f->flag == AUDIBLE) && (f->type == NOTYPE)) { switch (Typeof(thing)) { case TYPE_EXIT: if (Audible(Source(thing))) { ! tp = tbuf1; ! safe_format(tbuf1, &tp, T("Exit %s is no longer broadcasting."), ! Name(thing)); ! *tp = '\0'; notify_except(Contents(Source(thing)), NOTHING, tbuf1); } break; *************** *** 767,779 **** GoodObject(Location(thing)) && ((f->flag == THING_PUPPET) || (f->flag == THING_LISTEN)) && !hear && !listener) { ! sprintf(tbuf1, T("%s is now listening."), Name(thing)); notify_except(Contents(Location(thing)), NOTHING, tbuf1); notify_except(Contents(thing), NOTHING, tbuf1); } if (IsRoom(thing) && (f->type == TYPE_ROOM) && (f->flag == ROOM_LISTEN) && !hear && !listener) { ! sprintf(tbuf1, T("%s is now listening."), Name(thing)); notify_except(Contents(thing), NOTHING, tbuf1); } /* notify for audible exits */ --- 774,790 ---- GoodObject(Location(thing)) && ((f->flag == THING_PUPPET) || (f->flag == THING_LISTEN)) && !hear && !listener) { ! tp = tbuf1; ! safe_format(tbuf1, &tp, T("%s is now listening."), Name(thing)); ! *tp = '\0'; notify_except(Contents(Location(thing)), NOTHING, tbuf1); notify_except(Contents(thing), NOTHING, tbuf1); } if (IsRoom(thing) && (f->type == TYPE_ROOM) && (f->flag == ROOM_LISTEN) && !hear && !listener) { ! tp = tbuf1; ! safe_format(tbuf1, &tp, T("%s is now listening."), Name(thing)); ! *tp = '\0'; notify_except(Contents(thing), NOTHING, tbuf1); } /* notify for audible exits */ *************** *** 781,787 **** switch (Typeof(thing)) { case TYPE_EXIT: if (Audible(Source(thing))) { ! sprintf(tbuf1, T("Exit %s is now broadcasting."), Name(thing)); notify_except(Contents(Source(thing)), NOTHING, tbuf1); } break; --- 792,801 ---- switch (Typeof(thing)) { case TYPE_EXIT: if (Audible(Source(thing))) { ! tp = tbuf1; ! safe_format(tbuf1, &tp, T("Exit %s is now broadcasting."), ! Name(thing)); ! *tp = '\0'; notify_except(Contents(Source(thing)), NOTHING, tbuf1); } break; *** 1_7_6.82/src/extmail.c Sun, 22 Dec 2002 01:53:52 -0600 dunemush (pennmush/c/22_extmail.c 1.44.1.7.1.5.1.9.1.1 660) --- 1_7_6.99(w)/src/extmail.c Mon, 06 Jan 2003 15:51:31 -0600 dunemush (pennmush/c/22_extmail.c 1.44.1.7.1.5.1.9.1.1.1.1 660) *************** *** 425,431 **** /* print a mail message(s) */ struct mail *mp; ! char tbuf1[BUFFER_LEN]; char folderheader[BUFFER_LEN]; struct mail_selector ms; int j, folder; --- 425,431 ---- /* print a mail message(s) */ struct mail *mp; ! char tbuf1[BUFFER_LEN], *bp; char folderheader[BUFFER_LEN]; struct mail_selector ms; int j, folder; *************** *** 453,463 **** } else strcpy(folderheader, T("Folder:")); notify(player, DASH_LINE); if (IsPlayer(mp->from)) ! sprintf(tbuf1, "%s", Name(mp->from)); else ! sprintf(tbuf1, "%s (owner: %s)", Name(mp->from), ! Name(Owner(mp->from))); notify_format(player, T ("From: %-55s %s\nDate: %-25s %s %2d Message: %d\nStatus: %s"), --- 453,465 ---- } else strcpy(folderheader, T("Folder:")); notify(player, DASH_LINE); + bp = tbuf1; if (IsPlayer(mp->from)) ! safe_str(Name(mp->from), tbuf1, &bp); else ! safe_format(tbuf1, &bp, "%s (owner: %s)", Name(mp->from), ! Name(Owner(mp->from))); ! *bp = '\0'; notify_format(player, T ("From: %-55s %s\nDate: %-25s %s %2d Message: %d\nStatus: %s"), *** 1_7_6.82/src/db.c Sat, 30 Nov 2002 15:49:22 -0600 dunemush (pennmush/c/25_db.c 1.26.1.1.1.1.1.6 660) --- 1_7_6.99(w)/src/db.c Mon, 06 Jan 2003 15:51:30 -0600 dunemush (pennmush/c/25_db.c 1.26.1.1.1.1.1.6.1.1 660) *************** *** 1056,1062 **** flags = parse_integer(val); /* boolexp */ b = getboolexp(f, type); ! add_lock(creator, i, type, b, flags); } } --- 1056,1062 ---- flags = parse_integer(val); /* boolexp */ b = getboolexp(f, type); ! add_lock_raw(creator, i, type, b, flags); } } *************** *** 1084,1090 **** /* getboolexp() would already have complained. */ return; } else { ! add_lock(Owner(i), i, buf, b, -1); } } ungetc(c, f); --- 1084,1090 ---- /* getboolexp() would already have complained. */ return; } else { ! add_lock_raw(Owner(i), i, buf, b, -1); } } ungetc(c, f); *** 1_7_6.82/hdrs/version.h Sun, 22 Dec 2002 17:19:09 -0600 dunemush (pennmush/c/47_version.h 1.32.1.2.1.7.1.9.1.1.1.17.1.2.1.2 660) --- 1_7_6.99(w)/hdrs/version.h Mon, 06 Jan 2003 15:51:37 -0600 dunemush (pennmush/c/47_version.h 1.32.1.2.1.7.1.9.1.1.1.17.1.2.1.3 660) *************** *** 1,2 **** ! #define VERSION "PennMUSH version 1.7.6 patchlevel 3 [12/22/2002]" ! #define SHORTVN "PennMUSH 1.7.6p3" --- 1,2 ---- ! #define VERSION "PennMUSH version 1.7.6 patchlevel 4 [01/02/2003]" ! #define SHORTVN "PennMUSH 1.7.6p4" *** 1_7_6.82/hdrs/lock.h Wed, 20 Nov 2002 09:43:49 -0600 dunemush (pennmush/d/6_lock.h 1.13 660) --- 1_7_6.99(w)/hdrs/lock.h Mon, 06 Jan 2003 15:51:37 -0600 dunemush (pennmush/d/6_lock.h 1.15 660) *************** *** 54,59 **** --- 54,61 ---- const lock_list *get_lockproto(lock_type type); int add_lock(dbref player, dbref thing, lock_type type, struct boolexp *key, int flags); + int add_lock_raw(dbref player, dbref thing, lock_type type, + struct boolexp *key, int flags); void free_locks(lock_list *ll); int eval_lock(dbref player, dbref thing, lock_type ltype); void do_unlock(dbref player, const char *name, lock_type type); *************** *** 64,82 **** void do_lset(dbref player, char *what, char *flags); const char *lock_flags(lock_list *ll); const char *lock_flags_long(lock_list *ll); - #define L_FLAGS(lock) ((lock)->flags) #define L_CREATOR(lock) ((lock)->creator) #define L_TYPE(lock) ((lock)->type) #define L_KEY(lock) ((lock)->key) #define L_NEXT(lock) ((lock)->next) - /* can p read/evaluate lock l on object x? */ int lock_visual(dbref, lock_type); #define Can_Read_Lock(p,x,l) \ (See_All(p) || controls(p,x) || ((Visual(x) || lock_visual(x, l)) && \ eval_lock(p,x,Examine_Lock))) - /* The actual magic cookies. */ extern const lock_type Basic_Lock; extern const lock_type Enter_Lock; --- 66,81 ---- *************** *** 101,107 **** extern const lock_type Dropto_Lock; /* Who follows the dropto of this room? */ extern const lock_type Destroy_Lock; /* Who can @dest me if I'm dest_ok? */ /* Declare new lock types here! */ - #include "boolexp.h" - #endif /* __LOCK_H */ --- 100,104 ---- *** 1_7_6.82/hdrs/game.h Mon, 26 Aug 2002 19:47:41 -0500 dunemush (pennmush/d/12_game.h 1.28.1.2.1.1.1.1.1.1.1.7 660) --- 1_7_6.99(w)/hdrs/game.h Mon, 06 Jan 2003 15:51:34 -0600 dunemush (pennmush/d/12_game.h 1.28.1.2.1.1.1.1.1.1.1.7.1.1 660) *************** *** 159,164 **** --- 159,165 ---- /* From timer.c */ extern void init_timer(void); + extern void signal_cpu_limit(int signo); /* From version.c */ extern void do_version(dbref player); *** 1_7_6.82/hdrs/externs.h Sat, 09 Nov 2002 19:47:06 -0600 dunemush (pennmush/d/16_externs.h 1.1.1.53.1.2.1.8.2.1.1.2.1.1.1.1.1.2.1.6.1.3.1.4 660) --- 1_7_6.99(w)/hdrs/externs.h Mon, 06 Jan 2003 15:51:33 -0600 dunemush (pennmush/d/16_externs.h 1.1.1.53.1.2.1.8.2.1.1.2.1.1.1.1.1.2.1.6.1.3.1.4.3.1 660) *************** *** 178,185 **** extern void do_move(dbref player, const char *direction, int type); extern void moveto(dbref what, dbref where); extern void safe_tel(dbref player, dbref dest, int nomovemsgs); ! extern dbref global_exit(dbref player, const char *direction); ! extern dbref remote_exit(dbref loc, const char *direction); extern void move_wrapper(dbref player, const char *command); extern void do_follow(dbref player, const char *arg); extern void do_unfollow(dbref player, const char *arg); --- 178,185 ---- extern void do_move(dbref player, const char *direction, int type); extern void moveto(dbref what, dbref where); extern void safe_tel(dbref player, dbref dest, int nomovemsgs); ! extern int global_exit(dbref player, const char *direction); ! extern int remote_exit(dbref loc, const char *direction); extern void move_wrapper(dbref player, const char *command); extern void do_follow(dbref player, const char *arg); extern void do_unfollow(dbref player, const char *arg); *** 1_7_6.82/win32/funs.h Sun, 22 Dec 2002 00:51:08 -0600 dunemush (pennmush/f/12_funs.h 1.11.1.9.2.8.2.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.8.1.3.1.7.1.1.1.1.1.1.1.1 660) --- 1_7_6.99(w)/win32/funs.h Mon, 06 Jan 2003 12:47:57 -0600 dunemush (pennmush/f/12_funs.h 1.11.1.9.2.8.2.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.8.1.3.1.7.1.1.1.1.1.1.1.1.1.1 660) *************** *** 310,312 **** --- 310,313 ---- FUNCTION_PROTO(fun_zemit); FUNCTION_PROTO(fun_zfun); FUNCTION_PROTO(fun_zone); + FUNCTION_PROTO(local_fun_silly); *** 1_7_6.82/win32/cmds.h Sun, 22 Dec 2002 00:51:08 -0600 dunemush (pennmush/f/15_cmds.h 1.9.1.4.1.1.1.1.1.1.1.1.2.1.1.1.2.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.7.2.4 660) --- 1_7_6.99(w)/win32/cmds.h Mon, 06 Jan 2003 12:47:57 -0600 dunemush (pennmush/f/15_cmds.h 1.9.1.4.1.1.1.1.1.1.1.1.2.1.1.1.2.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.7.2.4.1.1 660) *************** *** 62,67 **** --- 62,68 ---- COMMAND_PROTO(cmd_link); COMMAND_PROTO(cmd_list); COMMAND_PROTO(cmd_listmotd); + COMMAND_PROTO(cmd_local_silly); COMMAND_PROTO(cmd_lock); COMMAND_PROTO(cmd_log); COMMAND_PROTO(cmd_logwipe);