inventory.c
TinyMAZE/src/comm/inventory.c · 1.1 KB
From the archive TinyMAZEv2.5a.tar.gz
Download the archive « Back to the archive contents
#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)));
}