--- deliantra/server/include/util.h 2006/12/17 23:10:35 1.20 +++ deliantra/server/include/util.h 2006/12/23 16:05:19 1.23 @@ -56,6 +56,10 @@ template inline T *salloc (int n, T *src) throw (std::bad_alloc) { return (T *)salloc_ (n * sizeof (T), (void *)src); } +// clears the memory +template +inline T *salloc0(int n = 1) throw (std::bad_alloc) { return (T *)salloc_ (n * sizeof (T), 0); } + // for symmetry template inline void sfree (T *ptr, int n = 1) throw () @@ -121,7 +125,7 @@ struct refcounted { refcounted () : refcnt (0) { } -// virtual ~refcounted (); + virtual ~refcounted (); void refcnt_inc () { ++refcnt; } void refcnt_dec () { --refcnt; } bool dead () { return refcnt == 0; } @@ -164,6 +168,10 @@ operator T *() const { return p; } }; +typedef refptr player_ptr; +typedef refptr object_ptr; +typedef refptr arch_ptr; + struct str_hash { std::size_t operator ()(const char *s) const