… | |
… | |
229 | object *ACC (RW, above); /* Pointer to the object stacked above this one */ |
229 | object *ACC (RW, above); /* Pointer to the object stacked above this one */ |
230 | /* Note: stacked in the *same* environment */ |
230 | /* Note: stacked in the *same* environment */ |
231 | object *inv; /* Pointer to the first object in the inventory */ |
231 | object *inv; /* Pointer to the first object in the inventory */ |
232 | |
232 | |
233 | //TODO: container must move into client |
233 | //TODO: container must move into client |
234 | object *ACC (RW, container); /* Current container being used. I think this |
234 | object_ptr ACC (RW, container); /* Current container being used. I think this |
235 | * is only used by the player right now. |
235 | * is only used by the player right now. |
236 | */ |
236 | */ |
237 | object *ACC (RW, env); /* Pointer to the object which is the environment. |
237 | object *ACC (RW, env); /* Pointer to the object which is the environment. |
238 | * This is typically the container that the object is in. |
238 | * This is typically the container that the object is in. |
239 | */ |
239 | */ |
240 | object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ |
240 | object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ |
241 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
241 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
242 | client_container *seen_by; // seen by which player/container currently? |
242 | client_container *seen_by; // seen by which player/container currently? |
243 | |
243 | |
|
|
244 | bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all |
|
|
245 | static object *read (object_thawer &f, maptile *map = 0); // map argument due to toal design bogosity, must go. |
|
|
246 | bool write (object_freezer &f); |
|
|
247 | |
244 | MTH static object *create (); |
248 | MTH static object *create (); |
245 | MTH void copy_to (object *dst); |
249 | MTH void copy_to (object *dst); |
246 | MTH object *clone (); // create + copy_to |
250 | MTH object *clone (); // create + copy_to |
247 | void do_destroy (); |
251 | void do_destroy (); |
248 | void gather_callbacks (AV *&callbacks, event_type event) const; |
252 | void gather_callbacks (AV *&callbacks, event_type event) const; |
… | |
… | |
269 | } |
273 | } |
270 | |
274 | |
271 | MTH void set_owner (object *owner); |
275 | MTH void set_owner (object *owner); |
272 | MTH void set_speed (float speed); |
276 | MTH void set_speed (float speed); |
273 | |
277 | |
|
|
278 | MTH void open_container (object *new_container); |
|
|
279 | MTH void close_container () |
|
|
280 | { |
|
|
281 | open_container (0); |
|
|
282 | } |
|
|
283 | |
274 | MTH void instantiate () |
284 | MTH void instantiate (); |
275 | { |
|
|
276 | if (!uuid.seq) // HACK |
|
|
277 | uuid = gen_uuid (); |
|
|
278 | |
|
|
279 | attachable::instantiate (); |
|
|
280 | } |
|
|
281 | |
285 | |
282 | // recalculate all stats |
286 | // recalculate all stats |
283 | MTH void update_stats (); |
287 | MTH void update_stats (); |
284 | MTH void roll_stats (); |
288 | MTH void roll_stats (); |
285 | MTH void swap_stats (int a, int b); |
289 | MTH void swap_stats (int a, int b); |
… | |
… | |
441 | |
445 | |
442 | extern objectvec objects; |
446 | extern objectvec objects; |
443 | extern activevec actives; |
447 | extern activevec actives; |
444 | |
448 | |
445 | #define for_all_objects(var) \ |
449 | #define for_all_objects(var) \ |
446 | for (int _i = 0; _i < objects.size (); ++_i) \ |
450 | for (unsigned _i = 0; _i < objects.size (); ++_i) \ |
447 | declvar (object *, var, objects [_i]) |
451 | declvar (object *, var, objects [_i]) |
448 | |
452 | |
449 | #define for_all_actives(var) \ |
453 | #define for_all_actives(var) \ |
450 | for (int _i = 0; _i < actives.size (); ++_i) \ |
454 | for (unsigned _i = 0; _i < actives.size (); ++_i) \ |
451 | declvar (object *, var, actives [_i]) |
455 | declvar (object *, var, actives [_i]) |
452 | |
456 | |
453 | typedef struct oblnk |
457 | typedef struct oblnk |
454 | { /* Used to link together several objects */ |
458 | { /* Used to link together several objects */ |
455 | object_ptr ob; |
459 | object_ptr ob; |
… | |
… | |
477 | { |
481 | { |
478 | archetype (); |
482 | archetype (); |
479 | ~archetype (); |
483 | ~archetype (); |
480 | void gather_callbacks (AV *&callbacks, event_type event) const; |
484 | void gather_callbacks (AV *&callbacks, event_type event) const; |
481 | |
485 | |
|
|
486 | static archetype *read (object_thawer &f); |
482 | static archetype *find (const char *name); |
487 | static archetype *find (const char *name); |
483 | |
488 | |
484 | void hash_add (); // add to hashtable |
489 | void hash_add (); // add to hashtable |
485 | void hash_del (); // remove from hashtable |
490 | void hash_del (); // remove from hashtable |
486 | |
491 | |