Crossfire Server, Trunk
|
Go to the source code of this file.
Data Structures | |
struct | archetype |
struct | body_locations_struct |
struct | key_value |
struct | object |
struct | objectlink |
struct | oblinkpt |
Macros | |
#define | ARCH_DEPLETION "depletion" |
#define | ARCH_DETECT_MAGIC "detect_magic" |
#define | ARCH_PORTAL_FAILED "town_portal_failed" |
#define | ARCH_SINGULARITY "singularity" |
#define | ARCH_SPELL_BLOCKED "spell_blocked" |
#define | ARCH_SPELL_BUNGLE "spell_bungle" |
#define | ARCH_SYMPTOM "symptom" |
#define | BODY_ARMS 1 |
#define | CUSTOM_NAME_FIELD "custom_name" |
#define | FREE_OBJ_DROP_ABOVE_FLOOR 4 |
#define | FREE_OBJ_FREE_INVENTORY 1 |
#define | FREE_OBJ_NO_DESTROY_CALLBACK 2 |
#define | HEAD(op) ((op)->head != NULL ? (op)->head : (op)) |
#define | INS_ABOVE_FLOOR_ONLY 0x0002 |
#define | INS_BELOW_ORIGINATOR 0x0010 |
#define | INS_MAP_LOAD 0x0020 |
#define | INS_NO_MERGE 0x0001 |
#define | INS_NO_WALK_ON 0x0004 |
#define | INS_ON_TOP 0x0008 |
#define | LOOK_OBJ(ob) (!ob->invisible && ob->type != PLAYER && ob->type != EVENT_CONNECTOR) |
#define | MONSTER_EXCLUDE_FROM_READABLE_KEY "exclude_from_readable" |
#define | NUM_BODY_LOCATIONS 13 |
#define | OB_SPELL_TAG_HASH(op, count) (op->spell_tags[count&0xf]) |
#define | OB_SPELL_TAG_MATCH(op, count) (op->spell_tags[count&0xf] == count) |
#define | object_was_destroyed(op, old_tag) (op->count != old_tag || QUERY_FLAG(op, FLAG_FREED)) |
#define | SPELL_TAG_SIZE 16 |
#define | UP_OBJ_CHANGE 3 |
#define | UP_OBJ_FACE 4 |
#define | UP_OBJ_INSERT 1 |
#define | UP_OBJ_REMOVE 2 |
#define | WILL_APPLY_DOOR 0x8 |
#define | WILL_APPLY_EARTHWALL 0x4 |
#define | WILL_APPLY_FOOD 0x10 |
#define | WILL_APPLY_HANDLE 0x1 |
#define | WILL_APPLY_TREASURE 0x2 |
Typedefs | |
typedef uint32_t | ob_flags[4] |
typedef uint32_t | tag_t |
Functions | |
object * | add_force (object *op, const char *name, int duration) |
static bool | CAN_PROBE (const object *ob) |
static void | clear_flag (object *op, int flag) |
static void | compare_flags (ob_flags *ret, const object *p, const object *q) |
object * | find_force (object *op, const char *name) |
static bool | IS_PLAYER (object *op) |
static uint32_t | NROF (const object *const ob) |
static int | query_flag (const object *op, int flag) |
static void | set_flag (object *op, int flag) |
Variables | |
object * | active_objects |
body_locations_struct | body_locations [NUM_BODY_LOCATIONS] |
const char *const | move_name [] |
int | nrofallocobjects |
int | nroffreeobjects |
object * | objects |
Object structure, the core of Crossfire.
Definition in file object.h.
#define ARCH_DEPLETION "depletion" |
#define ARCH_DETECT_MAGIC "detect_magic" |
#define ARCH_PORTAL_FAILED "town_portal_failed" |
#define ARCH_SINGULARITY "singularity" |
#define ARCH_SPELL_BLOCKED "spell_blocked" |
#define ARCH_SPELL_BUNGLE "spell_bungle" |
#define ARCH_SYMPTOM "symptom" |
#define CUSTOM_NAME_FIELD "custom_name" |
#define FREE_OBJ_DROP_ABOVE_FLOOR 4 |
#define FREE_OBJ_FREE_INVENTORY 1 |
#define FREE_OBJ_NO_DESTROY_CALLBACK 2 |
#define HEAD | ( | op | ) | ((op)->head != NULL ? (op)->head : (op)) |
#define INS_ABOVE_FLOOR_ONLY 0x0002 |
#define INS_BELOW_ORIGINATOR 0x0010 |
#define INS_NO_MERGE 0x0001 |
#define INS_NO_WALK_ON 0x0004 |
#define LOOK_OBJ | ( | ob | ) | (!ob->invisible && ob->type != PLAYER && ob->type != EVENT_CONNECTOR) |
#define MONSTER_EXCLUDE_FROM_READABLE_KEY "exclude_from_readable" |
#define OB_SPELL_TAG_HASH | ( | op, | |
count | |||
) | (op->spell_tags[count&0xf]) |
#define OB_SPELL_TAG_MATCH | ( | op, | |
count | |||
) | (op->spell_tags[count&0xf] == count) |
#define object_was_destroyed | ( | op, | |
old_tag | |||
) | (op->count != old_tag || QUERY_FLAG(op, FLAG_FREED)) |
#define SPELL_TAG_SIZE 16 |
Defines default size of the *spell_tags pointer. The OB_SPELL_TAG_HASH is a simple mechanism to get/set the spell tags based on a simple hash - it should change if the tag size also changes. Note that since count is used for this, this value is effectively random or at least fairly evenly distributed, at least in the low bits. And a size of 16 lets us do a very fast operation.
#define UP_OBJ_FACE 4 |
typedef uint32_t tag_t |
enum object_type |
Only add new values to this list if somewhere in the program code, it is actually needed. Just because you add a new monster does not mean it has to have a type defined here. That only needs to happen if in some .c file, it needs to do certain special actions based on the monster type, that can not be handled by any of the numerous flags. Also, if you add new entries, try and fill up the holes in this list. Additionally, when you add a new entry, include it in the table in common/item.c
type 0 is undefined and indicates non-valid type information.
Enumerator | |
---|---|
PLAYER | See Player |
TRANSPORT | see doc/Developers/objects See Transport |
ROD | See Rod |
TREASURE | See Treasure |
POTION | See Potion |
FOOD | See Food |
POISON | See Poison Food |
BOOK | See Book |
CLOCK | See Clock |
DRAGON_FOCUS | Used during character creation |
ARROW | See Projectile |
BOW | See Shooting Weapon |
WEAPON | See Weapon |
ARMOUR | |
PEDESTAL | See Pedestal |
ALTAR | See Altar |
LOCKED_DOOR | See Locked Door |
SPECIAL_KEY | See Special Key |
MAP | |
DOOR | See Door |
KEY | |
TIMED_GATE | See Timed Gate |
TRIGGER | See Handle Trigger |
GRIMREAPER | |
MAGIC_EAR | See Magic Ear |
TRIGGER_BUTTON | See Button Trigger |
TRIGGER_ALTAR | See Altar Trigger |
TRIGGER_PEDESTAL | |
SHIELD | See Shield |
HELMET | See Helmet |
MONEY | See Money |
CLASS | Object for applying character class modifications to someone See Class Changer |
AMULET | See Amulet |
PLAYERMOVER | See Mover |
TELEPORTER | See Teleporter |
CREATOR | See Creator |
SKILL | Also see SKILL_TOOL (74) below See Skill |
EARTHWALL | |
GOLEM | |
THROWN_OBJ | |
BLINDNESS | |
GOD | |
DETECTOR | peterm: detector is an object which notices the presense of another object and is triggered like buttons. See Detector |
TRIGGER_MARKER | inserts an invisible, weightless force into a player with a specified string WHEN TRIGGERED. See Trigger Marker |
DEAD_OBJECT | |
DRINK | See Drink |
MARKER | inserts an invisible, weightless force into a player with a specified string. See Marker |
HOLY_ALTAR | See Holy Altar |
PLAYER_CHANGER | See Player Changer |
BATTLEGROUND | battleground, by Andreas Vogl See Battleground |
PEACEMAKER | Object owned by a player which can convert a monster into a peaceful being incapable of attack. |
GEM | See Jewel |
FIREWALL | See Magic Wall |
CHECK_INV | b.t. thoma s@no mad.a stro .psu. edu |
MOOD_FLOOR | b.t. thoma values of last_sp set how to change: 0 = furious, all monsters become aggressive 1 = angry, all but friendly become aggressive 2 = calm, all aggressive monsters calm down 3 = sleep, all monsters fall asleep 4 = charm, monsters become pets s@no mad.a stro .psu. edu See Mood Floor |
EXIT | See Exit |
ENCOUNTER | |
SHOP_FLOOR | See Shop Floor |
SHOP_MAT | See Shop Mat |
RING | See Ring |
FLOOR | Floor tile -> native layer 0 |
FLESH | animal 'body parts' -b.t. See Flesh |
INORGANIC | metals, minerals, dragon scales See Inorganic |
SKILL_TOOL | Allows the use of a skill |
LIGHTER | |
WALL | Wall. Put it always in layer 1 if not set is_floor |
MISC_OBJECT | misc. objects are for objects without a function in the engine. Like statues, clocks, chairs... If perhaps we create a function where we can sit on chairs, we create a new type and remove all chairs from here. |
MONSTER | A real, living creature |
LAMP | Lamp |
DUPLICATOR | Duplicator/multiplier object See Duplicator |
SPELLBOOK | See Spellbook |
CLOAK | See Cloak |
SPINNER | See Spinner |
GATE | See Gate |
BUTTON | See Button |
CF_HANDLE | See Handle |
HOLE | See Pit |
TRAPDOOR | See Trapdoor |
SIGN | |
BOOTS | See Boots |
GLOVES | See Gloves |
SPELL | See Spell |
SPELL_EFFECT | |
CONVERTER | See Converter |
BRACERS | See Bracers |
POISONING | |
SAVEBED | See Savebed |
WAND | See Wand & Staff |
SCROLL | See Scroll |
DIRECTOR | See Director |
GIRDLE | See Girdle |
FORCE | |
POTION_RESIST_EFFECT | A force, holding the effect of a resistance potion |
EVENT_CONNECTOR | Lauwenmark: an invisible object holding a plugin event hook See Event |
CLOSE_CON | Eneq((at)csd.uu.se): Id for close_container archetype. |
CONTAINER | See Container |
ARMOUR_IMPROVER | |
WEAPON_IMPROVER | |
SKILLSCROLL | can add a skill to player's inventory -bt. See Skill Scroll |
DEEP_SWAMP | See Swamp |
IDENTIFY_ALTAR | |
SHOP_INVENTORY | Mark Wedel (mark@) Shop inventories pyra mid.c om |
RUNE | See Rune |
TRAP | See Trap |
POWER_CRYSTAL | See Power Crystal |
CORPSE | |
DISEASE | See Disease |
SYMPTOM | |
BUILDER | Generic item builder, see subtypes below See Builder |
MATERIAL | Material for building |
MIMIC | |
LIGHTABLE | |
OBJECT_TYPE_MAX | Try to find a fire/heat source to light this when applied Update if you add new types |
Add or return an existing force inside 'op' with the given 'name' and 'duration' in units of 100 ticks (12 seconds under default settings). If 'duration' is zero, the force will not expire by itself.
Definition at line 5430 of file object.cpp.
References add_string(), create_archetype(), find_force(), dragon_attune::force, FORCE_NAME, give::name, object_insert_in_ob(), object_update_speed(), and give::op.
Referenced by commit_crime(), and move_marker().
|
inlinestatic |
Determine whether the given object can have an HP bar.
Definition at line 616 of file object.h.
References FLAG_ALIVE, FLAG_MONSTER, guildjoin::ob, PLAYER, and QUERY_FLAG.
Referenced by check_probe(), and probe().
|
inlinestatic |
Definition at line 499 of file object.h.
References object::flags, and item::q.
Referenced by get_ob_diff().
Find a force with the given 'name' in the slaying field. These forces are used as markers that may expire, for example, in the marker type. This is a thin wrapper around object_find_by_type_and_slaying().
Definition at line 5425 of file object.cpp.
References FORCE, give::name, object_find_by_type_and_slaying(), and give::op.
Referenced by add_force(), is_criminal(), and move_marker().
|
inlinestatic |
Definition at line 609 of file object.h.
References give::op, and PLAYER.
Referenced by apply_map_builder(), check_spell_expiry(), command_use(), do_harvest(), and move_aura().
|
inlinestatic |
Returns ob->nrof, unless it is 0, in which case return 1. Most of the code assumes that nrof=0 is the same as nrof=1.
Definition at line 625 of file object.h.
References guildjoin::ob.
Referenced by check_altar_sacrifice(), check_trigger(), content_recipe_value(), detect_curse_on_item(), detect_magic_on_item(), identify_object_with_skill(), make_item_from_recipe(), object_split(), object_sum_weight(), pick_up_object(), price_base(), query_weight(), shop_price_sell(), trapdoor_type_move_on(), and update_button().
|
inlinestatic |
Definition at line 505 of file object.h.
References give::op.
Referenced by do_follow().
|
inlinestatic |
object* active_objects |
List of active objects that need to be processed
Definition at line 296 of file object.cpp.
Referenced by init_objects(), object_count_active(), object_remove_from_active_list(), object_update_speed(), and process_events().
body_locations_struct body_locations[NUM_BODY_LOCATIONS] |
The ordering of this is actually doesn't make a difference However, for ease of use, new entries should go at the end so those people that debug the code that get used to something being in the location 4 don't get confused.
The ordering in save_name, use_name, nonuse_name. save_name is the name used to load/save it from files. It should match that of the doc/Developers/objects. The only real limitation is that it shouldn't have spaces or other characters that may mess up the match code. It must also start with body_ use_name is how we describe the location if we can use it. nonuse_name is how we describe it if we can't use it. I think the values below will make it pretty clear how those work out They are basically there to make life a little easier - if a character examines an item and it says it goes on 'your arm', its pretty clear they can use it. See the last sample (commented out) for a dragon Note that using the term 'human' may not be very accurate, humanoid may be better. Basically, for the use/nonuse, the code does something like: "This item goes %s\n", with the use/nonuse values filling in the s
Definition at line 55 of file item.cpp.
Referenced by command_body(), examine(), get_ob_diff(), and set_body_info().
const char* const move_name[] |
Maps the MOVE_* values to names
Definition at line 4832 of file object.cpp.
Referenced by get_string_move_type(), and set_move().
int nrofallocobjects |
How many OBs allocated (free + used)
Definition at line 291 of file object.cpp.
Referenced by expand_objects(), malloc_info(), and object_free_all_data().
int nroffreeobjects |
How many OBs allocated and free (free)
Definition at line 290 of file object.cpp.
Referenced by expand_objects(), malloc_info(), object_free(), object_free_all_data(), and object_new().
object* objects |
Pointer to the list of used objects
Definition at line 294 of file object.cpp.
Referenced by free_all_objects(), init_objects(), insert_objects(), object_count_used(), object_dump_all(), object_find_by_name_global(), object_find_by_tag_global(), object_free(), object_free_all_data(), and object_new().