Allow ps(all)
authorAri Johnson <ari@theari.com>
Thu, 19 Feb 2015 20:12:50 +0000 (15:12 -0500)
committerAri Johnson <ari@theari.com>
Thu, 19 Feb 2015 20:12:50 +0000 (15:12 -0500)
game/txt/hlp/cobra_func.hlp
src/cque.c

index e5f9404fcbf8a94da355d2c3ebc2c406a04da4c5..01415f3fc574faf71849e66ff8c6d9beefd69073 100644 (file)
@@ -4732,7 +4732,8 @@ wait(<object>/<time>,<functions>)
   ps([<object>[,<type]])
 
   Lists currently pending QIDs. If <object> is not specified, then the
-  executor's queue is listed. <type> is one of:
+  executor's queue is listed. If <object> is ALL, then all players' queues
+  are listed. <type> is one of:
     player    - list the player queue
     object    - list the object queue
     wait      - list the wait queue
index 7b880ffcad49a221c571e526274b63bd66108f30..9bc9986919670ba288895608d0ff45438060438d 100644 (file)
@@ -1822,7 +1822,8 @@ fun_ps_helper(dbref executor, dbref thing, BQUE *qptr, char *buff, char **bp,
 
   for (tmp = qptr; tmp; tmp = tmp->next) {
     if (GoodObject(tmp->player)) {
-      if (Owner(tmp->player) == thing) {
+      if ((thing == NOTHING && CanSeeQ(executor, Owner(tmp->player)))
+         || (Owner(tmp->player) == thing)) {
         if (count)
           safe_chr(' ', buff, bp);
         safe_integer(tmp->qid, buff, bp);
@@ -1843,17 +1844,21 @@ FUNCTION(fun_ps) {
       safe_str(T("INVALID ARGUMENT"), buff, bp);
       return;
     }
-    thing = match_result(executor, args[0], NOTYPE, MAT_EVERYTHING);
-    if (thing == NOTHING) {
-      safe_str(T(e_match), buff, bp);
-      return;
-    } else if (thing == AMBIGUOUS) {
-      safe_str(T("#-1 AMBIGUOUS MATCH"), buff, bp);
-      return;
-    }
-    if (!CanSeeQ(executor, thing)) {
-      safe_str(T(e_perm), buff, bp);
-      return;
+    if (!strcasecmp(args[0], "all")) {
+      thing = NOTHING;
+    } else {
+      thing = match_result(executor, args[0], NOTYPE, MAT_EVERYTHING);
+      if (thing == NOTHING) {
+        safe_str(T(e_match), buff, bp);
+        return;
+      } else if (thing == AMBIGUOUS) {
+        safe_str(T("#-1 AMBIGUOUS MATCH"), buff, bp);
+        return;
+      }
+      if (!CanSeeQ(executor, thing)) {
+        safe_str(T(e_perm), buff, bp);
+        return;
+      }
     }
   }