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.213 by root, Mon Oct 19 21:48:49 2009 UTC vs.
Revision 1.215 by root, Sat Nov 7 18:30:05 2009 UTC

28#include <bitset> 28#include <bitset>
29 29
30#include "cfperl.h" 30#include "cfperl.h"
31#include "shstr.h" 31#include "shstr.h"
32 32
33//+GPL
34
33typedef int tag_t; 35typedef int tag_t;
34 36
35enum { 37enum {
36 body_skill, 38 body_skill,
37 body_combat, 39 body_combat,
85{ 87{
86 key_value *next; 88 key_value *next;
87 shstr key, value; 89 shstr key, value;
88}; 90};
89 91
92//-GPL
93
90struct UUID 94struct UUID
91{ 95{
92 uint64 seq; 96 uint64 seq;
93 97
94 static UUID cur; // last uuid generated 98 static UUID cur; // last uuid generated
119 static BUF buf; 123 static BUF buf;
120 124
121 return c_str (buf, sizeof (buf)); 125 return c_str (buf, sizeof (buf));
122 } 126 }
123}; 127};
128
129//+GPL
124 130
125/* Definition for WILL_APPLY values. Replaces having harcoded values 131/* Definition for WILL_APPLY values. Replaces having harcoded values
126 * sprinkled in the code. Note that some of these also replace fields 132 * sprinkled in the code. Note that some of these also replace fields
127 * that were in the can_apply area. What is the point of having both 133 * that were in the can_apply area. What is the point of having both
128 * can_apply and will_apply? 134 * can_apply and will_apply?
332 338
333 // privates / perl 339 // privates / perl
334 shstr_tmp kv_get (shstr_tmp key) const; 340 shstr_tmp kv_get (shstr_tmp key) const;
335 void kv_del (shstr_tmp key); 341 void kv_del (shstr_tmp key);
336 void kv_set (shstr_tmp key, shstr_tmp value); 342 void kv_set (shstr_tmp key, shstr_tmp value);
343
344//-GPL
337 345
338 // custom extra fields management 346 // custom extra fields management
339 struct key_value_access_proxy 347 struct key_value_access_proxy
340 { 348 {
341 object &ob; 349 object &ob;
523 MTH bool is_arrow () const { return type == ARROW 531 MTH bool is_arrow () const { return type == ARROW
524 || (type == SPELL_EFFECT 532 || (type == SPELL_EFFECT
525 && (subtype == SP_BULLET || subtype == SP_MAGIC_MISSILE)); } 533 && (subtype == SP_BULLET || subtype == SP_MAGIC_MISSILE)); }
526 MTH bool is_range () const { return type == BOW || type == ROD || type == WAND || type == HORN; } 534 MTH bool is_range () const { return type == BOW || type == ROD || type == WAND || type == HORN; }
527 535
528 MTH bool has_active_speed () const { return FABS(speed) >= MIN_ACTIVE_SPEED; } 536 MTH bool has_active_speed () const { return fabs (speed) >= MIN_ACTIVE_SPEED; }
529 537
530 // temporary: wether the object can be saved in a map file 538 // temporary: wether the object can be saved in a map file
531 // contr => is a player 539 // contr => is a player
532 // head => only save head of a multitile object 540 // head => only save head of a multitile object
533 // owner => can not reference owner yet 541 // owner => can not reference owner yet
752 object (const object &); 760 object (const object &);
753}; 761};
754 762
755// move this object to the top of its env's inventory to speed up 763// move this object to the top of its env's inventory to speed up
756// searches for it. 764// searches for it.
757static object * 765static inline object *
758splay (object *ob) 766splay (object *ob)
759{ 767{
760 if (ob->above && ob->env) 768 if (ob->above && ob->env)
761 { 769 {
762 if (ob->above) ob->above->below = ob->below; 770 if (ob->above) ob->above->below = ob->below;
768 ob->env->inv = ob; 776 ob->env->inv = ob;
769 } 777 }
770 778
771 return ob; 779 return ob;
772} 780}
781
782//+GPL
773 783
774object *find_skill_by_name_fuzzy (object *who, const char *name); 784object *find_skill_by_name_fuzzy (object *who, const char *name);
775object *find_skill_by_name (object *who, shstr_cmp sh); 785object *find_skill_by_name (object *who, shstr_cmp sh);
776object *find_skill_by_number (object *who, int skillno); 786object *find_skill_by_number (object *who, int skillno);
777 787
782 * be much left in the archetype - all it really is is a holder for the 792 * be much left in the archetype - all it really is is a holder for the
783 * object and pointers. This structure should get removed, and just replaced 793 * object and pointers. This structure should get removed, and just replaced
784 * by the object structure 794 * by the object structure
785 */ 795 */
786 796
797//-GPL
798
787INTERFACE_CLASS (archetype) 799INTERFACE_CLASS (archetype)
788struct archetype : object 800struct archetype : object
789{ 801{
790 static arch_ptr empty; // the empty_archetype 802 static arch_ptr empty; // the empty_archetype
791 MTH static void gc (); 803 MTH static void gc ();
849 statementvar (object *, var, actives [_i]) 861 statementvar (object *, var, actives [_i])
850 862
851#define for_all_archetypes(var) \ 863#define for_all_archetypes(var) \
852 for (unsigned _i = 0; _i < archetypes.size (); ++_i) \ 864 for (unsigned _i = 0; _i < archetypes.size (); ++_i) \
853 statementvar (archetype *, var, archetypes [_i]) 865 statementvar (archetype *, var, archetypes [_i])
866
867//+GPL
854 868
855/* Used by update_object to know if the object being passed is 869/* Used by update_object to know if the object being passed is
856 * being added or removed. 870 * being added or removed.
857 */ 871 */
858#define UP_OBJ_INSERT 1 872#define UP_OBJ_INSERT 1
888#define INS_ABOVE_FLOOR_ONLY 0x0002 902#define INS_ABOVE_FLOOR_ONLY 0x0002
889#define INS_NO_WALK_ON 0x0004 903#define INS_NO_WALK_ON 0x0004
890#define INS_ON_TOP 0x0008 904#define INS_ON_TOP 0x0008
891#define INS_BELOW_ORIGINATOR 0x0010 905#define INS_BELOW_ORIGINATOR 0x0010
892 906
893#define ARCH_DEPLETION "depletion" 907//-GPL
894 908
895#endif 909#endif
896 910

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines