--- deliantra/server/common/treasure.C 2017/01/29 02:47:04 1.119 +++ deliantra/server/common/treasure.C 2022/10/08 21:54:05 1.125 @@ -1,6 +1,7 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * + * 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 @@ -33,24 +34,28 @@ //#define TREASURE_VERBOSE -#include - #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::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; @@ -77,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; @@ -218,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"); }