Crossfire Server, Branch 1.12
R12190
|
Go to the source code of this file.
Data Structures | |
struct | string_array |
Defines | |
#define | LO_NEWFILE 2 |
#define | MAX_SIZE 64 |
#define | NA "n/a" |
Typedefs | |
typedef struct string_array | String_Array |
Functions | |
int | auto_apply (object *op) |
Map was just loaded, handle op's initialisation. | |
static char * | cat_template (char *source, char *add) |
Concatenates a string, and free concatenated string. | |
void | clean_tmp_files (void) |
Remove temporary map files. | |
static char * | do_template (const char *template, const char **vars, const char **values) |
Processes a template. | |
void | dragon_ability_gain (object *ob, int x, int y) |
When a dragon-player gains a new stage of evolution, he gets some treasure. | |
void | draw_ext_info (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *txt, const char *txt2) |
Those are dummy functions defined to resolve all symboles. | |
void | draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...) |
Sends message to player(s). | |
void | emergency_save (int x) |
Save all players. | |
void | esrv_del_item (player *pl, int tag) |
Tells the client to delete an item. | |
void | esrv_send_item (object *ob, object *obx) |
Sends item's info to player. | |
void | esrv_update_spells (player *pl) |
This looks for any spells the player may have that have changed their stats. | |
int | execute_event (object *op, int eventcode, object *activator, object *third, const char *message, int fix) |
int | execute_global_event (int eventcode,...) |
void | ext_info_map (int color, const mapstruct *map, uint8 type, uint8 subtype, const char *str1, const char *str2) |
Writes to everyone on the specified map. | |
object * | find_skill_by_number (object *who, int skillno) |
This returns the skill pointer of the given name (the one that accumlates exp, has the level, etc). | |
void | fix_auto_apply (mapstruct *m) |
Go through the entire map (only the first time when an original map is loaded) and performs special actions for certain objects (most initialization of chests and creation of treasures and stuff). | |
void | free_data (String_Array *array) |
Frees the item's data of specified String_Array. | |
static void | free_if_used (char *p) |
Frees memory if the pointer was ever given a string. | |
const char * | join_with_comma (String_Array *array) |
Joins strings with a comma and space. | |
int | main (int argc, char *argv[]) |
void | monster_check_apply (object *ob, object *obt) |
void | move_firewall (object *ob) |
Move for FIREWALL. | |
void | push (String_Array *array, const char *string) |
Add a string to a String_Array struct. | |
static int | read_template (const char *name, char **buffer) |
Reads a file in memory. | |
void | set_darkness_map (mapstruct *m) |
Set the darkness level for a map, based on the time of the day. | |
void | set_map_timeout (void) |
static int | sort_archetypes (const void *a, const void *b) |
Sort archetypes alphabetically. | |
static int | sortbyname (const void *a, const void *b) |
Sort values alphabetically. | |
void | trap_adjust (object *ob, int x) |
Adjust trap difficulty to the map. | |
Variables | |
const char *const | flag_names [NUM_FLAGS+1] |
This is a list of pointers that correspond to the FLAG_. | |
char * | monster_attack_row |
char * | monster_canuse_row |
char * | monster_entry |
char * | monster_lore_row |
char * | monster_page_foot |
char * | monster_page_head |
char * | monster_protected_row |
char * | monster_special_row |
char * | monster_vulnerable_row |
#define LO_NEWFILE 2 |
typedef struct string_array String_Array |
int auto_apply | ( | object * | op | ) |
Map was just loaded, handle op's initialisation.
Generates shop floor's item, and treasures.
op | object to initialize. |
Definition at line 701 of file bwp.c.
References CLEAR_FLAG, create_treasure(), FLAG_AUTO_APPLY, FLAG_CURSED, FLAG_DAMNED, FLAG_UNPAID, free_object(), generate_treasure(), GT_ENVIRONMENT, HAS_RANDOM_ITEMS, identify(), insert_ob_in_map(), QUERY_FLAG, remove_ob(), SET_FLAG, SHOP_FLOOR, and TREASURE.
static char* cat_template | ( | char * | source, |
char * | add | ||
) | [static] |
void clean_tmp_files | ( | void | ) |
static char* do_template | ( | const char * | template, |
const char ** | vars, | ||
const char ** | values | ||
) | [static] |
Processes a template.
Variables in the form #VARIABLE#
will be substituted for specified values.
template | template to process. |
vars | variables to replace. Array must be NULL-terminated. |
values | variables to replace by. Must be the same size as vars, no NULL element allowed. |
Definition at line 185 of file bwp.c.
Referenced by main().
void dragon_ability_gain | ( | object * | ob, |
int | x, | ||
int | y | ||
) |
void draw_ext_info | ( | int | flags, |
int | pri, | ||
const object * | pl, | ||
uint8 | type, | ||
uint8 | subtype, | ||
const char * | txt, | ||
const char * | txt2 | ||
) |
void draw_ext_info_format | ( | int | flags, |
int | pri, | ||
const object * | pl, | ||
uint8 | type, | ||
uint8 | subtype, | ||
const char * | new_format, | ||
const char * | old_format, | ||
... | |||
) |
Sends message to player(s).
This function is the same as draw_ext_info, but takes varargs format. Otherwise, the meaning of all the fields is the same. This is perhaps not the most efficient as we do vsnprintf on both the old and newbuf, but it simplifies the code greatly since we can just call draw_ext_info. Also, hopefully at some point, need for old_format will go away.
flags | Various flags - mostly color, plus a few specials. |
pri | Priority. It is a little odd - the lower the value, the more important it is. Thus, 0 gets sent no matter what. Otherwise, the value must be less than the listening level that the player has set. Unfortunately, there is no clear guideline on what each level does what. |
pl | Can be passed as NULL - in fact, this will be done if NDI_ALL is set in the flags. |
If message is black, and not NDI_UNIQUE, gets sent through output buffers. If the client supports the new readables, this is sent to the client without processing in the output buffers.
type | The type MSG_TYPE for the type of message. |
subtype | The type MSG_TYPE for the type of message. |
new_format | |
old_format |
Definition at line 794 of file bwp.c.
References logfile.
void emergency_save | ( | int | x | ) |
void esrv_del_item | ( | player * | pl, |
int | tag | ||
) |
void esrv_send_item | ( | object * | ob, |
object * | obx | ||
) |
void esrv_update_spells | ( | player * | pl | ) |
int execute_event | ( | object * | op, |
int | eventcode, | ||
object * | activator, | ||
object * | third, | ||
const char * | message, | ||
int | fix | ||
) |
int execute_global_event | ( | int | eventcode, |
... | |||
) |
void ext_info_map | ( | int | color, |
const mapstruct * | map, | ||
uint8 | type, | ||
uint8 | subtype, | ||
const char * | str1, | ||
const char * | str2 | ||
) |
object* find_skill_by_number | ( | object * | who, |
int | skillno | ||
) |
This returns the skill pointer of the given name (the one that accumlates exp, has the level, etc).
It is presumed that the player will be needing to actually use the skill, so a skill tool will be equipped if one if found to benefit from its bonuses.
This code is basically the same as find_skill_by_name() above, but instead of a skill name, we search by matching number.
who | player applying a skill. |
skillno | skill subtype. |
void fix_auto_apply | ( | mapstruct * | m | ) |
Go through the entire map (only the first time when an original map is loaded) and performs special actions for certain objects (most initialization of chests and creation of treasures and stuff).
Calls auto_apply() if appropriate.
m | map to fix. |
Go through the entire map (only the first time when an original map is loaded) and performs special actions for certain objects (most initialization of chests and creation of treasures and stuff).
Added as part of glue cleaning. Ryo 2005-07-15
Definition at line 746 of file bwp.c.
References auto_apply(), check_trigger(), CONTAINER, create_treasure(), mapdef::difficulty, FLAG_AUTO_APPLY, GET_MAP_OB, GT_APPLY, HAS_RANDOM_ITEMS, MAP_HEIGHT, MAP_WIDTH, PLAYER, QUERY_FLAG, TREASURE, TRIGGER_BUTTON, and TRIGGER_PEDESTAL.
void free_data | ( | String_Array * | array | ) |
Frees the item's data of specified String_Array.
Will free array->item and its fields.
array | element we want to clean. |
Definition at line 325 of file bwp.c.
References string_array::count, and string_array::item.
Referenced by main().
static void free_if_used | ( | char * | p | ) | [static] |
Frees memory if the pointer was ever given a string.
There's probably a cleaner way to do this, but this frees the memory given to a pointer if the pointer points to a string longer than zero length. It's to get rid of "in free(): warning: junk pointer, too high to make sense" errors.
p | Pointer to free memory from |
const char* join_with_comma | ( | String_Array * | array | ) |
Joins strings with a comma and space.
Takes an array of strings and joins them togther with a comma and a space between each of them.
array | Pointer to struct of type String_Array, containing strings to join |
Definition at line 344 of file bwp.c.
References string_array::count, string_array::item, and sortbyname().
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 361 of file bwp.c.
References attacktype_desc, string_array::count, do_template(), first_archetype, FLAG_ALIVE, FLAG_MONSTER, flag_names, free_data(), init_archetypes(), init_artifacts(), init_formulae(), init_globals(), init_gods(), init_library(), init_readable(), string_array::item, join_with_comma(), llevError, llevInfo, LOG(), MAX_BUF, monster_attack_row, monster_canuse_row, monster_entry, monster_lore_row, monster_page_foot, monster_page_head, monster_protected_row, monster_special_row, monster_vulnerable_row, NA, NROFATTACKS, NUM_FLAGS, push(), QUERY_FLAG, read_template(), snprintf(), sort_archetypes(), and tolower.
void monster_check_apply | ( | object * | ob, |
object * | obt | ||
) |
void move_firewall | ( | object * | ob | ) |
void push | ( | String_Array * | array, |
const char * | string | ||
) |
Add a string to a String_Array struct.
Adds the new string to the struct's 'item' array, and updates the 'count'value.
array | The array to be appended |
string | The new string to append |
Definition at line 310 of file bwp.c.
References string_array::count, string_array::item, and strdup_local().
Referenced by check_trigger(), and main().
static int read_template | ( | const char * | name, |
char ** | buffer | ||
) | [static] |
void set_darkness_map | ( | mapstruct * | m | ) |
void set_map_timeout | ( | void | ) |
static int sort_archetypes | ( | const void * | a, |
const void * | b | ||
) | [static] |
Sort archetypes alphabetically.
Used by qsort to sort archetypes alphabetically without regard to case
a | First value |
b | Second value |
Definition at line 288 of file bwp.c.
References strcasecmp().
Referenced by main().
static int sortbyname | ( | const void * | a, |
const void * | b | ||
) | [static] |
Sort values alphabetically.
Used by qsort to sort values alphabetically without regard to case
a | First value |
b | Second value |
Definition at line 271 of file bwp.c.
References strcasecmp().
Referenced by join_with_comma().
void trap_adjust | ( | object * | ob, |
int | x | ||
) |
const char* const flag_names[NUM_FLAGS+1] |
This is a list of pointers that correspond to the FLAG_.
. values. This is a simple 1:1 mapping - if FLAG_FRIENDLY is 15, then the 15'th element of this array should match that name. If an entry is NULL, that is a flag not to loaded/saved.
Copied from common/loader.c; perhaps should be defined elsewhere?
Definition at line 69 of file bwp.c.
Referenced by main().
char* monster_attack_row |
char* monster_canuse_row |
char* monster_entry |
char* monster_lore_row |
char* monster_page_foot |
char* monster_page_head |
char* monster_protected_row |
char* monster_special_row |
char* monster_vulnerable_row |