wear.c
untermud/CMD/wear.c · 1.2 KB
From the archive untermud-2.4-r22.tar.gz
Download the archive « Back to the archive contents
/*
Copyright (C) 1991, Marcus J. Ranum. All rights reserved.
*/
#include "config.h"
#include "mud.h"
#include "match.h"
#include "vars.h"
/* ARGSUSED */
int cmd_wear (int ac, char *av[], char *who, char *aswho)
{
char ob[MAXOID];
char *ud;
if (matchinv (who, av[1], 0, MTCH_UNIQ | MTCH_QUIET, ob))
return (UERR_NOMATCH);
ud = ut_getatt (who, 0, typ_list, var_wearing, (char *) 0);
if (ud != (char *) 0 && lstcnt (ud) > 5) {
say (who, "You can wear up to 5 things at once.\n", (char *) 0);
return (UERR_PERM);
}
if (ut_listdel (who, who, var_cont, ob))
return (UERR_FATAL);
if (ut_listadd (who, who, var_wearing, ob))
return (UERR_FATAL);
say (who, "You are now wearing ", ut_name (ob), ".\n", (char *) 0);
return (UERR_NONE);
}
/* ARGSUSED */
int cmd_unwear (int ac, char *av[], char *who, char *aswho)
{
char ob[MAXOID];
if (matchwear (who, av[1], MTCH_UNIQ | MTCH_QUIET, ob))
return (UERR_NOMATCH);
if (ut_listdel (who, who, var_wearing, ob))
return (UERR_FATAL);
if (ut_listadd (who, who, var_cont, ob))
return (UERR_FATAL);
say (who, "You take off ", ut_name (ob), ".\n", (char *) 0);
return (UERR_NONE);
}