… | |
… | |
53 | |
53 | |
54 | // also copies src into the new area, like "memdup" |
54 | // also copies src into the new area, like "memdup" |
55 | // if src is 0, clears the memory |
55 | // if src is 0, clears the memory |
56 | template<typename T> |
56 | template<typename T> |
57 | inline T *salloc (int n, T *src) throw (std::bad_alloc) { return (T *)salloc_ (n * sizeof (T), (void *)src); } |
57 | inline T *salloc (int n, T *src) throw (std::bad_alloc) { return (T *)salloc_ (n * sizeof (T), (void *)src); } |
|
|
58 | |
|
|
59 | // clears the memory |
|
|
60 | template<typename T> |
|
|
61 | inline T *salloc0(int n = 1) throw (std::bad_alloc) { return (T *)salloc_ (n * sizeof (T), 0); } |
58 | |
62 | |
59 | // for symmetry |
63 | // for symmetry |
60 | template<typename T> |
64 | template<typename T> |
61 | inline void sfree (T *ptr, int n = 1) throw () |
65 | inline void sfree (T *ptr, int n = 1) throw () |
62 | { |
66 | { |
… | |
… | |
162 | T *operator ->() const { return p; } |
166 | T *operator ->() const { return p; } |
163 | |
167 | |
164 | operator T *() const { return p; } |
168 | operator T *() const { return p; } |
165 | }; |
169 | }; |
166 | |
170 | |
|
|
171 | typedef refptr<player> player_ptr; |
|
|
172 | typedef refptr<object> object_ptr; |
|
|
173 | typedef refptr<archetype> arch_ptr; |
|
|
174 | |
167 | struct str_hash |
175 | struct str_hash |
168 | { |
176 | { |
169 | std::size_t operator ()(const char *s) const |
177 | std::size_t operator ()(const char *s) const |
170 | { |
178 | { |
171 | unsigned long hash = 0; |
179 | unsigned long hash = 0; |