… | |
… | |
233 | MoveType ACC (RW, move_slow); /* Movement types this slows down */ |
233 | MoveType ACC (RW, move_slow); /* Movement types this slows down */ |
234 | float ACC (RW, move_slow_penalty); /* How much this slows down the object */ |
234 | float ACC (RW, move_slow_penalty); /* How much this slows down the object */ |
235 | key_value *key_values; /* Fields not explictly known by the loader. */ |
235 | key_value *key_values; /* Fields not explictly known by the loader. */ |
236 | }; |
236 | }; |
237 | |
237 | |
|
|
238 | #define get_object() object::create () |
|
|
239 | #define free_object(op) (op)->free (0) |
|
|
240 | #define free_object2(op, free_inv) (op)->free (free_inv) |
|
|
241 | |
238 | struct object : zero_initialised, object_keep, object_copy, object_pod |
242 | struct object : zero_initialised, object_keep, object_copy, object_pod |
239 | { |
243 | { |
|
|
244 | static object *create (); |
|
|
245 | void free (bool free_inventory = false); |
|
|
246 | void mortalise (); |
|
|
247 | |
|
|
248 | static void free_mortals (); |
240 | static bool can_merge (object * op1, object * op2); |
249 | static bool can_merge (object *op1, object *op2); |
241 | |
250 | |
242 | void clear (); |
251 | void clear (); |
243 | void clone (object * destination); |
252 | void clone (object *destination); |
|
|
253 | |
|
|
254 | protected: |
|
|
255 | friend struct archetype; |
|
|
256 | |
|
|
257 | object (); |
|
|
258 | ~object (); |
244 | }; |
259 | }; |
245 | |
260 | |
246 | #define CAN_MERGE(op1,op2) ((op1)->value == (op2)->value && (op1)->name == (op2)->name && object::can_merge ((op1), (op2))) |
261 | #define CAN_MERGE(op1,op2) ((op1)->value == (op2)->value && (op1)->name == (op2)->name && object::can_merge ((op1), (op2))) |
247 | |
262 | |
248 | typedef struct oblnk |
263 | typedef struct oblnk |
… | |
… | |
269 | */ |
284 | */ |
270 | |
285 | |
271 | ACC_CLASS(archetype) |
286 | ACC_CLASS(archetype) |
272 | struct archetype : zero_initialised |
287 | struct archetype : zero_initialised |
273 | { |
288 | { |
|
|
289 | archetype (); |
|
|
290 | ~archetype (); |
|
|
291 | |
274 | shstr ACC (RW, name); /* More definite name, like "generate_kobold" */ |
292 | shstr ACC (RW, name); /* More definite name, like "generate_kobold" */ |
275 | struct archetype *ACC (RW, next); /* Next archetype in a linked list */ |
293 | struct archetype *ACC (RW, next); /* Next archetype in a linked list */ |
276 | struct archetype *ACC (RW, head); /* The main part of a linked object */ |
294 | struct archetype *ACC (RW, head); /* The main part of a linked object */ |
277 | struct archetype *ACC (RW, more); /* Next part of a linked object */ |
295 | struct archetype *ACC (RW, more); /* Next part of a linked object */ |
278 | object ACC (RO, clone); /* An object from which to do copy_object() */ |
296 | object ACC (RO, clone); /* An object from which to do copy_object() */ |