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.216 by root, Sun Nov 8 20:55:39 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
637 MTH void create_treasure (treasurelist *tl, int flags = 0); 645 MTH void create_treasure (treasurelist *tl, int flags = 0);
638 646
639 // insert object at same map position as 'where' 647 // insert object at same map position as 'where'
640 // handles both inventory and map "positions" 648 // handles both inventory and map "positions"
641 MTH object *insert_at (object *where, object *originator = 0, int flags = 0); 649 MTH object *insert_at (object *where, object *originator = 0, int flags = 0);
650 // check whether we can put this into the map, respect max_nrof, max_volume, max_items
651 MTH bool can_drop_at (maptile *m, int x, int y, object *originator = 0);
642 MTH void drop_unpaid_items (); 652 MTH void drop_unpaid_items ();
643 653
644 MTH void activate (); 654 MTH void activate ();
645 MTH void deactivate (); 655 MTH void deactivate ();
646 MTH void activate_recursive (); 656 MTH void activate_recursive ();
752 object (const object &); 762 object (const object &);
753}; 763};
754 764
755// move this object to the top of its env's inventory to speed up 765// move this object to the top of its env's inventory to speed up
756// searches for it. 766// searches for it.
757static object * 767static inline object *
758splay (object *ob) 768splay (object *ob)
759{ 769{
760 if (ob->above && ob->env) 770 if (ob->above && ob->env)
761 { 771 {
762 if (ob->above) ob->above->below = ob->below; 772 if (ob->above) ob->above->below = ob->below;
768 ob->env->inv = ob; 778 ob->env->inv = ob;
769 } 779 }
770 780
771 return ob; 781 return ob;
772} 782}
783
784//+GPL
773 785
774object *find_skill_by_name_fuzzy (object *who, const char *name); 786object *find_skill_by_name_fuzzy (object *who, const char *name);
775object *find_skill_by_name (object *who, shstr_cmp sh); 787object *find_skill_by_name (object *who, shstr_cmp sh);
776object *find_skill_by_number (object *who, int skillno); 788object *find_skill_by_number (object *who, int skillno);
777 789
782 * be much left in the archetype - all it really is is a holder for the 794 * 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 795 * object and pointers. This structure should get removed, and just replaced
784 * by the object structure 796 * by the object structure
785 */ 797 */
786 798
799//-GPL
800
787INTERFACE_CLASS (archetype) 801INTERFACE_CLASS (archetype)
788struct archetype : object 802struct archetype : object
789{ 803{
790 static arch_ptr empty; // the empty_archetype 804 static arch_ptr empty; // the empty_archetype
791 MTH static void gc (); 805 MTH static void gc ();
849 statementvar (object *, var, actives [_i]) 863 statementvar (object *, var, actives [_i])
850 864
851#define for_all_archetypes(var) \ 865#define for_all_archetypes(var) \
852 for (unsigned _i = 0; _i < archetypes.size (); ++_i) \ 866 for (unsigned _i = 0; _i < archetypes.size (); ++_i) \
853 statementvar (archetype *, var, archetypes [_i]) 867 statementvar (archetype *, var, archetypes [_i])
868
869//+GPL
854 870
855/* Used by update_object to know if the object being passed is 871/* Used by update_object to know if the object being passed is
856 * being added or removed. 872 * being added or removed.
857 */ 873 */
858#define UP_OBJ_INSERT 1 874#define UP_OBJ_INSERT 1
888#define INS_ABOVE_FLOOR_ONLY 0x0002 904#define INS_ABOVE_FLOOR_ONLY 0x0002
889#define INS_NO_WALK_ON 0x0004 905#define INS_NO_WALK_ON 0x0004
890#define INS_ON_TOP 0x0008 906#define INS_ON_TOP 0x0008
891#define INS_BELOW_ORIGINATOR 0x0010 907#define INS_BELOW_ORIGINATOR 0x0010
892 908
893#define ARCH_DEPLETION "depletion" 909//-GPL
894 910
895#endif 911#endif
896 912

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines