… | |
… | |
56 | { |
56 | { |
57 | key_value *next; |
57 | key_value *next; |
58 | shstr key, value; |
58 | shstr key, value; |
59 | }; |
59 | }; |
60 | |
60 | |
|
|
61 | struct UUID |
|
|
62 | { |
|
|
63 | uint64 seq; |
|
|
64 | }; |
|
|
65 | |
|
|
66 | extern void init_uuid (); |
|
|
67 | extern UUID gen_uuid (); |
61 | |
68 | |
62 | /* Definition for WILL_APPLY values. Replaces having harcoded values |
69 | /* Definition for WILL_APPLY values. Replaces having harcoded values |
63 | * sprinkled in the code. Note that some of these also replace fields |
70 | * sprinkled in the code. Note that some of these also replace fields |
64 | * that were in the can_apply area. What is the point of having both |
71 | * that were in the can_apply area. What is the point of having both |
65 | * can_apply and will_apply? |
72 | * can_apply and will_apply? |
… | |
… | |
68 | #define WILL_APPLY_TREASURE 0x02 |
75 | #define WILL_APPLY_TREASURE 0x02 |
69 | #define WILL_APPLY_EARTHWALL 0x04 |
76 | #define WILL_APPLY_EARTHWALL 0x04 |
70 | #define WILL_APPLY_DOOR 0x08 |
77 | #define WILL_APPLY_DOOR 0x08 |
71 | #define WILL_APPLY_FOOD 0x10 |
78 | #define WILL_APPLY_FOOD 0x10 |
72 | |
79 | |
73 | |
|
|
74 | /* However, if you're keeping a pointer of some sort, you probably |
80 | /* However, if you're keeping a pointer of some sort, you probably |
75 | * don't just want it copied, so you'll need to add to common/object.C, |
81 | * don't just want it copied, so you'll need to add to common/object.C, |
76 | * e.g. copy_object. |
82 | * e.g. copy_object. |
77 | */ |
83 | */ |
78 | |
84 | |
79 | // these are not being copied |
85 | // these are not being copied |
80 | ACC_CLASS (object) |
86 | ACC_CLASS (object) |
81 | struct object_keep : refcounted |
87 | struct object_keep : refcounted |
82 | { |
88 | { |
83 | tag_t ACC (RW, count); /* Unique object number for this object */ |
89 | tag_t ACC (RW, count); /* Unique object number for this object */ |
|
|
90 | UUID uuid; // Unique Identifier, survives saves etc. |
84 | |
91 | |
85 | /* These variables are not changed by copy_object() */ |
92 | /* These variables are not changed by copy_object() */ |
86 | struct pl *ACC (RW, contr); /* Pointer to the player which control this object */ |
93 | struct pl *ACC (RW, contr); /* Pointer to the player which control this object */ |
87 | struct object *ACC (RW, next); /* Pointer to the next object in the free/used list */ |
94 | struct object *ACC (RW, next); /* Pointer to the next object in the free/used list */ |
88 | struct object *ACC (RW, prev); /* Pointer to the previous object in the free/used list */ |
95 | struct object *ACC (RW, prev); /* Pointer to the previous object in the free/used list */ |
… | |
… | |
234 | static bool can_merge (object *op1, object *op2); |
241 | static bool can_merge (object *op1, object *op2); |
235 | |
242 | |
236 | void clear (); |
243 | void clear (); |
237 | void clone (object *destination); |
244 | void clone (object *destination); |
238 | |
245 | |
|
|
246 | void instantiate () |
|
|
247 | { |
|
|
248 | if (!uuid.seq) // HACK |
|
|
249 | uuid = gen_uuid (); |
|
|
250 | |
|
|
251 | attachable<object>::instantiate (); |
|
|
252 | } |
|
|
253 | |
239 | void set_owner (object *owner); |
254 | void set_owner (object *owner); |
240 | object *get_owner (); |
255 | object *get_owner (); |
241 | |
256 | |
242 | // info must hold 256 * 3 bytes currently |
257 | // info must hold 256 * 3 bytes currently |
243 | const char *debug_desc (char *info) const; |
258 | const char *debug_desc (char *info) const; |