Include division tree in @scan and scan()
authorAri Johnson <ari@theari.com>
Thu, 6 Jun 2013 15:38:36 +0000 (11:38 -0400)
committerAri Johnson <ari@theari.com>
Thu, 6 Jun 2013 15:58:47 +0000 (11:58 -0400)
hdrs/game.h
src/SWITCHES
src/cmds.c
src/command.c
src/game.c

index 6f061b6439f7407532a0d1f3b6806913db752884..d2d6504154e1248f19c129a3ed8491d525867d6f 100644 (file)
@@ -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 */
index 8afca236ec890209f72fc5a23eb43733e72e4436..9ba42d0f9198ba96f2c191ed884ecb3c815a410f 100644 (file)
@@ -38,6 +38,7 @@ DELIMIT
 DESCRIBE
 DESTROY
 DISABLE
+DIVISION
 DOWN
 DSTATS
 EMIT
index 7d73e492abb3ab46471acf1c6de7955ae8104a48..3231b902fde48f0125ea878194fa05e638be8101 100644 (file)
@@ -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);
 }
 
index a8c8e190f619ba6c2ca6ce9d062d06cf78df5d31..24530b06d8f2ca6255ee5a06b70f042035bf1476 100644 (file)
@@ -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,
index 15b639f04d069aad892e4810633a030c069e0a47..56f09f27a4b9e999011a21121dc2701139851b27 100644 (file)
@@ -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)