ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/util.h
(Generate patch)

Comparing deliantra/server/include/util.h (file contents):
Revision 1.23 by root, Sat Dec 23 16:05:19 2006 UTC vs.
Revision 1.24 by root, Mon Dec 25 11:25:49 2006 UTC

120 { 120 {
121 p->~Tp (); 121 p->~Tp ();
122 } 122 }
123}; 123};
124 124
125struct refcounted
126{
127 refcounted () : refcnt (0) { }
128 virtual ~refcounted ();
129 void refcnt_inc () { ++refcnt; }
130 void refcnt_dec () { --refcnt; }
131 bool dead () { return refcnt == 0; }
132 mutable int refcnt;
133#if 0
134private:
135 static refcounted *rc_first;
136 refcounted *rc_next;
137#endif
138};
139
140template<class T> 125template<class T>
141struct refptr 126struct refptr
142{ 127{
143 T *p; 128 T *p;
144 129
166 T *operator ->() const { return p; } 151 T *operator ->() const { return p; }
167 152
168 operator T *() const { return p; } 153 operator T *() const { return p; }
169}; 154};
170 155
171typedef refptr<player> player_ptr; 156typedef refptr<maptile> maptile_ptr;
172typedef refptr<object> object_ptr; 157typedef refptr<object> object_ptr;
173typedef refptr<archetype> arch_ptr; 158typedef refptr<archetype> arch_ptr;
159typedef refptr<client> client_ptr;
160typedef refptr<player> player_ptr;
174 161
175struct str_hash 162struct str_hash
176{ 163{
177 std::size_t operator ()(const char *s) const 164 std::size_t operator ()(const char *s) const
178 { 165 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines