"home" is now a regular command
authorAri Johnson <ari@cobramush.org>
Tue, 20 Feb 2007 22:36:41 +0000 (22:36 +0000)
committerAri Johnson <ari@cobramush.org>
Tue, 20 Feb 2007 22:36:41 +0000 (22:36 +0000)
game/txt/hlp/cobratop.hlp
src/cmds.c
src/command.c
src/game.c
src/move.c
win32/cmds.h

index 1719792346e2284c32d99714ba541a97a633dde0..4f095c157de91fb467a956b739309fc712544efd 100644 (file)
@@ -557,7 +557,6 @@ Standard Attributes: (see @list/attribs for the complete list)
   order of possible commands:
 
     Special game commands: WHO, QUIT, etc.
-    "home" command
     Single-token commands: ", :, ;, +
     Exits in the room
     @-commands
index 9235ed61a04ec8bc8ab41a57acf07c1599c87d02..f74131d55924b9580ad8f44b18e392a971e9b6d2 100644 (file)
@@ -483,6 +483,15 @@ COMMAND (cmd_huh_command) {
     notify(player, MSG_HUH);
 }
 
+COMMAND (cmd_home) {
+  if (!Mobile(player))
+    return;
+  if (Fixed(player))
+    notify(player, T("You can't do that IC!"));
+  else
+    do_move(player, "home", MOVE_NORMAL);
+}
+
 COMMAND (cmd_kick) {
   do_kick(player, arg_left);
 }
index e1fece1e8dc1ba4d2872be3f85410510098f172d..052534e4d16f5056f94aba0c7151fc198c11c224 100644 (file)
@@ -317,6 +317,7 @@ COMLIST commands[] = {
   {"GET", NULL, cmd_get, CMD_T_PLAYER | CMD_T_THING | CMD_T_NOGAGGED, NULL},
   {"GIVE", "SILENT", cmd_give, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED, NULL},
   {"GOTO", NULL, cmd_goto, CMD_T_PLAYER | CMD_T_THING, NULL},
+  {"HOME", NULL, cmd_home, CMD_T_PLAYER | CMD_T_THING, NULL},
   {"INVENTORY", NULL, cmd_inventory, CMD_T_ANY, NULL},
 
   {"LOOK", "OUTSIDE", cmd_look, CMD_T_ANY, NULL},
@@ -957,7 +958,7 @@ command_parse(dbref player, dbref cause, dbref realcause, char *string, int from
      * usual processing. Exits have next priority.  We still pass them
      * through the parser so @hook on GOTO can work on them.
      */
-    if (can_move(player, p)) {
+    if (strcasecmp(p, "home") && can_move(player, p)) {
       ec = exit_command;
       safe_str("GOTO ", exit_command, &ec);
       safe_str(p, exit_command, &ec);
index e3adc1d235ead70351c0426a70bb78a333be887b..316dc0228fa8738dfd1d2a7d8ff2be77c0d3745d 100644 (file)
@@ -1102,7 +1102,7 @@ passwd_filter(const char *cmd)
 
 /** Attempt to match and execute a command.
  * This function performs some sanity checks and then attempts to
- * run a command. It checks, in order: home, built-in commands,
+ * run a command. It checks, in order:  built-in commands,
  * enter aliases, leave aliases, $commands on neighboring objects or
  * the player, $commands on the container, $commands on inventory,
  * exits in the zone master room, $commands on objects in the ZMR,
@@ -1200,18 +1200,6 @@ process_command(dbref player, char *command, dbref cause, dbref realcause,  int
       raw_notify(Owner(player), tprintf("#%d] %s", player, msg));
   }
 
-  /* important home checking comes first! */
-  if (strcmp(command, "home") == 0) {
-    if (!Mobile(player))
-      return;
-    if (Fixed(player))
-      notify(player, T("You can't do that IC!"));
-    else
-      do_move(player, command, 0);
-    return;
-  }
-
-
   strcpy(unp, command);
 
   cptr = command_parse(player, cause, realcause, command, from_port);
index a51d450d70bb40eb87bdc9a30b8ecccf017e15ed..a7d557c4ca3d7e166554ddb0ecb3010df7dd87aa 100644 (file)
@@ -301,12 +301,16 @@ safe_tel(dbref player, dbref dest, int nomovemsgs)
 int
 can_move(dbref player, const char *direction)
 {
-  if (!strcasecmp(direction, "home") && !Fixed(player) && !RPMODE(player))
-    return 1;
-
-  /* otherwise match on exits - don't use GoodObject here! */
-  return (match_result(player, direction, TYPE_EXIT, MAT_ENGLISH | MAT_EXIT) !=
+  int ok;
+  if (!strcasecmp(direction, "home")) {
+    ok = !Fixed(player);
+    ok = ok && command_check_byname(player, "HOME");
+  } else {
+    /* otherwise match on exits - don't use GoodObject here! */
+    ok = (match_result(player, direction, TYPE_EXIT, MAT_ENGLISH | MAT_EXIT) !=
          NOTHING);
+  }
+  return ok;
 }
 
 static dbref
@@ -355,7 +359,7 @@ void
 do_move(dbref player, const char *direction, enum move_type type)
 {
   dbref exit_m, loc, var_dest;
-  if(!strcasecmp(direction, "home") && (RPMODE(player) || Fixed(player))) {
+  if(!strcasecmp(direction, "home") && can_move(player, "home")) {
          notify(player, "Not right now pal.");
          return;
   }
@@ -365,7 +369,7 @@ do_move(dbref player, const char *direction, enum move_type type)
     return;
   }
 #endif
-  if (!strcasecmp(direction, "home")) {
+  if (!strcasecmp(direction, "home") && can_move(player, "home")) {
     /* send him home */
     /* but steal all his possessions */
     if (!Mobile(player) || !GoodObject(Home(player)) ||
index 217b3b78b8243939b229206332c310ee0962c434..ab0a8565dbae610e109681350cdd61e9c09c34e6 100644 (file)
@@ -59,6 +59,7 @@ COMMAND_PROTO(cmd_grep);
 COMMAND_PROTO(cmd_halt);
 COMMAND_PROTO(cmd_helpcmd);
 COMMAND_PROTO(cmd_hide);
+COMMAND_PROTO(cmd_home);
 COMMAND_PROTO(cmd_hook);
 COMMAND_PROTO(cmd_huh_command);
 COMMAND_PROTO(cmd_inventory);