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

Comparing deliantra/server/include/object.h (file contents):
Revision 1.14 by root, Thu Aug 31 17:54:14 2006 UTC vs.
Revision 1.15 by root, Sun Sep 3 00:18:41 2006 UTC

1/* 1/*
2 * static char *rcsid_object_h = 2 * static char *rcsid_object_h =
3 * "$Id: object.h,v 1.14 2006/08/31 17:54:14 root Exp $"; 3 * "$Id: object.h,v 1.15 2006/09/03 00:18:41 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
43 const char *use_name; /* Name used when describing an item we can use */ 43 const char *use_name; /* Name used when describing an item we can use */
44 const char *nonuse_name; /* Name to describe objects we can't use */ 44 const char *nonuse_name; /* Name to describe objects we can't use */
45} Body_Locations; 45} Body_Locations;
46 46
47extern Body_Locations body_locations[NUM_BODY_LOCATIONS]; 47extern Body_Locations body_locations[NUM_BODY_LOCATIONS];
48
49typedef struct _event
50{
51 int type;
52 const char *hook;
53 const char *plugin;
54 const char *options;
55 struct _event *next;
56} event;
57 48
58/* 49/*
59 * Each object (this also means archetypes!) could have a few of these 50 * Each object (this also means archetypes!) could have a few of these
60 * "dangling" from it; this could also end up containing 'parse errors'. 51 * "dangling" from it; this could also end up containing 'parse errors'.
61 * 52 *
63 * 54 *
64 * Please use get_ob_key_value(), set_ob_key_value() from object.c rather than 55 * Please use get_ob_key_value(), set_ob_key_value() from object.c rather than
65 * accessing the list directly. 56 * accessing the list directly.
66 * Exception is if you want to walk this list for some reason. 57 * Exception is if you want to walk this list for some reason.
67 */ 58 */
68typedef struct _key_value { 59struct key_value {
69 const char * key;
70 const char * value;
71 struct _key_value * next; 60 key_value *next;
72} key_value; 61 shstr key, value;
62};
73 63
74 64
75/* Definition for WILL_APPLY values. Replaces having harcoded values 65/* Definition for WILL_APPLY values. Replaces having harcoded values
76 * sprinkled in the code. Note that some of these also replace fields 66 * sprinkled in the code. Note that some of these also replace fields
77 * that were in the can_apply area. What is the point of having both 67 * that were in the can_apply area. What is the point of having both
235 MoveType move_on; /* Move types affected moving on to this space */ 225 MoveType move_on; /* Move types affected moving on to this space */
236 MoveType move_off; /* Move types affected moving off this space */ 226 MoveType move_off; /* Move types affected moving off this space */
237 MoveType move_slow; /* Movement types this slows down */ 227 MoveType move_slow; /* Movement types this slows down */
238 float move_slow_penalty; /* How much this slows down the object */ 228 float move_slow_penalty; /* How much this slows down the object */
239 229
240 event *events;
241
242 shstr custom_name; /* Custom name assigned by player */ 230 shstr custom_name; /* Custom name assigned by player */
243 key_value *key_values; /* Fields not explictly known by the loader. */ 231 key_value *key_values; /* Fields not explictly known by the loader. */
244}; 232};
245 233
246struct object : object_special, object_simple { 234struct object : object_special, object_simple, zero_initialised {
247 void clone (object *destination) 235 void clone (object *destination)
248 { 236 {
249 if (attach)
250 destination->attach = add_refcount (attach); 237 destination->attach = attach;
251 238
252 if (self || cb) 239 if (self || cb)
253 INVOKE_OBJECT (CLONE, this, ARG_OBJECT (destination)); 240 INVOKE_OBJECT (CLONE, this, ARG_OBJECT (destination));
254 } 241 }
255}; 242};
273 * be much left in the archetype - all it really is is a holder for the 260 * be much left in the archetype - all it really is is a holder for the
274 * object and pointers. This structure should get removed, and just replaced 261 * object and pointers. This structure should get removed, and just replaced
275 * by the object structure 262 * by the object structure
276 */ 263 */
277 264
278typedef struct archt { 265typedef struct archt : zero_initialised
266{
279 const char *name; /* More definite name, like "generate_kobold" */ 267 shstr name; /* More definite name, like "generate_kobold" */
280 struct archt *next; /* Next archetype in a linked list */ 268 struct archt *next; /* Next archetype in a linked list */
281 struct archt *head; /* The main part of a linked object */ 269 struct archt *head; /* The main part of a linked object */
282 struct archt *more; /* Next part of a linked object */ 270 struct archt *more; /* Next part of a linked object */
283 object clone; /* An object from which to do copy_object() */ 271 object clone; /* An object from which to do copy_object() */
284 uint32 editable; /* editable flags (mainly for editor) */ 272 uint32 editable; /* editable flags (mainly for editor) */
293extern object objarray[STARTMAX]; 281extern object objarray[STARTMAX];
294 282
295extern int nrofallocobjects; 283extern int nrofallocobjects;
296extern int nroffreeobjects; 284extern int nroffreeobjects;
297 285
298/* This returns TRUE if the object is somethign that 286/* This returns TRUE if the object is something that
299 * should be displayed in the look window 287 * should be displayed in the look window
300 */ 288 */
301#define LOOK_OBJ(ob) (!ob->invisible && ob->type!=PLAYER && ob->type!=EVENT_CONNECTOR) 289#define LOOK_OBJ(ob) (!ob->invisible && ob->type!=PLAYER && ob->type!=EVENT_CONNECTOR)
302 290
303/* Used by update_object to know if the object being passed is 291/* Used by update_object to know if the object being passed is

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines