Crossfire Server, Trunk
R21670
|
#include "dialog.h"
Go to the source code of this file.
Data Structures | |
struct | _key_value |
struct | archt |
struct | body_locations_struct |
struct | obj |
struct | oblinkpt |
struct | oblnk |
Macros | |
#define | ARCH_DEPLETION "depletion" |
#define | ARCH_DETECT_MAGIC "detect_magic" |
#define | ARCH_PORTAL_FAILED "town_portal_failed" |
#define | ARCH_SINGULARITY "singularity" |
#define | ARCH_SINGULARITY_LEN 11 |
#define | ARCH_SPELL_BLOCKED "spell_blocked" |
#define | ARCH_SPELL_BUNGLE "spell_bungle" |
#define | ARCH_SYMPTOM "symptom" |
#define | BODY_ARMS 1 |
#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 | 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 struct archt | archetype |
typedef struct body_locations_struct | body_locations_struct |
typedef struct _key_value | key_value |
typedef struct obj | object |
typedef struct oblnk | objectlink |
typedef struct oblinkpt | oblinkpt |
typedef uint32_t | tag_t |
Functions | |
static bool | CAN_PROBE (const object *ob) |
static void | clear_flag (object *op, int flag) |
static int | compare_flags (const object *p, const object *q) |
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" |
Archetype for depletion.
Definition at line 579 of file object.h.
Referenced by drain_specific_stat(), fix_object(), kill_player_not_permadeath(), perceive_self(), remove_depletion(), and START_TEST().
#define ARCH_DETECT_MAGIC "detect_magic" |
Archetype for detect magic spell.
Definition at line 578 of file object.h.
Referenced by cast_cause_disease().
#define ARCH_PORTAL_FAILED "town_portal_failed" |
Archetype for town portal failure.
Definition at line 581 of file object.h.
Referenced by cast_create_town_portal().
#define ARCH_SINGULARITY "singularity" |
Archetype for singularity.
Definition at line 576 of file object.h.
Referenced by create_singularity(), and START_TEST().
#define ARCH_SINGULARITY_LEN 11 |
Length of ARCH_SINGULARITY.
#define ARCH_SPELL_BLOCKED "spell_blocked" |
Archetype when a spell is blocked (unholy ground or non magic).
Definition at line 582 of file object.h.
Referenced by cast_spell().
#define ARCH_SPELL_BUNGLE "spell_bungle" |
Archetype when player bungles a spell.
Definition at line 583 of file object.h.
Referenced by cast_spell().
#define ARCH_SYMPTOM "symptom" |
Archetype for disease symptom.
Definition at line 580 of file object.h.
Referenced by do_symptoms().
#define BODY_ARMS 1 |
This should be the index of the arms.
Definition at line 14 of file object.h.
Referenced by adj_stealchance().
#define HEAD | ( | op | ) | ((op)->head != NULL ? (op)->head : (op)) |
Returns the head part of an object. For single-tile objects returns the object itself.
op | the object |
Definition at line 594 of file object.h.
Referenced by altar_type_move_on(), apply_anim_suffix(), apply_auto_fix(), apply_manual(), attack_ob(), attempt_jump(), blocked_link(), can_build_over(), cast_cause_disease(), cast_destruction(), cast_detection(), command_free(), command_remove(), common_pre_ob_move_on(), counterspell(), do_auto_apply(), do_exit_map(), do_symptoms(), esrv_draw_look(), esrv_get_ob_from_count(), esrv_send_inventory(), esrv_send_item(), esrv_update_item(), examine_monster(), find_monster_in_room_recursive(), free_all_objects(), friendly_fire(), get_attack_mode(), hit_map(), infect_object(), look_at(), map2_add_ob(), map_find_by_flag(), monster_can_see_enemy(), move_player_attack(), move_player_mover(), move_symptom(), move_teleporter(), nuke_map_region(), object_create_clone(), object_find_multi_free_spot_around(), object_find_multi_free_spot_within_radius(), object_get_multi_size(), object_insert_in_map_at(), object_insert_in_ob(), peacemaker_type_process(), pets_get_enemy(), pets_move(), pick_arrow_target(), pick_random_object(), player_can_view(), polymorph_living(), probe(), push_ob(), remove_monsters(), roll_ob(), scroll_type_apply(), singing(), spell_find_dir(), steal(), stick_arrow(), teleport(), transfer_ob(), trigger_altar_type_move_on(), trigger_pedestal_type_move_on(), try_fit(), and use_oratory().
#define LOOK_OBJ | ( | ob | ) | (!ob->invisible && ob->type != PLAYER && ob->type != EVENT_CONNECTOR) |
This returns TRUE if the object is something that should be displayed in the look window
Definition at line 507 of file object.h.
Referenced by command_examine(), esrv_draw_look(), esrv_send_inventory(), esrv_send_item(), esrv_update_item(), and object_remove().
#define NUM_BODY_LOCATIONS 13 |
Number of body locations.
Definition at line 13 of file object.h.
Referenced by apply_can_apply_object(), command_body(), command_possess(), examine(), fix_object(), get_ob_diff(), monster_can_pick(), and unapply_for_ob().
#define OB_SPELL_TAG_HASH | ( | op, | |
count | |||
) | (op->spell_tags[count&0xf]) |
Get the hash on an object for a specified count.
op | what to check. |
count | item to check the hash for. |
Definition at line 87 of file object.h.
Referenced by object_merge_spell().
#define OB_SPELL_TAG_MATCH | ( | op, | |
count | |||
) | (op->spell_tags[count&0xf] == count) |
Check whether a tag matches in the tags.
op | item to check against. |
count | tag to check. |
Definition at line 93 of file object.h.
Referenced by object_merge_spell(), and ok_to_put_more().
#define object_was_destroyed | ( | op, | |
old_tag | |||
) | (op->count != old_tag || QUERY_FLAG(op, FLAG_FREED)) |
Checks if an object still exists.
op | object to check |
old_tag | old tag of the object. |
Definition at line 68 of file object.h.
Referenced by apply_container(), attack_ob_simple(), attempt_steal(), cast_create_missile(), check_bullet(), check_pick(), Crossfire_Object_wrap(), do_execute_event(), do_throw(), drop_object(), explode_bullet(), CRECombatSimulator::fight(), fire_bow(), hit_map(), hit_player(), hit_with_arrow(), knowledge_alchemy_attempt(), monsterFight(), move_cone(), move_missile(), move_ob(), move_symptom(), object_check_move_on(), Object_GetExists(), object_remove(), pets_move(), pets_move_golem(), process_events(), rune_attack(), spell_effect_type_move_on(), spring_trap(), START_TEST(), stop_projectile(), and treasure_type_apply().
#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.
Definition at line 81 of file object.h.
Referenced by object_copy(), object_merge_spell(), and ok_to_put_more().
The archetype structure is a set of rules on how to generate and manipulate objects which point to archetypes. This probably belongs in arch.h, but there really doesn't appear to be much left in the archetype - all it really is is a holder for the object and pointers. This structure should get removed, and just replaced by the object structure
typedef struct body_locations_struct body_locations_struct |
One body location. See common/item.c.
typedef struct _key_value key_value |
Each object (this also means archetypes!) could have a few of these "dangling" from it; this could also end up containing 'parse errors'.
key and value are shared-strings.
Please use object_get_value(), object_set_value() from object.c rather than accessing the list directly. Exception is if you want to walk this list for some reason.
Main Crossfire structure, one ingame object.
Note that the ordering of this structure is sort of relevent - object_copy() copies everything over beyond 'name' using memcpy. Thus, values that need to be copied need to be located beyond that point.
However, if you're keeping a pointer of some sort, you probably don't just want it copied, so you'll need to add to common/object.c, e.g. copy-object
I've tried to clean up this structure a bit (in terms of formatting) by making it more consistent. I've also tried to locate some of the fields more logically together (put the item related ones together, the monster related ones, etc. This structure is best viewed with about a 100 width screen. MSW 2002-07-05
See the documentation page for more details.
typedef struct oblnk objectlink |
Used to link together several objects
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 | See 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 | |
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 | |
OBJECT_TYPE_MAX | Update if you add new types |
|
inlinestatic |
Determine whether the given object can have an HP bar.
Definition at line 603 of file object.h.
References obj::nrof.
Referenced by check_probe(), and probe().
|
inlinestatic |
Definition at line 495 of file object.h.
References obj::flags.
|
inlinestatic |
Definition at line 596 of file object.h.
References FLAG_ALIVE, and QUERY_FLAG.
Referenced by apply_map_builder(), check_spell_expiry(), command_use(), and do_harvest().
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 612 of file object.h.
Referenced by check_altar_sacrifice(), check_trigger(), content_recipe_value(), 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 491 of file object.h.
References obj::flags.
|
inlinestatic |
Definition at line 499 of file object.h.
References obj::flags.
object* active_objects |
List of active objects that need to be processed
Definition at line 62 of file object.c.
Referenced by cast_invisible(), object_count_active(), 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 54 of file item.c.
Referenced by command_body(), examine(), and get_ob_diff().
const char* const move_name[] |
Maps the MOVE_* values to names
Definition at line 4580 of file object.c.
Referenced by get_string_move_type().
int nrofallocobjects |
How many OBs allocated (free + used)
Definition at line 57 of file object.c.
Referenced by expand_objects(), malloc_info(), and object_free_all_data().
int nroffreeobjects |
How many OBs allocated and free (free)
Definition at line 56 of file object.c.
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 60 of file object.c.
Referenced by free_all_objects(), object_count_used(), and object_new().