From: Ari Johnson Date: Thu, 6 Jun 2013 15:38:36 +0000 (-0400) Subject: Include division tree in @scan and scan() X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=cbaf0cedf248addac015c5c1ee78fac8d0aeb8c4;p=cobramush.git Include division tree in @scan and scan() --- diff --git a/hdrs/game.h b/hdrs/game.h index abf45a3..39e519f 100644 --- a/hdrs/game.h +++ b/hdrs/game.h @@ -11,6 +11,7 @@ #define CHECK_HERE 0x80 #define CHECK_ZONE 0x100 #define CHECK_GLOBAL 0x200 +#define CHECK_DIVISION 0x400 /* hash table stuff */ extern void init_func_hashtab(void); /* eval.c */ diff --git a/src/SWITCHES b/src/SWITCHES index 38d83ca..cc95773 100644 --- a/src/SWITCHES +++ b/src/SWITCHES @@ -37,6 +37,7 @@ DELIMIT DESCRIBE DESTROY DISABLE +DIVISION DOWN DSTATS EMIT diff --git a/src/cmds.c b/src/cmds.c index eac532d..f57fb7f 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -816,11 +816,14 @@ COMMAND (cmd_scan) { do_scan(player, arg_left, CHECK_INVENTORY | CHECK_SELF); else if (SW_ISSET(sw, SWITCH_ZONE)) do_scan(player, arg_left, CHECK_ZONE); + else if (SW_ISSET(sw, SWITCH_DIVISION)) + do_scan(player, arg_left, CHECK_DIVISION); else if (SW_ISSET(sw, SWITCH_GLOBALS)) do_scan(player, arg_left, CHECK_GLOBAL); else do_scan(player, arg_left, CHECK_INVENTORY | CHECK_NEIGHBORS | - CHECK_SELF | CHECK_HERE | CHECK_ZONE | CHECK_GLOBAL); + CHECK_SELF | CHECK_HERE | CHECK_ZONE | CHECK_DIVISION | + CHECK_GLOBAL); } COMMAND (cmd_search) { diff --git a/src/command.c b/src/command.c index d71f3a5..cca892d 100644 --- a/src/command.c +++ b/src/command.c @@ -250,7 +250,7 @@ COMLIST commands[] = { #ifdef RPMODE_SYS {"@CRPLOG", "QUIET RESET COMBAT", cmd_rplog, CMD_T_ANY, "POWER^COMBAT"}, #endif - {"@SCAN", "ROOM SELF ZONE GLOBALS", cmd_scan, + {"@SCAN", "ROOM SELF ZONE DIVISION GLOBALS", cmd_scan, CMD_T_ANY | CMD_T_NOGAGGED, NULL}, {"@SD", "LOGOUT", cmd_su, CMD_T_ANY, NULL}, {"@SEARCH", NULL, cmd_search, diff --git a/src/game.c b/src/game.c index 7df66d8..19b6b20 100644 --- a/src/game.c +++ b/src/game.c @@ -1712,6 +1712,18 @@ scan_list(dbref player, char *command) } } ptr = atrname; + if (GoodObject(Division(player))) { + /* try division tree */ + for (thing = Division(player); GoodObject(thing); + thing = Division(thing)) { + if (ScanFind(player, thing)) { + *ptr = '\0'; + safe_str(atrname, tbuf, &tp); + ptr = atrname; + } + } + } + ptr = atrname; if ((Location(player) != MASTER_ROOM) && (Zone(Location(player)) != MASTER_ROOM) && (Zone(player) != MASTER_ROOM)) { @@ -1851,6 +1863,20 @@ do_scan(dbref player, char *command, int flag) } } ptr = atrname; + if ((flag & CHECK_DIVISION) && GoodObject(Division(player))) { + /* try division tree */ + notify(player, T("Matches on objects in the division tree:")); + for (thing = Division(player); GoodObject(thing); + thing = Division(thing)) { + if (ScanFind(player, thing)) { + *ptr = '\0'; + notify_format(player, "%s [%d:%s]", + unparse_object(player, thing), num, atrname); + ptr = atrname; + } + } + } + ptr = atrname; if ((flag & CHECK_GLOBAL) && (Location(player) != MASTER_ROOM) && (Zone(Location(player)) != MASTER_ROOM)