… | |
… | |
8 | |
8 | |
9 | #include <glib.h> |
9 | #include <glib.h> |
10 | |
10 | |
11 | #include <tr1/unordered_set> |
11 | #include <tr1/unordered_set> |
12 | |
12 | |
13 | #include "shstr.h" |
|
|
14 | #include "util.h" |
13 | #include "global.h" |
15 | |
14 | |
16 | typedef |
15 | typedef std::tr1::unordered_set<const char *, str_hash, str_equal> HT; |
17 | std::tr1::unordered_set < const char *, |
|
|
18 | str_hash, |
|
|
19 | str_equal > |
|
|
20 | HT; |
|
|
21 | |
16 | |
22 | static HT |
17 | static HT ht; |
23 | ht; |
|
|
24 | |
18 | |
25 | static const char * |
19 | static const char * |
26 | makevec (const char *s) |
20 | makevec (const char *s) |
27 | { |
21 | { |
28 | int |
22 | int |
… | |
… | |
37 | memcpy ((char *) v, s, len + 1); |
31 | memcpy ((char *) v, s, len + 1); |
38 | |
32 | |
39 | return v; |
33 | return v; |
40 | } |
34 | } |
41 | |
35 | |
42 | const char * |
|
|
43 | shstr::null = makevec ("<nil>"); |
36 | const char *shstr::null = makevec ("<nil>"); |
44 | |
|
|
45 | // what weird misoptimisation is this again? |
|
|
46 | const shstr undead_name ("undead"); |
|
|
47 | |
|
|
48 | shstr skill_names[NUM_SKILLS]; |
|
|
49 | |
37 | |
50 | const char * |
38 | const char * |
51 | shstr::find (const char *s) |
39 | shstr::find (const char *s) |
52 | { |
40 | { |
53 | if (!s) |
41 | if (!s) |
… | |
… | |
117 | } |
105 | } |
118 | |
106 | |
119 | curpos = *i; |
107 | curpos = *i; |
120 | } |
108 | } |
121 | |
109 | |
|
|
110 | shstr skill_names[NUM_SKILLS]; |
|
|
111 | |
|
|
112 | // what weird misoptimisation is this again? |
|
|
113 | const shstr undead_name ("undead"); |
|
|
114 | |
122 | //TODO: this should of course not be here |
115 | //TODO: this should of course not be here |
123 | |
116 | |
124 | /* buf_overflow() - we don't want to exceed the buffer size of |
117 | /* buf_overflow() - we don't want to exceed the buffer size of |
125 | * buf1 by adding on buf2! Returns true if overflow will occur. |
118 | * buf1 by adding on buf2! Returns true if overflow will occur. |
126 | */ |
119 | */ |