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 (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
|
|
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
|
|
7 | * |
5 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
7 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
9 | * option) any later version. |
… | |
… | |
106 | void cfperl_send_msg (client *ns, int color, const char *type, const char *msg); |
104 | void cfperl_send_msg (client *ns, int color, const char *type, const char *msg); |
107 | int cfperl_can_merge (object *ob1, object *ob2); |
105 | int cfperl_can_merge (object *ob1, object *ob2); |
108 | void cfperl_mapscript_activate (object *ob, int state, object *activator, object *originator = 0); |
106 | void cfperl_mapscript_activate (object *ob, int state, object *activator, object *originator = 0); |
109 | |
107 | |
110 | bool is_match_expr (const char *expr); |
108 | bool is_match_expr (const char *expr); |
111 | /* applies the match expression and returns true if it matches */ |
109 | // applies the match expression and returns true if it matches |
112 | bool match (const char *expr, object *ob, object *self = 0, object *source = 0, object *originator = 0); |
110 | bool match (const char *expr, object *ob, object *self = 0, object *source = 0, object *originator = 0); |
|
|
111 | // same as above, but returns the first object found, or 0 |
|
|
112 | object *match_one (const char *expr, object *ob, object *self = 0, object *source = 0, object *originator = 0); |
113 | |
113 | |
114 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
114 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
115 | |
115 | |
116 | #if IVSIZE >= 8 |
116 | #if IVSIZE >= 8 |
117 | typedef IV val64; |
117 | typedef IV val64; |
… | |
… | |
196 | |
196 | |
197 | enum { |
197 | enum { |
198 | F_DESTROYED = 0x01, |
198 | F_DESTROYED = 0x01, |
199 | F_DEBUG_TRACE = 0x02, |
199 | F_DEBUG_TRACE = 0x02, |
200 | }; |
200 | }; |
201 | uint8 ACC (RW, flags); |
201 | uint8 ACC (RW, attachable_flags); |
202 | |
202 | |
203 | static unordered_vector<attachable *> mortals; |
203 | static unordered_vector<attachable *> mortals; |
204 | MTH static void check_mortals (); |
204 | MTH static void check_mortals (); |
205 | |
205 | |
206 | // object is delete'd after the refcount reaches 0 |
206 | // object is delete'd after the refcount reaches 0 |
… | |
… | |
212 | // this politely asks everybody interested the reduce |
212 | // this politely asks everybody interested the reduce |
213 | // the refcount to 0 as soon as possible. |
213 | // the refcount to 0 as soon as possible. |
214 | MTH void destroy (); |
214 | MTH void destroy (); |
215 | |
215 | |
216 | // return wether an object was destroyed already |
216 | // return wether an object was destroyed already |
217 | MTH bool destroyed () const { return flags & F_DESTROYED; } |
217 | MTH bool destroyed () const { return attachable_flags & F_DESTROYED; } |
218 | |
218 | |
219 | virtual void gather_callbacks (AV *&callbacks, event_type event) const; |
219 | virtual void gather_callbacks (AV *&callbacks, event_type event) const; |
220 | |
220 | |
221 | #if 0 |
221 | #if 0 |
222 | private: |
222 | private: |
… | |
… | |
230 | |
230 | |
231 | void sever_self (); // sever this object from its self, if it has one. |
231 | void sever_self (); // sever this object from its self, if it has one. |
232 | void optimise (); // possibly save some memory by destroying unneeded data |
232 | void optimise (); // possibly save some memory by destroying unneeded data |
233 | |
233 | |
234 | attachable () |
234 | attachable () |
235 | : flags (0), self (0), cb (0), attach (0) |
235 | : attachable_flags (0), self (0), cb (0), attach (0) |
236 | { |
236 | { |
237 | } |
237 | } |
238 | |
238 | |
239 | attachable (const attachable &src) |
239 | attachable (const attachable &src) |
240 | : flags (0), self (0), cb (0), attach (src.attach) |
240 | : attachable_flags (0), self (0), cb (0), attach (src.attach) |
241 | { |
241 | { |
242 | } |
242 | } |
243 | |
243 | |
244 | // set a custom key to the given value, or delete it if value = 0 |
244 | // set a custom key to the given value, or delete it if value = 0 |
245 | void set_key (const char *key, const char *value = 0, bool is_utf8 = 0); |
245 | void set_key (const char *key, const char *value = 0, bool is_utf8 = 0); |