--- deliantra/server/include/define.h 2010/03/28 22:29:50 1.115 +++ deliantra/server/include/define.h 2010/04/11 00:34:05 1.128 @@ -51,6 +51,8 @@ #define MAX_STAT 30 /* The maximum legal value of any stat */ #define MIN_STAT 1 /* The minimum legal value of any stat */ +#define MAX_FOOD 999 + //TODO: not only use more reasonable values, also enforce them #define MIN_WC -120 #define MAX_WC 120 @@ -67,12 +69,6 @@ #define ATTUNE_REPELL 16 // levels diff for attune/repell -//TODO: remove all calls to fatal and replace them by cleanup -#define OUT_OF_MEMORY 0 -#define MAP_ERROR 1 -#define ARCHTABLE_TOO_SMALL 2 // unused -#define TOO_MANY_ERRORS 3 - /* TYPE DEFINES */ /* Only add new values to this list if somewhere in the program code, @@ -100,9 +96,9 @@ #define POISON 7 #define BOOK 8 #define CLOCK 9 -#define VEIN 10 // deliantra: minerla/ore/whatever vein -//11 -//12 +#define VEIN 10 // deliantra: mineral/ore/whatever vein +#define RANGED 11 // deliantra: other range item (skill based) +#define SKILLSCROLL 12 /* can add a skill to player's inventory -bt. */ #define ARROW 13 #define BOW 14 #define WEAPON 15 @@ -134,10 +130,10 @@ #define TELEPORTER 41 #define CREATOR 42 #define SKILL 43 /* also see SKILL_TOOL (74) below */ -//44 +#define IDENTIFY_ALTAR 44 #define EARTHWALL 45 #define GOLEM 46 -//47 +#define DEEP_SWAMP 47 #define THROWN_OBJ 48 #define BLINDNESS 49 #define GOD 50 @@ -162,7 +158,7 @@ * a monster into a peaceful being incapable of attack. */ #define GEM 60 -//61 +#define MENU 61 /* Mark Wedel (mark@pyramid.com) Shop inventories */ #define FIREWALL 62 #define ANVIL 63 #define CHECK_INV 64 /* by b.t. thomas@nomad.astro.psu.edu */ @@ -181,7 +177,7 @@ #define SHOP_FLOOR 68 #define SHOP_MAT 69 #define RING 70 -#define FLOOR 71 /* this is a floor tile -> native layer 0 */ +//#define FLOOR 71 /* this is a floor tile -> native layer 0 */ // UNUSED??? #define FLESH 72 /* animal 'body parts' -b.t. */ #define INORGANIC 73 /* metals and minerals */ #define SKILL_TOOL 74 /* Allows the use of a skill */ @@ -202,16 +198,17 @@ #define SPELLBOOK 85 //86 #define CLOAK 87 -//88 -//89 +#define MAPSCRIPT 88 /* A perl-scripted connectable */ +#define SAFE_GROUND 89 /* This is a safe ground, means that neither bombs, + potions, alchemy, or magic works here (elmex) */ #define SPINNER 90 #define GATE 91 #define BUTTON 92 #define T_HANDLE 93 #define HOLE 94 #define TRAPDOOR 95 -//96 -//97 +#define RUNE 96 +#define TRAP 97 #define SIGN 98 #define BOOTS 99 #define GLOVES 100 @@ -221,8 +218,8 @@ #define BRACERS 104 #define POISONING 105 #define SAVEBED 106 -//107 -//108 +#define DISEASE 107 +#define SYMPTOM 108 #define WAND 109 #define INSCRIBABLE 110 // inscribable things, st 0 book st 1 spell #define SCROLL 111 @@ -231,61 +228,50 @@ #define FORCE 114 #define POTION_EFFECT 115 /* a force, holding the effect of a potion */ #define EVENT_CONNECTOR 116 /* Lauwenmark: an invisible object holding a plugin event hook */ -//117 -//118 -//119 +#define ITEM_TRANSFORMER 117 /* Transforming one item with another */ +#define POWER_CRYSTAL 118 +#define CORPSE 119 //120 #define CLOSE_CON 121 /* Eneq(@csd.uu.se): Id for close_container archetype. */ #define CONTAINER 122 #define ARMOUR_IMPROVER 123 #define WEAPON_IMPROVER 124 -//125 -//126 -//127 -//128 -//129 -#define SKILLSCROLL 130 /* can add a skill to player's inventory -bt. */ -//131 -//132 -//133 -//134 -//135 -//136 -//137 -#define DEEP_SWAMP 138 -#define IDENTIFY_ALTAR 139 -//140 -//141 -//142 -//143 -//144 -//145 -//146 -//147 -//148 -//149 -#define MENU 150 /* Mark Wedel (mark@pyramid.com) Shop inventories */ -//151 -//152 -//153 -#define RUNE 154 -#define TRAP 155 -#define POWER_CRYSTAL 156 -#define CORPSE 157 -#define DISEASE 158 -#define SYMPTOM 159 -#define BUILDER 160 /* Generic item builder, see subtypes */ -#define MATERIAL 161 /* Material for building */ -//162 -#define ITEM_TRANSFORMER 163 /* Transforming one item with another */ -#define MAPSCRIPT 164 /* A perl-scripted connectable */ -#define SAFE_GROUND 165 /* This is a safe ground, means that neither bombs, - potions, alchemy, or magic works here (elmex) */ +#define BUILDER 125 /* Generic item builder, see subtypes */ +#define MATERIAL 126 /* Material for building */ -#define NUM_TYPES 166 // must be max(type) + 1 +#define NUM_TYPES 127 // must be max(type) + 1 /* END TYPE DEFINE */ +typedef std::bitset typeset; + +/* These are the items that currently can change digestion, regeneration, + * spell point recovery and mana point recovery. Seems sort of an arbitary + * list, but other items store other info into stats array. + * As a special exception, bows use stats.sp for their own purposes. + */ +static const struct digest_types : typeset +{ + digest_types () + { + set (WEAPON); + set (BOW); + set (ARMOUR); + set (HELMET); + set (SHIELD); + set (RING); + set (BOOTS); + set (GLOVES); + set (AMULET); + set (GIRDLE); + set (BRACERS); + set (CLOAK); + set (DISEASE); + set (FORCE); + set (SKILL); + } +} digest_types; + // maximum supported subtype number + 1, can be increased to 256 // currently (2007-09) in use: 50 #define NUM_SUBTYPES 64 @@ -386,11 +372,6 @@ * common/loader.C is updated. */ -/* Basic routines to do above */ -#define SET_FLAG(obj, flg) (obj)->flag [flg] = 1 -#define CLEAR_FLAG(obj, flg) (obj)->flag [flg] = 0 -#define QUERY_FLAG(obj, flg) (obj)->flag [flg] - /* the flags */ #define FLAG_ALIVE 0 /* Object can fight (or be fought) */ @@ -403,8 +384,7 @@ #define FLAG_USE_SHIELD 7 /* Can this creature use a shield? */ #define FLAG_NO_PICK 8 /* Object can't be picked up */ - -/*#define FLAG_WALK_ON 9*//* Applied when it's walked upon */ +/*#define FLAG_WALK_ON 9*/ /*#define FLAG_NO_PASS 10*//* Nothing can pass (wall() is true) */ #define FLAG_ANIMATE 11 /* The object looks at archetype for faces */ @@ -592,8 +572,8 @@ * practical reason to exceed this */ #define LOS_MAX 4 /* max. los value for non-blocked spaces */ #define LOS_BLOCKED 100 /* fully blocked spaces */ -#define BRIGHTNESS(xyz) (xyz)->glow_radius>MAX_LIGHT_RADII? \ - MAX_LIGHT_RADII:(xyz)->glow_radius; +#define BRIGHTNESS(xyz) (xyz)->glow_radius>MAX_LIGHT_RADII ? \ + MAX_LIGHT_RADII : (xyz)->glow_radius; // player position in blocked_los code #define LOS_X0 (MAP_CLIENT_X / 2 - 1) #define LOS_Y0 (MAP_CLIENT_Y / 2 - 1) @@ -700,17 +680,16 @@ enum apply_flag { /* Basic flags/mode, always use one of these */ - AP_TOGGLE = 0, - AP_APPLY = 1, - AP_UNAPPLY = 2, - - AP_BASIC_FLAGS = 0x0f, + AP_TOGGLE = 0, + AP_APPLY = 0x01, + AP_UNAPPLY = 0x02, + AP_MODE = 0x03, /* Optional flags, for bitwise or with a basic flag */ AP_NO_MERGE = 0x10, AP_IGNORE_CURSE = 0x20, - AP_PRINT = 0x40, /* Print what to do, don't actually do it */ - AP_NO_READY = 0x80, // do not ready skill associated with skilltool. + AP_PRINT = 0x40, /* Print what to do, don't actually do it */ + AP_NO_SLOT = 0x80, // do not update the combat/ranged/current slots }; /* Bitmask values for 'can_apply_object()' return values. @@ -739,16 +718,19 @@ * could remove. * */ -#define CAN_APPLY_NEVER 0x1 -#define CAN_APPLY_RESTRICTION 0x2 -#define CAN_APPLY_NOT_MASK 0xf +#define CAN_APPLY_NEVER 0x01 +#define CAN_APPLY_RESTRICTION 0x02 +#define CAN_APPLY_NOT_MASK 0x0f + #define CAN_APPLY_UNAPPLY 0x10 #define CAN_APPLY_UNAPPLY_MULT 0x20 #define CAN_APPLY_UNAPPLY_CHOICE 0x40 // Cut off point of when an object is put on the active list or not // we use 2**-n because that can be represented exactly -// also make sure that this is a float, not double, constant +// also make sure that this is a float, not double, constant. +// some areas in the server divide by this value, so +// to avoid integer overflows it should not be much lower. #define MIN_ACTIVE_SPEED (1.f / 65536.f) /* have mercy on players and guarantee a somewhat higher speed */