--- deliantra/server/common/treasure.C 2009/11/06 12:27:05 1.88 +++ deliantra/server/common/treasure.C 2009/11/16 22:31:13 1.95 @@ -54,11 +54,10 @@ static tl_map_t tl_map; //TODO: class method +static void free_treasurestruct (treasure *t); // bleh desu static void clear (treasurelist *tl) { - void free_treasurestruct (treasure *t); - if (tl->items) { free_treasurestruct (tl->items); @@ -499,7 +498,7 @@ * elmex Wed Aug 9 17:44:59 CEST 2006: * Removed multiplicator, too many high-level items were generated on low-difficulty maps. */ -int +static int level_for_item (const object *op, int difficulty) { if (!op->inv) @@ -526,7 +525,7 @@ * weird integer between 1-31. * */ -int +static int magic_from_difficulty (int difficulty) { int percent = 0, magic = 0; @@ -626,10 +625,9 @@ * other bonuses previously rolled and ones the item might natively have. * 2) Add code to deal with new PR method. */ -void +static void set_ring_bonus (object *op, int bonus) { - int r = rndm (bonus > 0 ? 25 : 11); if (op->type == AMULET) @@ -762,7 +760,7 @@ * rings and amulets. * Another scheme is used to calculate the magic of weapons and armours. */ -int +static int get_magic (int diff) { int i; @@ -778,7 +776,7 @@ } /* special_potion() - so that old potion code is still done right. */ -int +static int special_potion (object *op) { if (op->attacktype) @@ -908,7 +906,7 @@ } /* materialtype modifications. Note we allow this on artifacts. */ - set_materialname (op, difficulty, NULL); + select_material (op, difficulty); if (flags & GT_MINIMAL) { @@ -1101,9 +1099,9 @@ op->value = op->value * op->inv->value * (op->level + 50) / (op->inv->level + 50); /* maxhp is used to denote how many 'charges' the rod holds before */ if (op->stats.maxhp) - op->stats.maxhp *= MAX (op->inv->stats.sp, op->inv->stats.grace); + op->stats.maxhp *= max (op->inv->stats.sp, op->inv->stats.grace); else - op->stats.maxhp = 2 * MAX (op->inv->stats.sp, op->inv->stats.grace); + op->stats.maxhp = 2 * max (op->inv->stats.sp, op->inv->stats.grace); op->stats.hp = op->stats.maxhp; break; @@ -1212,8 +1210,8 @@ if (!strcmp (f.get_str (), "all")) break; - char *next, *cp = f.get_str (); - + const char *cp = f.get_str (); + char *next; do { if ((next = strchr (cp, ','))) @@ -1469,8 +1467,8 @@ if (change->materials) op->materials = change->materials; - if (change->materialname) - op->materialname = change->materialname; + if (change->material != MATERIAL_NULL) + op->material = change->material; if (change->slaying) op->slaying = change->slaying; @@ -1662,7 +1660,7 @@ } } -void +static void free_treasurestruct (treasure *t) { if (t->next) free_treasurestruct (t->next); @@ -1672,7 +1670,7 @@ delete t; } -void +static void free_charlinks (linked_char *lc) { if (lc->next) @@ -1681,7 +1679,7 @@ delete lc; } -void +static void free_artifact (artifact *at) { if (at->next) free_artifact (at->next); @@ -1692,34 +1690,3 @@ sfree (at); } -void -free_artifactlist (artifactlist *al) -{ - artifactlist *nextal; - - for (al = first_artifactlist; al; al = nextal) - { - nextal = al->next; - - if (al->items) - free_artifact (al->items); - - sfree (al); - } -} - -void -free_all_treasures (void) -{ - treasurelist *tl, *next; - - for (tl = first_treasurelist; tl; tl = next) - { - clear (tl); - - next = tl->next; - delete tl; - } - - free_artifactlist (first_artifactlist); -}