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.215 by root, Sat Nov 7 18:30:05 2009 UTC vs.
Revision 1.218 by root, Mon Nov 9 03:08:24 2009 UTC

93 93
94struct UUID 94struct UUID
95{ 95{
96 uint64 seq; 96 uint64 seq;
97 97
98 enum { MAX_LEN = 3 + 16 + 1 + 1 }; // <1. + hex + > + \0
99
98 static UUID cur; // last uuid generated 100 static UUID cur; // last uuid generated
99 static void init (); 101 static void init ();
100 static UUID gen (); 102 static UUID gen ();
101 103
102 UUID () { } 104 UUID () { }
103 UUID (uint64 seq) : seq(seq) { } 105 UUID (uint64 seq) : seq(seq) { }
104 operator uint64() { return seq; } 106 operator uint64() { return seq; }
105 void operator =(uint64 seq) { this->seq = seq; } 107 void operator =(uint64 seq) { this->seq = seq; }
106 108
107 typedef char BUF [32];
108
109 bool parse (const char *s) 109 bool parse (const char *s);
110 { 110 char *append (char *buf) const;
111 return sscanf (s, "<1.%" SCNx64 ">", &seq) == 1;
112 }
113
114 const char *c_str (char *buf, int len) const
115 {
116 snprintf (buf, len, "<1.%" PRIx64 ">", seq);
117
118 return buf;
119 }
120
121 const char *c_str () const 111 char *c_str () const;
122 {
123 static BUF buf;
124
125 return c_str (buf, sizeof (buf));
126 }
127}; 112};
128 113
129//+GPL 114//+GPL
130 115
131/* Definition for WILL_APPLY values. Replaces having harcoded values 116/* Definition for WILL_APPLY values. Replaces having harcoded values
139#define WILL_APPLY_DOOR 0x08 124#define WILL_APPLY_DOOR 0x08
140#define WILL_APPLY_FOOD 0x10 125#define WILL_APPLY_FOOD 0x10
141 126
142struct body_slot 127struct body_slot
143{ 128{
129 signed char used:4; /* Calculated value based on items equipped */
144 signed char info:4; /* body info as loaded from the file */ 130 signed char info:4; /* body info as loaded from the file */
145 signed char used:4; /* Calculated value based on items equipped */
146}; 131};
147 132
148typedef struct oblnk 133typedef struct oblnk
149{ /* Used to link together several objects */ 134{ /* Used to link together several objects */
150 object_ptr ob; 135 object_ptr ob;
227 uint8 ACC (RW, pick_up); /* See crossfire.doc */ 212 uint8 ACC (RW, pick_up); /* See crossfire.doc */
228 sint8 ACC (RW, gen_sp_armour);/* sp regen penalty this object has (was last_heal) */ 213 sint8 ACC (RW, gen_sp_armour);/* sp regen penalty this object has (was last_heal) */
229 sint8 ACC (RW, glow_radius); /* indicates the glow radius of the object */ 214 sint8 ACC (RW, glow_radius); /* indicates the glow radius of the object */
230 uint8 ACC (RW, weapontype); /* type of weapon */ 215 uint8 ACC (RW, weapontype); /* type of weapon */
231 216
217 body_slot slot [NUM_BODY_LOCATIONS];
218
232 faceidx ACC (RW, face); /* the graphical face */ 219 faceidx ACC (RW, face); /* the graphical face */
233 220
234 faceidx ACC (RW, sound); /* the sound face */ 221 faceidx ACC (RW, sound); /* the sound face */
235 faceidx ACC (RW, sound_destroy); /* played on destroy */ 222 faceidx ACC (RW, sound_destroy); /* played on destroy */
236
237 body_slot slot [NUM_BODY_LOCATIONS];
238 223
239 sint32 ACC (RW, weight); /* Attributes of the object */ 224 sint32 ACC (RW, weight); /* Attributes of the object */
240 sint32 ACC (RW, weight_limit);/* Weight-limit of object */ 225 sint32 ACC (RW, weight_limit);/* Weight-limit of object */
241 226
242 sint32 ACC (RW, carrying); /* How much weight this object contains, must be 0 if nrof == 0 */ 227 sint32 ACC (RW, carrying); /* How much weight this object contains, must be 0 if nrof == 0 */
645 MTH void create_treasure (treasurelist *tl, int flags = 0); 630 MTH void create_treasure (treasurelist *tl, int flags = 0);
646 631
647 // insert object at same map position as 'where' 632 // insert object at same map position as 'where'
648 // handles both inventory and map "positions" 633 // handles both inventory and map "positions"
649 MTH object *insert_at (object *where, object *originator = 0, int flags = 0); 634 MTH object *insert_at (object *where, object *originator = 0, int flags = 0);
635 // check whether we can put this into the map, respect max_nrof, max_volume, max_items
636 MTH bool can_drop_at (maptile *m, int x, int y, object *originator = 0);
650 MTH void drop_unpaid_items (); 637 MTH void drop_unpaid_items ();
651 638
652 MTH void activate (); 639 MTH void activate ();
653 MTH void deactivate (); 640 MTH void deactivate ();
654 MTH void activate_recursive (); 641 MTH void activate_recursive ();
811 MTH void link (); 798 MTH void link ();
812 MTH void unlink (); 799 MTH void unlink ();
813 800
814 MTH static object *get (const char *name); // (find() || singularity)->instance() 801 MTH static object *get (const char *name); // (find() || singularity)->instance()
815 MTH object *instance (); 802 MTH object *instance ();
803
804 MTH void post_load_check (); // do some adjustments after parsing
816 805
817 object_vector_index ACC (RW, archid); // index in archvector 806 object_vector_index ACC (RW, archid); // index in archvector
818 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ 807 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */
819 808
820 sint8 ACC (RW, min_x), ACC (RW, min_y); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */ 809 sint8 ACC (RW, min_x), ACC (RW, min_y); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines