1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
|
|
4 | * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
8 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
34 | //#define TREASURE_VERBOSE |
35 | //#define TREASURE_VERBOSE |
35 | |
36 | |
36 | #include <global.h> |
37 | #include <global.h> |
37 | #include <treasure.h> |
38 | #include <treasure.h> |
38 | |
39 | |
|
|
40 | #include <flat_hash_map.hpp> |
|
|
41 | |
|
|
42 | // used only by treasure.C, does not handle null arch ptrs |
|
|
43 | #define IS_ARCH(arch,name) ((arch)->archname == shstr_ ## name) |
|
|
44 | |
39 | extern char *spell_mapping[]; |
45 | extern char *spell_mapping[]; |
40 | |
46 | |
41 | static treasurelist *first_treasurelist; |
47 | static treasurelist *first_treasurelist; |
42 | |
48 | |
43 | static void change_treasure (treasure *t, object *op); /* overrule default values */ |
49 | static void change_treasure (treasure *t, object *op); /* overrule default values */ |
44 | |
50 | |
45 | typedef std::tr1::unordered_map< |
51 | typedef ska::flat_hash_map< |
46 | const char *, |
52 | const char *, |
47 | treasurelist *, |
53 | treasurelist *, |
48 | str_hash, |
54 | str_hash, |
49 | str_equal, |
55 | str_equal, |
50 | slice_allocator< std::pair<const char *const, treasurelist *> > |
56 | slice_allocator< std::pair<const char *const, treasurelist *> > |
51 | > tl_map_t; |
57 | > tl_map_t; |
52 | |
58 | |
53 | static tl_map_t tl_map; |
59 | static tl_map_t tl_map; |
54 | |
60 | |
55 | //TODO: class method |
61 | //TODO: class method |
… | |
… | |
490 | { 0, 0, 0, 3, 97}, // 29 |
496 | { 0, 0, 0, 3, 97}, // 29 |
491 | { 0, 0, 0, 0, 100}, // 30 |
497 | { 0, 0, 0, 0, 100}, // 30 |
492 | { 0, 0, 0, 0, 100}, // 31 |
498 | { 0, 0, 0, 0, 100}, // 31 |
493 | }; |
499 | }; |
494 | |
500 | |
495 | /* calculate the appropriate level for wands staves and scrolls. |
501 | /* calculate the appropriate level for wands staves and scrolls. |
496 | * This code presumes that op has had its spell object created (in op->inv) |
502 | * This code presumes that op has had its spell object created (in op->inv) |
497 | * |
503 | * |
498 | * elmex Wed Aug 9 17:44:59 CEST 2006: |
504 | * elmex Wed Aug 9 17:44:59 CEST 2006: |
499 | * Removed multiplicator, too many high-level items were generated on low-difficulty maps. |
505 | * Removed multiplicator, too many high-level items were generated on low-difficulty maps. |
500 | */ |
506 | */ |
… | |
… | |
808 | * order to set it up right. This produced magical bonuses, puts spells |
814 | * order to set it up right. This produced magical bonuses, puts spells |
809 | * into scrolls/books/wands, makes it unidentified, hides the value, etc. |
815 | * into scrolls/books/wands, makes it unidentified, hides the value, etc. |
810 | */ |
816 | */ |
811 | |
817 | |
812 | /* 4/28/96 added creator object from which op may now inherit properties based on |
818 | /* 4/28/96 added creator object from which op may now inherit properties based on |
813 | * op->type. Right now, which stuff the creator passes on is object type |
819 | * op->type. Right now, which stuff the creator passes on is object type |
814 | * dependant. I know this is a spagetti manuever, but is there a cleaner |
820 | * dependant. I know this is a spagetti manuever, but is there a cleaner |
815 | * way to do this? b.t. */ |
821 | * way to do this? b.t. */ |
816 | |
822 | |
817 | /* |
823 | /* |
818 | * ! (flags & GT_ENVIRONMENT): |
824 | * ! (flags & GT_ENVIRONMENT): |
819 | * Automatically calls fix_flesh_item(). |
825 | * Automatically calls fix_flesh_item(). |