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.16 by elmex, Sun Sep 3 14:33:48 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.16 2006/09/03 14:33:48 elmex 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
133 shstr msg; /* If this is a book/sign/magic mouth/etc */ 123 shstr msg; /* If this is a book/sign/magic mouth/etc */
134 shstr lore; /* Obscure information about this object, */ 124 shstr lore; /* Obscure information about this object, */
135 /* To get put into books and the like. */ 125 /* To get put into books and the like. */
136 126
137 sint16 x,y; /* Position in the map for this object */ 127 sint16 x,y; /* Position in the map for this object */
138 sint16 ox,oy; /* For debugging: Where it was last inserted */
139 float speed; /* The overall speed of this object */ 128 float speed; /* The overall speed of this object */
140 float speed_left; /* How much speed is left to spend this round */ 129 float speed_left; /* How much speed is left to spend this round */
141 uint32 nrof; /* How many of the objects */ 130 uint32 nrof; /* How many of the objects */
142 New_Face *face; /* Face with colors */ 131 New_Face *face; /* Face with colors */
143 sint8 direction; /* Means the object is moving that way. */ 132 sint8 direction; /* Means the object is moving that way. */
235 MoveType move_on; /* Move types affected moving on to this space */ 224 MoveType move_on; /* Move types affected moving on to this space */
236 MoveType move_off; /* Move types affected moving off this space */ 225 MoveType move_off; /* Move types affected moving off this space */
237 MoveType move_slow; /* Movement types this slows down */ 226 MoveType move_slow; /* Movement types this slows down */
238 float move_slow_penalty; /* How much this slows down the object */ 227 float move_slow_penalty; /* How much this slows down the object */
239 228
240 event *events;
241
242 shstr custom_name; /* Custom name assigned by player */ 229 shstr custom_name; /* Custom name assigned by player */
243 key_value *key_values; /* Fields not explictly known by the loader. */ 230 key_value *key_values; /* Fields not explictly known by the loader. */
244}; 231};
245 232
246struct object : object_special, object_simple { 233struct object : object_special, object_simple, zero_initialised {
247 void clone (object *destination) 234 void clone (object *destination)
248 { 235 {
249 if (attach)
250 destination->attach = add_refcount (attach); 236 destination->attach = attach;
251 237
252 if (self || cb) 238 if (self || cb)
253 INVOKE_OBJECT (CLONE, this, ARG_OBJECT (destination)); 239 INVOKE_OBJECT (CLONE, this, ARG_OBJECT (destination));
254 } 240 }
255}; 241};
273 * be much left in the archetype - all it really is is a holder for the 259 * 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 260 * object and pointers. This structure should get removed, and just replaced
275 * by the object structure 261 * by the object structure
276 */ 262 */
277 263
278typedef struct archt { 264typedef struct archt : zero_initialised
265{
279 const char *name; /* More definite name, like "generate_kobold" */ 266 shstr name; /* More definite name, like "generate_kobold" */
280 struct archt *next; /* Next archetype in a linked list */ 267 struct archt *next; /* Next archetype in a linked list */
281 struct archt *head; /* The main part of a linked object */ 268 struct archt *head; /* The main part of a linked object */
282 struct archt *more; /* Next part of a linked object */ 269 struct archt *more; /* Next part of a linked object */
283 object clone; /* An object from which to do copy_object() */ 270 object clone; /* An object from which to do copy_object() */
284 uint32 editable; /* editable flags (mainly for editor) */ 271 uint32 editable; /* editable flags (mainly for editor) */
293extern object objarray[STARTMAX]; 280extern object objarray[STARTMAX];
294 281
295extern int nrofallocobjects; 282extern int nrofallocobjects;
296extern int nroffreeobjects; 283extern int nroffreeobjects;
297 284
298/* This returns TRUE if the object is somethign that 285/* This returns TRUE if the object is something that
299 * should be displayed in the look window 286 * should be displayed in the look window
300 */ 287 */
301#define LOOK_OBJ(ob) (!ob->invisible && ob->type!=PLAYER && ob->type!=EVENT_CONNECTOR) 288#define LOOK_OBJ(ob) (!ob->invisible && ob->type!=PLAYER && ob->type!=EVENT_CONNECTOR)
302 289
303/* Used by update_object to know if the object being passed is 290/* Used by update_object to know if the object being passed is

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines