2 "$Id: item.c 9201 2008-06-01 17:32:45Z anmaster $";
62 else if (strstr(name,
item_types[type][pos]) != NULL) {
64 fprintf(stderr,
"Returning type %d for %s\n", type, name);
71 LOG(
LOG_WARNING,
"common::get_type_from_name",
"Could not find match for %s", name);
82 newitem->
env->
inv = newitem;
87 before->
prev = newitem;
88 newitem->
next = before;
97 item *itmp, *last = NULL;
104 if (!it->
env || it->
env == it || it->
env == map) {
129 for (itmp = it->
env->
inv; itmp != NULL; itmp = itmp->
next) {
136 }
else if (itmp->
type == it->
type) {
183 static const char numbers[21][20] = {
184 "no",
"a",
"two",
"three",
"four",
185 "five",
"six",
"seven",
"eight",
"nine",
186 "ten",
"eleven",
"twelve",
"thirteen",
"fourteen",
187 "fifteen",
"sixteen",
"seventeen",
"eighteen",
"nineteen",
193 snprintf(buf,
sizeof(buf),
"negative");
200 snprintf(buf,
sizeof(buf),
"%u", i);
247 for (i = 1; i < nrof; i++) {
277 for (; op; op = op->
next) {
278 if (op->
tag == tag) {
323 if (!op || op == player || op == map) {
351 if (op->
next != NULL) {
401 for (tmp = env->
inv; tmp && tmp->
next; tmp = tmp->
next)
430 free_items = free_items->
next;
432 free_items->
prev = NULL;
448 for (tmp = free_items; tmp; tmp = tmp->
next) {
459 "",
" (readied)",
" (wielded)",
" (worn)",
" (active)",
" (applied)",
466 strcat(op->
flags,
" *");
472 strcat(op->
flags,
" (undefined)");
476 strcat(op->
flags,
" (open)");
479 strcat(op->
flags,
" (damned)");
482 strcat(op->
flags,
" (cursed)");
485 strcat(op->
flags,
" (magic)");
488 strcat(op->
flags,
" (unpaid)");
512 printf(
"Error in set_item_values(): item pointer is NULL.\n");
540 if (op->
nrof != nrof) {
552 op->
weight = (float)weight/1000;
581 snprintf((
char*)buf,
sizeof(buf),
"lock %c %d", !op->
locked, op->
tag);
598 snprintf((
char*)buf,
sizeof(buf),
"mark %d", op->
tag);
619 int anim,
int animspeed,
uint32 nrof,
int type) {
625 if (player->
tag == tag) {
631 player->
weight = (float)weight/1000;
641 if (ip && ip->
env != env) {
646 anim, animspeed, nrof, type);
669 snprintf(buf,
sizeof(buf),
"%s's inventory (%d):", op->
d_name, op->
tag);
670 snprintf(buf2,
sizeof(buf2),
"%-*s%6.1f kg", info_width-10, buf, op->
weight);
675 for (tmp = op->
inv; tmp; tmp = tmp->
next) {
676 snprintf(buf,
sizeof(buf),
"%*s- %d %s%s (%d)", l-2,
"", tmp->
nrof, tmp->
d_name, tmp->
flags, tmp->
tag);
677 snprintf(buf2,
sizeof(buf2),
"%-*s%6.1f kg", info_width-8-l, buf, tmp->
nrof*tmp->
weight);
692 for (ip = player->
inv; ip; ip = ip->
next) {
753 return (it->
type == 661);
761 LOG(
LOG_WARNING,
"common::inscribe_magical_scroll",
"Called when server doesn't handle inscribe command.");
764 snprintf((
char*)buf,
sizeof(buf),
"inscribe 0 %d %d", scroll->
tag, spell->
tag);
Animations animations[MAXANIM]
void SockList_Init(SockList *sl, uint8 *buf)
static void add_item(item *env, item *op)
int can_write_spell_on(item *it)
void script_monitor_str(const char *command)
item * create_new_item(item *env, sint32 tag)
void animate_objects(void)
void item_event_container_clearing(item *container)
void item_event_item_deleting(item *it)
static item * new_item(void)
int SockList_Send(SockList *sl, int fd)
struct item_struct * next
static void insert_item_before_item(item *newitem, item *before)
static void get_flags(item *op, uint16 flags)
void item_event_item_changed(item *it)
static item * alloc_items(int nrof)
void SockList_AddInt(SockList *sl, uint32 data)
void LOG(LogLevel level, const char *origin, const char *format,...)
void set_item_values(item *op, char *name, sint32 weight, uint16 face, uint16 flags, uint16 anim, uint16 animspeed, uint32 nrof, uint16 type)
static void set_flag_string(item *op)
const char * get_number(uint32 i)
void inscribe_magical_scroll(item *scroll, Spell *spell)
void SockList_AddString(SockList *sl, const char *str)
void send_mark_obj(item *op)
void toggle_locked(item *op)
void SockList_AddChar(SockList *sl, char c)
static const char *const item_types[256][64]
item * locate_item(sint32 tag)
void print_inventory(item *op)
void update_item(int tag, int loc, char *name, int weight, int face, int flags, int anim, int animspeed, uint32 nrof, int type)
void remove_item_inventory(item *op)
struct item_struct * prev
uint8 get_type_from_name(const char *name)
void draw_info(const char *str, int color)
const char *const rcsid_common_item_c
void free_all_items(item *op)
void remove_item(item *op)
static const char *const apply_string[]
void update_item_sort(item *it)
static item * locate_item_from_item(item *op, sint32 tag)