--- deliantra/server/common/treasure.C 2011/04/16 02:35:53 1.111
+++ deliantra/server/common/treasure.C 2018/11/18 15:19:48 1.122
@@ -1,24 +1,25 @@
/*
* This file is part of Deliantra, the Roguelike Realtime MMORPG.
- *
- * Copyright (©) 2005,2006,2007,2008,2009,2010 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,18 +37,23 @@
#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 >
+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;
@@ -492,7 +498,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 +816,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. */
/*
@@ -921,7 +927,7 @@
/* Handle healing and magic power potions */
if (op->stats.sp && !op->randomitems)
{
- object *tmp = get_archetype (spell_mapping [op->stats.sp]);
+ object *tmp = archetype::get (spell_mapping [op->stats.sp]);
insert_ob_in_ob (tmp, op);
op->stats.sp = 0;
}
@@ -949,17 +955,17 @@
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)
{
- object *tmp = get_archetype (spell_mapping[op->stats.sp]);
+ object *tmp = archetype::get (spell_mapping[op->stats.sp]);
insert_ob_in_ob (tmp, op);
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)