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,2013,2014,2015,2016 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 |
… | |
… | |
31 | |
32 | |
32 | /* TREASURE_VERBOSE enables copious output concerning artifact generation */ |
33 | /* TREASURE_VERBOSE enables copious output concerning artifact generation */ |
33 | |
34 | |
34 | //#define TREASURE_VERBOSE |
35 | //#define TREASURE_VERBOSE |
35 | |
36 | |
36 | #include <unordered_map> |
|
|
37 | |
|
|
38 | #include <global.h> |
37 | #include <global.h> |
39 | #include <treasure.h> |
38 | #include <treasure.h> |
40 | |
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 | |
41 | extern char *spell_mapping[]; |
45 | extern char *spell_mapping[]; |
42 | |
46 | |
43 | static treasurelist *first_treasurelist; |
47 | static treasurelist *first_treasurelist; |
44 | |
48 | |
45 | static void change_treasure (treasure *t, object *op); /* overrule default values */ |
49 | static void change_treasure (treasure *t, object *op); /* overrule default values */ |
46 | |
50 | |
47 | typedef std::unordered_map< |
51 | typedef ska::flat_hash_map |
|
|
52 | < |
48 | const char *, |
53 | const char *, |
49 | treasurelist *, |
54 | treasurelist *, |
50 | str_hash, |
55 | str_hash, |
51 | str_equal, |
56 | str_equal, |
52 | slice_allocator< std::pair<const char *const, treasurelist *> > |
57 | slice_allocator< std::pair<const char *const, treasurelist *> > |
53 | > tl_map_t; |
58 | > tl_map_t; |
54 | |
59 | |
55 | static tl_map_t tl_map; |
60 | static tl_map_t tl_map; |
56 | |
61 | |
57 | //TODO: class method |
62 | //TODO: class method |
58 | static void free_treasurestruct (treasure *t); // bleh desu |
63 | static void free_treasurestruct (treasure *t); // bleh desu |
… | |
… | |
492 | { 0, 0, 0, 3, 97}, // 29 |
497 | { 0, 0, 0, 3, 97}, // 29 |
493 | { 0, 0, 0, 0, 100}, // 30 |
498 | { 0, 0, 0, 0, 100}, // 30 |
494 | { 0, 0, 0, 0, 100}, // 31 |
499 | { 0, 0, 0, 0, 100}, // 31 |
495 | }; |
500 | }; |
496 | |
501 | |
497 | /* calculate the appropriate level for wands staves and scrolls. |
502 | /* calculate the appropriate level for wands staves and scrolls. |
498 | * This code presumes that op has had its spell object created (in op->inv) |
503 | * This code presumes that op has had its spell object created (in op->inv) |
499 | * |
504 | * |
500 | * elmex Wed Aug 9 17:44:59 CEST 2006: |
505 | * elmex Wed Aug 9 17:44:59 CEST 2006: |
501 | * Removed multiplicator, too many high-level items were generated on low-difficulty maps. |
506 | * Removed multiplicator, too many high-level items were generated on low-difficulty maps. |
502 | */ |
507 | */ |
… | |
… | |
810 | * order to set it up right. This produced magical bonuses, puts spells |
815 | * order to set it up right. This produced magical bonuses, puts spells |
811 | * into scrolls/books/wands, makes it unidentified, hides the value, etc. |
816 | * into scrolls/books/wands, makes it unidentified, hides the value, etc. |
812 | */ |
817 | */ |
813 | |
818 | |
814 | /* 4/28/96 added creator object from which op may now inherit properties based on |
819 | /* 4/28/96 added creator object from which op may now inherit properties based on |
815 | * op->type. Right now, which stuff the creator passes on is object type |
820 | * op->type. Right now, which stuff the creator passes on is object type |
816 | * dependant. I know this is a spagetti manuever, but is there a cleaner |
821 | * dependant. I know this is a spagetti manuever, but is there a cleaner |
817 | * way to do this? b.t. */ |
822 | * way to do this? b.t. */ |
818 | |
823 | |
819 | /* |
824 | /* |
820 | * ! (flags & GT_ENVIRONMENT): |
825 | * ! (flags & GT_ENVIRONMENT): |
821 | * Automatically calls fix_flesh_item(). |
826 | * Automatically calls fix_flesh_item(). |