--- deliantra/server/common/treasure.C 2012/01/03 11:25:31 1.114 +++ deliantra/server/common/treasure.C 2022/10/08 21:54:05 1.125 @@ -1,24 +1,25 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. - * - * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * + * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team + * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2002 Mark Wedel & Crossfire Development Team * Copyright (©) 1992 Frank Tore Johansen - * + * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the Affero GNU General Public License * and the GNU General Public License along with this program. If not, see * . - * + * * The authors can be reached via e-mail to */ @@ -36,19 +37,25 @@ #include #include +#include + +// used only by treasure.C, does not handle null arch ptrs +#define IS_ARCH(arch,name) ((arch)->archname == shstr_ ## name) + extern char *spell_mapping[]; static treasurelist *first_treasurelist; static void change_treasure (treasure *t, object *op); /* overrule default values */ -typedef std::tr1::unordered_map< - const char *, - treasurelist *, - str_hash, - str_equal, - slice_allocator< std::pair > -> tl_map_t; +typedef ska::flat_hash_map + < + const char *, + treasurelist *, + str_hash, + str_equal, + slice_allocator< std::pair > + > tl_map_t; static tl_map_t tl_map; @@ -75,7 +82,7 @@ if (!name) return 0; - auto (i, tl_map.find (name)); + auto i = tl_map.find (name); if (i == tl_map.end ()) return 0; @@ -216,7 +223,10 @@ { if (t->next_yes || t->next_no) { - LOG (llevError, "Treasure %s is one item, but on treasure %s\n", &tl->name, t->item ? &t->item->archname : &t->name); + LOG (llevError, "Treasure %s is one item, but on treasure %s%s\n", + &tl->name, + t->item ? "item " : "", + t->item ? &t->item->archname : &t->name); LOG (llevError, " the next_yes or next_no field is set\n"); } @@ -492,7 +502,7 @@ { 0, 0, 0, 0, 100}, // 31 }; -/* calculate the appropriate level for wands staves and scrolls. +/* calculate the appropriate level for wands staves and scrolls. * This code presumes that op has had its spell object created (in op->inv) * * elmex Wed Aug 9 17:44:59 CEST 2006: @@ -810,8 +820,8 @@ */ /* 4/28/96 added creator object from which op may now inherit properties based on - * op->type. Right now, which stuff the creator passes on is object type - * dependant. I know this is a spagetti manuever, but is there a cleaner + * op->type. Right now, which stuff the creator passes on is object type + * dependant. I know this is a spagetti manuever, but is there a cleaner * way to do this? b.t. */ /* @@ -949,7 +959,7 @@ case POTION: { - int too_many_tries = 0, is_special = 0; + int too_many_tries = 0; /* Handle healing and magic power potions */ if (op->stats.sp && !op->randomitems) @@ -959,7 +969,7 @@ op->stats.sp = 0; } - while (!(is_special = special_potion (op)) && !op->inv) + while (!special_potion (op) && !op->inv) { generate_artifact (op, difficulty); if (too_many_tries++ > 10)