Crossfire Server, Branches 1.12  R18729
global.h File Reference
#include "includes.h"
#include "face.h"
#include "attack.h"
#include "material.h"
#include "living.h"
#include "object.h"
#include "map.h"
#include "tod.h"
#include "skills.h"
#include "newserver.h"
#include "player.h"
#include "treasure.h"
#include "commands.h"
#include "book.h"
#include "ob_methods.h"
#include "ob_types.h"
#include "artifact.h"
#include "god.h"
#include "race.h"
#include "recipe.h"
#include "spells.h"
#include "stringbuffer.h"
#include "libproto.h"
#include "sockproto.h"
#include "typesproto.h"
#include "plugin.h"
+ Include dependency graph for global.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  linked_char
 
struct  Settings
 
struct  Statistics
 

Macros

#define CALLOC(x, y)   calloc(x, y)
 
#define CFREE(x)   free(x)
 
#define decrease_ob(xyz)   decrease_ob_nr(xyz, 1)
 
#define dirent   direct
 
#define EXTERN   extern
 
#define FREE_AND_CLEAR(xyz)   { free((void *)xyz); xyz = NULL; }
 
#define FREE_AND_CLEAR_STR(xyz)   { free_string(xyz); xyz = NULL; }
 
#define FREE_AND_COPY(sv, nv)   { if (sv) free_string(sv); sv = add_string(nv); }
 
#define GET_ANIM_ID(ob)   (ob->temp_animation_id ? ob->temp_animation_id : ob->animation_id)
 
#define GET_ANIMATION(ob, anim)   (ob->temp_animation_id ? animations[ob->temp_animation_id].faces[anim] : animations[ob->animation_id].faces[anim])
 
#define GETTIMEOFDAY(last_time)   gettimeofday(last_time);
 
#define NAMLEN(dirent)   (dirnet)->d_namlen
 
#define NROF_COMPRESS_METHODS   4
 
#define NUM_ANIMATIONS(ob)   (ob->temp_animation_id ? animations[ob->temp_animation_id].num_animations : animations[ob->animation_id].num_animations)
 
#define NUM_FACINGS(ob)   (ob->temp_animation_id ? animations[ob->temp_animation_id].facings : animations[ob->animation_id].facings)
 
#define ROTATE_RIGHT(c)   if ((c)&01) (c) = ((c)>>1)+0x80000000; else (c) >>= 1;
 
#define SCRIPT_FIX_ACTIVATOR   2
 
#define SCRIPT_FIX_ALL   1
 
#define SCRIPT_FIX_NOTHING   0
 
#define SET_ANIMATION(ob, newanim)   { if (ob->temp_animation_id) { ob->face = &new_faces[animations[ob->temp_animation_id].faces[newanim]]; } else { ob->face = &new_faces[animations[ob->animation_id].faces[newanim]]; } }
 
#define SINT16_MAX   32767
 
#define SINT32_MAX   2147483647
 
#define SINT8_MAX   127
 
#define UINT16_MAX   65535
 
#define UINT32_MAX   4294967295U
 
#define UINT8_MAX   255
 

Typedefs

typedef unsigned short Fontindex
 
typedef struct linked_char linked_char
 
typedef struct Settings Settings
 
typedef signed short sint16
 
typedef signed int sint32
 
typedef signed char sint8
 
typedef const char * sstring
 
typedef struct Statistics Statistics
 
typedef unsigned short uint16
 
typedef unsigned int uint32
 
typedef unsigned char uint8
 

Variables

EXTERN archetypeamulet_arch
 
EXTERN Animationsanimations
 
EXTERN int animations_allocated
 
New_Faceblank_face
 
EXTERN int bmaps_checksum
 
EXTERN archetypecrown_arch
 
EXTERN archetypeempty_archetype
 
New_Faceempty_face
 
EXTERN int exiting
 
EXTERN archetypefirst_archetype
 
EXTERN artifactlistfirst_artifactlist
 
EXTERN objectlinkfirst_friendly_object
 
EXTERN godlinkfirst_god
 
EXTERN mapstructfirst_map
 
EXTERN char first_map_ext_path [MAX_BUF]
 
EXTERN char first_map_path [MAX_BUF]
 
EXTERN playerfirst_player
 
EXTERN racelinkfirst_race
 
EXTERN regionfirst_region
 
EXTERN treasurelistfirst_treasurelist
 
short freearr_x [SIZEOFFREE]
 
short freearr_y [SIZEOFFREE]
 
int freedir [SIZEOFFREE]
 
EXTERN long init_done
 
socket_structinit_sockets
 
int leftof_x [9]
 
int leftof_y [9]
 
EXTERN FILE * logfile
 
EXTERN archetypemap_archeytpe
 
uint32 max_time
 
int maxfree [SIZEOFFREE]
 
New_Facenew_faces
 
EXTERN long nrofallowedstr
 
EXTERN long nrofartifacts
 
EXTERN long nroferrors
 
EXTERN long nroftreasures
 
EXTERN int num_animations
 
EXTERN long ob_count
 
uint32 pticks
 
int reopen_logfile
 
int rightof_x [9]
 
int rightof_y [9]
 
EXTERN archetypering_arch
 
Settings settings
 
New_Facesmooth_face
 
EXTERN archetypestaff_arch
 
Statistics statistics
 
EXTERN long trying_emergency_save
 
const char * uncomp [NROF_COMPRESS_METHODS][3]
 
EXTERN const char * undead_name
 
EXTERN long warn_archetypes
 

Detailed Description

Global definitions: u/sint8, things like that.

Definition in file global.h.

Macro Definition Documentation

#define CALLOC (   x,
 
)    calloc(x, y)
#define CFREE (   x)    free(x)

Definition at line 296 of file global.h.

Referenced by free_player().

#define dirent   direct

Definition at line 307 of file global.h.

#define EXTERN   extern

Definition at line 38 of file global.h.

#define FREE_AND_CLEAR (   xyz)    { free((void *)xyz); xyz = NULL; }
#define GET_ANIM_ID (   ob)    (ob->temp_animation_id ? ob->temp_animation_id : ob->animation_id)
#define GET_ANIMATION (   ob,
  anim 
)    (ob->temp_animation_id ? animations[ob->temp_animation_id].faces[anim] : animations[ob->animation_id].faces[anim])

Definition at line 248 of file global.h.

Referenced by common_process_projectile(), and trap_show().

#define GETTIMEOFDAY (   last_time)    gettimeofday(last_time);
#define NAMLEN (   dirent)    (dirnet)->d_namlen

Definition at line 308 of file global.h.

Referenced by help_topics().

#define NROF_COMPRESS_METHODS   4

Definition at line 201 of file global.h.

Referenced by check_path(), and open_and_uncompress().

#define NUM_ANIMATIONS (   ob)    (ob->temp_animation_id ? animations[ob->temp_animation_id].num_animations : animations[ob->animation_id].num_animations)
#define NUM_FACINGS (   ob)    (ob->temp_animation_id ? animations[ob->temp_animation_id].facings : animations[ob->animation_id].facings)

Definition at line 256 of file global.h.

Referenced by animate_object().

#define ROTATE_RIGHT (   c)    if ((c)&01) (c) = ((c)>>1)+0x80000000; else (c) >>= 1;

Definition at line 245 of file global.h.

Referenced by read_bmap_names(), and read_client_images().

#define SCRIPT_FIX_ACTIVATOR   2

Definition at line 449 of file global.h.

Referenced by do_throw().

#define SCRIPT_FIX_NOTHING   0
#define SINT16_MAX   32767

Definition at line 73 of file global.h.

#define SINT32_MAX   2147483647

Definition at line 65 of file global.h.

#define SINT8_MAX   127

Definition at line 81 of file global.h.

#define UINT16_MAX   65535

Definition at line 69 of file global.h.

#define UINT32_MAX   4294967295U

Definition at line 61 of file global.h.

Referenced by cost_string_from_value().

#define UINT8_MAX   255

Definition at line 77 of file global.h.

Typedef Documentation

typedef unsigned short Fontindex

Definition at line 86 of file global.h.

typedef struct linked_char linked_char
typedef struct Settings Settings

Server settings.

typedef signed short sint16

Definition at line 72 of file global.h.

typedef signed int sint32

Definition at line 64 of file global.h.

typedef signed char sint8

Definition at line 80 of file global.h.

typedef const char* sstring

Strings that should be manipulated through add_string() and free_string().

Definition at line 84 of file global.h.

typedef struct Statistics Statistics

This is used for various performance tracking statistics, or just how often certain events are done. It is much better to use a common structure then variables about. Note that since these are often counters, I'm using uint64s - this may be overkill, but it is just a couple extra bytes. This is initialized/declared in common/init.c. Note that if it only contains integer values, very easy to initialize/clear it - just a memset.

typedef unsigned short uint16

Definition at line 67 of file global.h.

typedef unsigned int uint32

Definition at line 58 of file global.h.

typedef unsigned char uint8

Definition at line 75 of file global.h.

Variable Documentation

EXTERN archetype * amulet_arch

Definition at line 238 of file global.h.

Referenced by fix_generated_item(), init_archetype_pointers(), and init_globals().

EXTERN int animations_allocated

Definition at line 242 of file global.h.

Referenced by init_anim(), and init_globals().

New_Face* blank_face

Following can just as easily be pointers, but it is easier to keep them like this.

Definition at line 66 of file image.c.

Referenced by add_abilities(), animate_object(), CREUtils::artifactNode(), clear_object(), magic_mapping_mark(), magic_mapping_mark_recursive(), tear_down_wall(), update_position(), and write_rune().

EXTERN int bmaps_checksum

Definition at line 242 of file global.h.

Referenced by read_bmap_names(), and send_image_info().

EXTERN archetype * crown_arch

Definition at line 238 of file global.h.

Referenced by fix_generated_item(), and init_archetype_pointers().

New_Face * empty_face

Definition at line 66 of file image.c.

Referenced by esrv_draw_look().

short freearr_x[SIZEOFFREE]

X offset when searching around a spot.

Definition at line 75 of file object.c.

Referenced by animate_bomb(), animate_weapon(), apply_builder_floor(), apply_builder_remove(), apply_map_builder(), attempt_jump(), can_see_monsterP(), cast_cause_disease(), cast_cone(), cast_create_obj(), cast_light(), cast_polymorph(), cast_raise_dead_spell(), cast_spell(), cast_transfer(), change_object(), command_summon(), command_teleport(), common_process_projectile(), communicate(), compute_path(), counterspell(), CREAnimationControl::CREAnimationControl(), create_bomb(), dimension_door(), dispel_rune(), do_harvest(), do_skill_ident(), do_throw(), enter_map(), expand_sight(), explosion(), find_closest_monster(), find_dir(), find_doors_in_room_recursive(), find_enclosed_spot(), find_first_free_spot(), find_free_spot(), find_monster_in_room_recursive(), find_nearest_living_creature(), find_spot_in_room_recursive(), find_target_for_friendly_spell(), find_traps(), fire_bullet(), fix_summon_pet(), follow_owner(), forklightning(), free_object2(), gate_type_process(), get_pet_enemy(), get_pointed_target(), hideability(), hit_map(), hit_player(), keyplace(), magic_wall(), monster_use_bow(), move_aura(), move_ball_spell(), move_bolt(), move_cone(), move_golem(), move_ob(), move_player_attack(), move_player_mover(), move_swarm_spell(), path_to_player(), pet_move(), pick_arrow_target(), pick_lock(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), player_fire_bow(), probe(), process_players1(), push_ob(), put_a_monster(), remove_adjacent_doors(), remove_door(), remove_locked_door(), remove_trap(), roll_ob(), shop_mat_type_move_on(), singing(), skill_attack(), spell_find_dir(), stand_near_hostile(), steal(), summon_golem(), summon_object(), surround_by_doors(), teleport(), transfer_ob(), turn_one_transport(), use_oratory(), and write_rune().

short freearr_y[SIZEOFFREE]

Y offset when searching around a spot.

Definition at line 81 of file object.c.

Referenced by animate_weapon(), apply_builder_floor(), apply_builder_remove(), apply_map_builder(), attempt_jump(), can_see_monsterP(), cast_cause_disease(), cast_cone(), cast_create_obj(), cast_light(), cast_polymorph(), cast_raise_dead_spell(), cast_spell(), cast_transfer(), change_object(), command_summon(), command_teleport(), common_process_projectile(), communicate(), compute_path(), counterspell(), CREAnimationControl::CREAnimationControl(), create_bomb(), dimension_door(), dispel_rune(), do_harvest(), do_skill_ident(), do_throw(), enter_map(), expand_sight(), explosion(), find_closest_monster(), find_dir(), find_doors_in_room_recursive(), find_enclosed_spot(), find_first_free_spot(), find_free_spot(), find_monster_in_room_recursive(), find_nearest_living_creature(), find_spot_in_room_recursive(), find_target_for_friendly_spell(), find_traps(), fire_bullet(), fix_summon_pet(), follow_owner(), forklightning(), free_object2(), gate_type_process(), get_pet_enemy(), get_pointed_target(), hideability(), hit_map(), hit_player(), keyplace(), magic_wall(), monster_use_bow(), move_aura(), move_ball_spell(), move_bolt(), move_cone(), move_golem(), move_ob(), move_player_attack(), move_player_mover(), move_swarm_spell(), path_to_player(), pet_move(), pick_arrow_target(), pick_lock(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), player_fire_bow(), probe(), process_players1(), push_ob(), put_a_monster(), remove_adjacent_doors(), remove_door(), remove_locked_door(), remove_trap(), roll_ob(), shop_mat_type_move_on(), singing(), skill_attack(), spell_find_dir(), stand_near_hostile(), steal(), summon_golem(), summon_object(), surround_by_doors(), teleport(), transfer_ob(), turn_one_transport(), use_oratory(), and write_rune().

int freedir[SIZEOFFREE]

Direction we're pointing on this spot.

Definition at line 93 of file object.c.

Referenced by find_dir(), spell_find_dir(), and summon_object().

EXTERN long init_done

Ignores signals until init_done is true.

Definition at line 210 of file global.h.

Referenced by fatal_signal(), init(), and init_races().

socket_struct* init_sockets

Established connections for clients not yet playing. See the page on the login process for a description of its use.

Definition at line 68 of file init.c.

Referenced by block_until_new_connection(), and do_server().

int leftof_x[9]
int leftof_y[9]
uint32 max_time

Gloabal variables:

Definition at line 46 of file time.c.

Referenced by command_speed(), enough_elapsed_time(), set_max_time(), sleep_delta(), and time_info().

int maxfree[SIZEOFFREE]

Number of spots around a location, including that location (except for 0)

Definition at line 87 of file object.c.

Referenced by find_dir(), and find_free_spot().

EXTERN long nroferrors

If it exceeds MAX_ERRORS, call fatal()

Definition at line 212 of file global.h.

Referenced by init_defaults(), LOG(), and server_main().

uint32 pticks

Used by various function to determine how often to save the character

?

Definition at line 56 of file time.c.

Referenced by check_login(), check_output_buffers(), do_some_living(), do_specials(), get_tod(), handle_newcs_player(), key_change_class(), log_time(), process_players1(), reset_sleep(), send_tick(), and time_info().

int rightof_x[9]
int rightof_y[9]
EXTERN archetype* ring_arch

Definition at line 238 of file global.h.

Referenced by fix_generated_item(), init_archetype_pointers(), and init_globals().

Settings settings

You unforunately need to looking in include/global.h to see what these correspond to.

Definition at line 48 of file init.c.

Referenced by add_me_cmd(), add_player_exp(), add_score(), apply_death_exp_penalty(), apply_special(), attack_ob_simple(), attempt_steal(), block_until_new_connection(), calc_perm_exp(), calc_skill_exp(), cast_create_town_portal(), cast_spell(), cctk_init_std_archetypes(), cctk_setdatadir(), cctk_setlog(), cfapi_system_directory(), check_exp_loss(), check_login(), check_pick(), checkbanned(), checkdm(), clean_tmp_files(), clear_object(), command_abil(), command_addexp(), command_banish(), command_create(), command_debug(), command_explore(), command_help(), command_loadtest(), command_nowiz(), command_patch(), command_players(), command_search_items(), command_title(), compile_info(), convert_item(), create_items_path(), create_overlay_pathname(), create_pathname(), create_template_pathname(), dead_player(), delete_character(), display_high_score(), display_motd(), dragon_eat_flesh(), dump_experience(), enter_exit(), enter_player_savebed(), enter_unique_map(), find_maps(), find_style(), fix_object(), forbid_play(), god_enchants_weapon(), help_topics(), hit_player(), i18n_init(), improve_armour(), improve_weapon(), init(), init_anim(), init_artifacts(), init_beforeplay(), init_book_archive(), init_experience(), init_formulae(), init_msgfile(), init_races(), init_regions(), init_server(), init_startup(), is_legal_2ways_exit(), key_change_class(), key_confirm_quit(), kill_object(), kill_player(), level_exp(), list_players(), load_archetypes(), load_materials(), load_settings(), load_treasures(), LOG(), main(), metaserver2_init(), metaserver_init(), metaserver_update(), pay_for_item(), pick_up_object(), player_lvl_adj(), process_events(), process_players1(), query_cost(), rangetostring(), read_bmap_names(), read_client_images(), read_face_data(), read_map_log(), read_smooth(), resurrect_player(), save_map(), save_player(), scroll_failure(), scroll_type_apply(), send_exp_table(), send_news(), send_rules(), server_main(), set_archetypes(), set_confdir(), set_csport(), set_daemon(), set_datadir(), set_debug(), set_dumpmon1(), set_dumpmon2(), set_dumpmon3(), set_dumpmon4(), set_dumpmon5(), set_dumpmon6(), set_dumpmon7(), set_dumpmon8(), set_dumpmon9(), set_dumpmont(), set_localdir(), set_logfile(), set_mapdir(), set_mondebug(), set_playerdir(), set_regions(), set_templatedir(), set_tmpdir(), set_treasures(), set_uniquedir(), show_skills(), SP_level_spellpoint_cost(), spell_failure(), spellbook_type_apply(), swap_map(), unset_debug(), verify_player(), write_book_archive(), write_map_log(), and write_scroll().

New_Face* smooth_face

Definition at line 66 of file image.c.

Referenced by send_smooth().

EXTERN archetype * staff_arch

Definition at line 238 of file global.h.

Referenced by init_archetype_pointers(), and init_globals().

Statistics statistics

Definition at line 119 of file init.c.

Referenced by init_globals(), main(), merge_spell(), and ok_to_put_more().

EXTERN long trying_emergency_save

True when emergency_save() is reached.

Definition at line 211 of file global.h.

Referenced by emergency_save(), init_globals(), and LOG().

const char* uncomp[NROF_COMPRESS_METHODS][3]

This is a list of the suffix, uncompress and compress functions. Thus, if you have some other compress program you want to use, the only thing that needs to be done is to extended this. The first entry must be NULL - this is what is used for non compressed files.

Definition at line 593 of file porting.c.

Referenced by check_path(), and save_map().

EXTERN const char* undead_name
EXTERN long warn_archetypes

If true, write warnings when failing to find archetypes when loading from file.

Definition at line 208 of file global.h.

Referenced by arch_to_object(), find_archetype(), init_archetype_pointers(), init_globals(), and load_archetypes().