19 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) 26 #include <sys/socket.h> 29 #ifdef HAVE_LIBDMALLOC 46 #define PRINTF_ARGS(x, y) __attribute__ ((format (printf, x, y))) 154 #define SPELL_MAPPINGS 206 162 #define ROTATE_RIGHT(c) if ((c)&01) (c) = ((c)>>1)+0x80000000; else (c) >>= 1; 164 #define SET_ANIMATION(ob, newanim) { ob->face = (ob->temp_animation ? ob->temp_animation : ob->animation)->faces[newanim]; } 165 #define GET_ANIMATION(ob, anim) ((ob->temp_animation ? ob->temp_animation : ob->animation)->faces[anim]) 166 #define GET_ANIM(ob) (ob->temp_animation ? ob->temp_animation : ob->animation) 167 #define GET_ANIM_ID(ob) (ob->temp_animation ? ob->temp_animation->num : (ob->animation ? ob->animation->num : 0)) 173 #define NUM_ANIMATIONS(ob) ((ob->temp_animation ? ob->temp_animation : ob->animation)->num_animations) 174 #define NUM_FACINGS(ob) ((ob->temp_animation ? ob->temp_animation : ob->animation)->facings) 195 #define FREE_AND_CLEAR(xyz) { free(xyz); xyz = NULL; } 200 #define FREE_AND_CLEAR_STR(xyz) { free_string(xyz); xyz = NULL; } 202 #define FREE_AND_CLEAR_STR_IF(xyz) { if (xyz) { free_string(xyz); xyz = NULL; } } 206 #define FREE_AND_COPY(sv, nv) { if (sv) free_string(sv); sv = add_string(nv); } 208 #define FREE_AND_COPY_IF(sv, nv) { if (sv) free_string(sv); sv = nv ? add_string(nv) : NULL; } 213 # define NAMLEN(dirent) strlen((dirent)->d_name) 215 # define dirent direct 216 # define NAMLEN(dirent) (dirent)->d_namlen 218 # include <sys/ndir.h> 221 # include <sys/dir.h> 232 #define PERM_EXP(exptotal) (exptotal * settings.permanent_exp_ratio / 100 ) 233 #define MAX_TOTAL_EXPERIENCE (settings.permanent_exp_ratio ? (MAX_EXPERIENCE * 100 / settings.permanent_exp_ratio) : 0) 235 typedef std::function<void(enum fatal_error err)>
fatalHook;
236 typedef std::function<void(LogLevel, const char *, va_list)>
logHook;
364 #define PROFILE_BEGIN(expr) { \ 365 struct timespec _begin, _end; \ 366 clock_gettime(CLOCK_MONOTONIC, &_begin); \ 369 #define PROFILE_END(var, expr) \ 370 clock_gettime(CLOCK_MONOTONIC, &_end); \ 371 long var = timespec_diff(&_end, &_begin); \ 379 #define SCRIPT_FIX_ACTIVATOR 2 380 #define SCRIPT_FIX_ALL 1 381 #define SCRIPT_FIX_NOTHING 0 EXTERN FILE * logfile
Used by server/daemon.c.
uint8_t not_permadeth
If true, death is non-permament.
const char * rules
Name of rules file.
int ignore_assets_errors
If set then go on running even if there are errors in assets.
fatalHook fatal_hook
If not NULL then called when fatal() is called.
uint8_t create_home_portals
If 1, can create portals in unique maps (apartments)
Spell-related defines: spellpath, subtypes, ...
uint8_t stat_loss_on_death
If true, chars lose a random stat when they die.
uint8_t max_stat
Maximum stat value - 255 should be sufficient.
uint32_t worldmaptilesx
Number of tiles wide the worldmap is.
Material structures and defines.
const char *const spell_mapping[SPELL_MAPPINGS]
This table is only necessary to convert objects that existed before the spell object conversion to th...
uint8_t spell_encumbrance
Encumbrance effects spells.
uint32_t worldmaptilesizey
Number of squares high in a wm tile.
uint8_t starting_stat_min
Minimum value of a starting stat.
unsigned int meta_on
True if we should send updates.
uint16_t meta_port
Port number to use for updates.
Defines for the ingame clock, ticks management and weather system.
uint8_t death_penalty_level
How many levels worth of exp may be lost on one death.
Defines various flags that both the new client and new server use.
Statistics statistics
Merged spell statistics.
uint64_t spell_merges
Number of spell merges done.
void * language_t
Strings that should be manipulated through add_string() and free_string().
uint8_t spellpoint_level_depend
Spell costs go up with level.
uint16_t csport
Port for new client/server.
New face structure - this enforces the notion that data is face by face only - you can not change the...
const char * playerdir
Where the player files are.
const char * motd
Name of the motd file.
int16_t max_level
This is read out of exp_table.
uint32_t worldmapstarty
Starting y tile for the worldmap.
Socket structure, represents a client-server connection.
const char * regions
Name of the regions file - libdir is prepended.
int allow_broken_converters
If set, converters will work even if price of generated item is higher than the price of converted it...
int armor_max_enchant
Maximum number of times an armor can be enchanted.
This file contains various #defines that select various options.
uint8_t starting_stat_max
Maximum value of a starting stat.
LogLevel debug
Default debugging level.
Settings settings
Global settings.
uint8_t death_penalty_ratio
Hhow much exp should be lost at death.
EXTERN char first_map_ext_path[MAX_BUF]
Path used for per-race start maps.
uint32_t worldmaptilesy
Number of tiles high the worldmap is.
const char * logfilename
Logfile to use.
uint8_t casting_time
It takes awhile to cast a spell.
uint64_t spell_hash_full
Number of times spell hash was full.
uint8_t recycle_tmp_maps
Re-use tmp maps.
uint16_t emergency_y
Coordinates to use on that map.
Player-specific structures.
socket_struct * init_sockets
Established connections for clients not yet playing.
const char * news
Name of news file.
EXTERN archetype * empty_archetype
Nice to have fast access to it.
char * log_timestamp_format
Format for timestap, if log_timestamp is set.
int armor_speed_improvement
Speed improvement.
const char * dumparg
Additional argument for some dump functions.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
EXTERN const char * undead_name
Used in hit_player() in main.c.
uint8_t search_items
Search_items command.
Defines and variables used by the artifact generation routines.
uint8_t min_name
Minimum characters for an account or player name.
This is used for various performance tracking statistics, or just how often certain events are done...
const char * tmpdir
Directory to use for temporary files.
int64_t pk_max_experience
Maximum experience one can get for PKing.
uint8_t always_show_hp
'probe' spell HP bars for all living things (0, 1, or 2)
const Face * blank_face
Following can just as easily be pointers, but it is easier to keep them like this.
struct linked_char * next
Party-specific structures.
uint8_t armor_weight_linear
If 1, weight reduction is linear, else exponantiel.
uint8_t balanced_stat_loss
If true, Death stat depletion based on level etc.
Base class to be informed of where an asset is defined.
Characters associated with an account.n.
uint8_t armor_speed_linear
If 1, speed improvement is linear, else exponantiel.
Attack-related definitions.
int maxfree[SIZEOFFREE]
Number of spots around a location, including that location (except for 0)
This represents all archetypes for one particular object type.
EXTERN sstring blocks_prayer
For update_position() mostly.
Defines various structures and values that are used for the new client server communication method...
EXTERN long nroferrors
If it exceeds MAX_ERRORS, call fatal()
uint8_t real_wiz
Use mud-like wizards.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
Defines and structures related to commands the player can send.
uint8_t ignore_plugin_compatibility
If set, don't check plugin version.
const char * templatedir
Directory for the template map.
uint8_t simple_exp
If true, use the simple experience system.
Alchemy recipe structures.
EXTERN artifactlist * first_artifactlist
First artifact.
#define MAX_BUF
Used for all kinds of things.
Compatibility implementations of useful nonstandard types and functions.
LogLevel
Log levels for the LOG() function.
logHook log_callback
Log hook, to intercept log messages.
Skill-related defines, including subtypes.
uint32_t tick_duration
Gloabal variables:
const char * confdir
Configuration files.
Implements a general string buffer: it builds a string by concatenating.
uint8_t account_block_create
class AssetsTracker * assets_tracker
If not NULL, called each time an asset is defined.
const char * uniquedir
Directory for the unique items.
EXTERN long nrofartifacts
Only used in malloc_info().
uint8_t permanent_exp_ratio
How much exp should be 'permenant' and unable to be lost.
int log_timestamp
If set, log will comport a timestamp.
EXTERN std::vector< region * > all_regions
All regions.
const char * datadir
Read only data files.
EXTERN long nrofallowedstr
Only used in malloc_info().
uint8_t special_break_map
If set, then submaps in random maps can break the walls.
int freedir[SIZEOFFREE]
Direction we're pointing on this spot.
Object structure, the core of Crossfire.
uint16_t set_friendly_fire
Percent of damage done by peaceful player vs player damage.
int armor_weight_reduction
Weight reduction per enchantment.
#define EXTERN
Define external variables.
const char * localdir
Read/write data files.
uint8_t starting_stat_points
How many stat points character starts with.
uint8_t no_player_stealing
If 1, can not steal from other players.
const char * mapdir
Where the map files are.
EXTERN int exiting
True if the game is about to exit.
EXTERN long trying_emergency_save
True when emergency_save() is reached.
uint64_t spell_suppressions
Number of times ok_to_put_more() returned FALSE.
This file contains basic map-related structures and macros.
EXTERN char first_map_path[MAX_BUF]
The start-level.
uint32_t pticks
Used by various function to determine how often to save the character.
uint8_t fastclock
If true, clock goes warp 9.
uint8_t crypt_mode
0 for legacy behavior, 1 for always Traditional
uint8_t dumpvalues
Set to dump various values/tables.
EXTERN player * first_player
First player.
std::function< void(LogLevel, const char *, va_list)> logHook
int reset_loc_time
Number of seconds to put player back at home.
uint8_t set_title
Players can set thier title.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
uint32_t worldmapstartx
Starting x tile for the worldmap.
Structure containing object statistics.
std::function< void(enum fatal_error err)> fatalHook
int allow_denied_spells_writing
If set, players can write spells they can't cast.
char * emergency_mapname
Map to return players to in emergency.
uint8_t roll_stat_points
How many stat points legacy (rolled) chars start with.
uint32_t worldmaptilesizex
Number of squares wide in a wm tile.
int pk_max_experience_percent
Percentage of experience of victim the killer gets.
Object type functions and variables.
uint8_t spell_failure_effects
Nasty backlash to spell failures.
Describes fundental parameters of 'books' - objects with type==BOOK.
EXTERN mapstruct * first_map
First map.
Artifact-related structures.
float item_power_factor
See note in setings file.
uint8_t resurrection
Ressurection possible w/ permadeth on.
int16_t pk_luck_penalty
Amount by which player luck is reduced if they PK.
uint8_t personalized_blessings
If 1, blessed weapons get an owner and a willpower value.
Core defines: object types, flags, etc.
char * account_trusted_host
Block account creation for untrusted hosts.