TinyMAZE/
TinyMAZE/config/
TinyMAZE/doc/
TinyMAZE/run/msgs/
TinyMAZE/src/
TinyMAZE/src/db/
TinyMAZE/src/ident/
TinyMAZE/src/io/
TinyMAZE/src/prog/
TinyMAZE/src/softcode/
TinyMAZE/src/util/
#include "db.h"
#include "config.h"
#include "externs.h"
#include "powers.h"

static int is_carrying_something(OBJ *player)
{
  return((player->contents)?1:0);
}

void do_inventory(OBJ *player, char *arg)
{
  OBJ *thing;
  OBJ *who;

  if(!*arg)
    who = player;
  else
  {
    who = match_object(player, arg, TYPE_PLAYER);
    if(!who)
    {
      notify(player, no_match(arg));
      return;
    }

    if(!controls(player, who, POW_EXAMINE))
    {
      notify(player, perm_denied());
      return;
    }
  }

  if(!is_carrying_something(who))
  {
    if(player == who)
      notify(player, "|+W|You aren't carrying anything.");
    else
      notify(player, tprintf("%s |+W|isn't carrying anything.",
        name(who)));
    return;
  }
  notify(player, tprintf("|+B|.%s.", my_string("-", 76)));
  notify(player, tprintf("|+B|||+W|%s|+B||",
    my_center("Inventory", 76)));
  notify(player, tprintf("|+B||%s|", my_string("-", 76)));

  for(thing = who->contents;thing;thing = thing->next_con)
    notify(player, tprintf("|+B|||n| %s |+B||",
      my_ljust(unparse_object(player, thing), 74)));

  notify(player, tprintf("|+B|`%s'", my_string("-", 76)));
}