From 61efb21c297cd9b40724050bc17317a7df3b0410 Mon Sep 17 00:00:00 2001 From: Ari Johnson Date: Thu, 6 Jun 2013 11:38:36 -0400 Subject: [PATCH] Include division tree in @scan and scan() --- hdrs/game.h | 1 + src/SWITCHES | 1 + src/cmds.c | 8 +++++--- src/command.c | 5 ++++- src/game.c | 26 ++++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 4 deletions(-) diff --git a/hdrs/game.h b/hdrs/game.h index 6f061b6..d2d6504 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 8afca23..9ba42d0 100644 --- a/src/SWITCHES +++ b/src/SWITCHES @@ -38,6 +38,7 @@ DELIMIT DESCRIBE DESTROY DISABLE +DIVISION DOWN DSTATS EMIT diff --git a/src/cmds.c b/src/cmds.c index 7d73e49..3231b90 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -948,15 +948,17 @@ 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) -{ +COMMAND (cmd_search) { do_search(player, arg_left, args_right); } diff --git a/src/command.c b/src/command.c index a8c8e19..24530b0 100644 --- a/src/command.c +++ b/src/command.c @@ -270,7 +270,10 @@ COMLIST commands[] = { CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED, NULL}, {"@REJECTMOTD", NULL, cmd_rejectmotd, CMD_T_ANY, "POWER^SITE"}, {"@RESTART", "ALL", cmd_restart, CMD_T_ANY | CMD_T_NOGAGGED, NULL}, - {"@SCAN", "ROOM SELF ZONE GLOBALS", cmd_scan, +#ifdef RPMODE_SYS + {"@CRPLOG", "QUIET RESET COMBAT", cmd_rplog, CMD_T_ANY, "POWER^COMBAT"}, +#endif + {"@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 15b639f..56f09f2 100644 --- a/src/game.c +++ b/src/game.c @@ -1739,6 +1739,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)) { @@ -1878,6 +1890,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) -- 2.30.2