/* move_player code where move_player("Z#/room/church") would move the player
   to /room/church without displaying any messages, freeing the wizard to
   create any sort of entrance/exit messages he wished.
   
   Also sets clear_fight_area() for any non-NPC, to clear up any problems
   with fight_area flags persisting after the area is left
*/

move_player(dir_dest)
{
  string dir, dest;
  object ob;
  int is_light;
  
  if(!dir_dest)
    return 0;

  if (sscanf(dir_dest, "%s#%s", dir, dest) != 2) {
    tell_object(this_object(), "Move to bad dir/dest\n");
    return;
  }
  current_room = dest;
  hunting_time -= 1;
  if (hunting_time == 0) {
    if (hunter)
      call_other(hunter, "stop_hunter");
    hunter = 0;
    hunted = 0;
  }
  if (attacker_ob && present(attacker_ob)) {
    hunting_time = 10;
    tell_object(this_object(), "You are now hunted by " +
		call_other(attacker_ob, "query_name", 0) + ".\n");
    hunter = attacker_ob;
  }
  if (!msgout)
    msgout = "leaves";
  is_light = set_light(0);
  if (is_light < 0)
    is_light = 0;
  if(dir!="Z") {
    if (ghost)
      say(NAME_OF_GHOST + " " + msgout + " " + dir + ".\n");
    else if (dir == "X" && query_invis() < INVIS_TELEPORT)
      say(cap_name + " " + mmsgout + ".\n");
    else if (query_invis() < NO_MOVE && is_light)
      say(cap_name + " " + msgout + " " + dir + ".\n");
  }
  move_object(this_object(), dest);
  is_light = set_light(0);
  if (is_light < 0)
    is_light = 0;
  if (level >= 20)
    tell_object(this_object(), dest + "\n");
  if(dir!="Z") {
    if (!msgin)
      msgin = "arrives";
    if (ghost && is_light)
      say(NAME_OF_GHOST + " " + msgin + ".\n");
    else if (query_invis() < INVIS_TELEPORT && dir == "X")
      say(cap_name + " " + mmsgin + ".\n");
    else if (query_invis() < NO_MOVE && is_light)
      say(cap_name + " " + msgin + ".\n");
  }
  if (hunted && present(hunted))
    attack_object(hunted);
  if (hunter && present(hunter))
    call_other(hunter, "attack_object", this_object());
  if (is_npc)
    return;
  this_object()->clear_fight_area();  /* clear pk area for EVERY move */
  if (!is_light) {
    write("A dark room.\n");
    return;
  }
  ob = environment(this_object());
  if (brief) {
    write(call_other(ob, "short", 0)); 
    write(".\n"); /* killed '+' --Wulkwa */
  } else
    call_other(ob, "long", 0);
  ob = first_inventory(ob);
  while(ob) {
    if (ob != this_object()) {
      string short_str;
      short_str = call_other(ob, "short");
      if (short_str)
	write(short_str + ".\n");
    }
    ob = next_inventory(ob);
  }
}
