--- deliantra/server/common/treasure.C 2006/12/12 22:37:05 1.25 +++ deliantra/server/common/treasure.C 2006/12/20 09:14:21 1.27 @@ -260,7 +260,7 @@ if (!name_) return 0; - for (treasurelist * tl = first_treasurelist; tl != 0; tl = tl->next) + for (treasurelist *tl = first_treasurelist; tl != 0; tl = tl->next) if (name_ == tl->name) return tl; @@ -282,8 +282,6 @@ * abilities. This is used by summon spells, thus no summoned monsters * start with equipment, but only their abilities). */ - - static void put_treasure (object *op, object *creator, int flags) { @@ -304,9 +302,11 @@ else { op = insert_ob_in_ob (op, creator); + if ((flags & GT_APPLY) && QUERY_FLAG (creator, FLAG_MONSTER)) monster_check_apply (creator, op); - if ((flags & GT_UPDATE_INV) && (tmp = is_player_inv (creator)) != NULL) + + if ((flags & GT_UPDATE_INV) && (tmp = creator->in_player ())) esrv_send_item (tmp, op); } } @@ -341,7 +341,11 @@ if (t->name) { if (strcmp (t->name, "NONE") && difficulty >= t->magic) - create_treasure (find_treasurelist (t->name), op, flag, difficulty, tries); + { + treasurelist *tl = find_treasurelist (t->name); + if (tl) + create_treasure (tl, op, flag, difficulty, tries); + } } else { @@ -399,7 +403,11 @@ return; if (difficulty >= t->magic) - create_treasure (find_treasurelist (t->name), op, flag, difficulty, tries); + { + treasurelist *tl = find_treasurelist (t->name); + if (tl) + create_treasure (tl, op, flag, difficulty, tries); + } else if (t->nrof) create_one_treasure (tl, op, flag, difficulty, tries); @@ -1266,7 +1274,8 @@ fprintf (logfile, " "); fprintf (logfile, "{ (list: %s)\n", &t->name); tl = find_treasurelist (t->name); - dump_monster_treasure_rec (name, tl->items, depth + 2); + if (tl) + dump_monster_treasure_rec (name, tl->items, depth + 2); for (i = 0; i < depth; i++) fprintf (logfile, " "); fprintf (logfile, "} (end of list: %s)\n", &t->name);