Crossfire Server, Trunk
mapper.c File Reference
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include "global.h"
#include "sproto.h"
#include "image.h"
#include "quest.h"
#include <gd.h>
#include <gdfonts.h>
#include <gdfontl.h>
#include <gdfontg.h>
+ Include dependency graph for mapper.c:

Go to the source code of this file.

Data Structures

struct  struct_equipment
 
struct  struct_map_in_quest
 
struct  struct_map_in_quest_list
 
struct  struct_map_info
 
struct  struct_map_list
 
struct  struct_npc_info
 
struct  struct_npc_list
 
struct  struct_quest
 
struct  struct_race
 
struct  struct_race_list
 
struct  struct_region_info
 
struct  struct_slaying_info
 

Macros

#define S_CONNECT   4
 
#define S_CONTAINER   2
 
#define S_DETECTOR   3
 
#define S_DOOR   0
 
#define S_KEY   1
 
#define S_MAX   5
 
#define SIZE   50
 
#define size_large   sizes[0]
 
#define size_small   sizes[1]
 
#define VARSADD   6
 

Typedefs

typedef struct struct_equipment struct_equipment
 
typedef struct struct_map_in_quest struct_map_in_quest
 
typedef struct struct_map_info struct_map_info
 
typedef struct struct_npc_info struct_npc_info
 
typedef struct struct_npc_list struct_npc_list
 
typedef struct struct_quest struct_quest
 
typedef struct struct_race struct_race
 
typedef struct struct_race_list struct_race_list
 
typedef struct struct_region_info struct_region_info
 

Enumerations

enum  output_format_type { OF_PNG = 0, OF_JPG = 1 }
 

Functions

void account_char_free (Account_Char *chars)
 
Account_Characcount_char_load (const char *account_name)
 
void account_char_save (const char *account, Account_Char *chars)
 
static void add_map (struct_map_info *info, struct_map_list *list)
 
static void add_map_to_quest (struct_map_info *map, const char *name, const char *description)
 
static void add_map_to_region (struct_map_info *map, region *reg)
 
static void add_map_to_slaying (struct_slaying_info *info, int item, struct_map_info *map)
 
static void add_monster (object *monster, struct_map_info *map)
 
static void add_npc_to_map (struct_npc_list *list, const object *npc)
 
static void add_one_item (object *item, struct_map_info *map)
 
static void add_race_to_list (struct_race *race, struct_race_list *list, int check)
 
static void add_region_link (mapstruct *source, mapstruct *dest, const char *linkname)
 
static void add_slaying (struct_map_info *map, object *item)
 
static void add_to_struct_map_in_quest_list (struct_map_in_quest_list *list, struct_map_in_quest *item)
 
int apply_auto (object *op)
 
void apply_auto_fix (mapstruct *m)
 
static char * cat_template (char *source, char *add)
 
static void check_equipment (object *item, struct_map_info *map)
 
static void check_slaying_inventory (struct_map_info *map, object *item)
 
void clean_tmp_files (void)
 
void command_help (object *ob, const char *params)
 
static int compare_map_info (const struct_map_info *left, const struct_map_info *right)
 
static void create_destination (void)
 
static struct_map_infocreate_map_info (void)
 
static struct_npc_infocreate_npc_info (const object *npc)
 
static struct_map_infocreate_tiled_map (void)
 
static void define_quest (const char *name, struct_map_info *mainmap, const char *description)
 
void do_auto_apply (mapstruct *m)
 
static void do_exit_map (mapstruct *map)
 
static void do_help (const char *program)
 
static char * do_map_index (const char *dest, struct_map_list *maps_list, const char *template_page, const char *template_letter, const char *template_map, const char **vars, const char **values)
 
static void do_parameters (int argc, char **argv)
 
static void do_quest_item (const quest_definition *quest, FILE *file)
 
static char * do_template (const char *template, const char **vars, const char **values)
 
static void do_tiled_map_picture (struct_map_info *map)
 
void dragon_ability_gain (object *ob, int x, int y)
 
void draw_ext_info (int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *txt)
 
void draw_ext_info_format (int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
 
static void dump_unused_maps (void)
 
void emergency_save (int x)
 
static struct_equipmentensure_unique (struct_equipment *item)
 
void esrv_del_item (player *pl, object *ob)
 
void esrv_send_item (object *ob, object *obx)
 
void esrv_update_item (int flags, object *pl, object *op)
 
void esrv_update_spells (player *pl)
 
void ext_info_map (int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1)
 
static void find_maps (const char *from)
 
playerfind_player_partial_name (const char *name)
 
static struct_questfind_quest_info (const char *name)
 
object * find_skill_by_number (object *who, int skillno)
 
static void fix_exits_for_map (struct_map_info *current, struct_map_list *from, int is_from)
 
static void fix_exits_to_tiled_maps (void)
 
static void fix_map_names (void)
 
static void fix_tiled_map (void)
 
static void fix_tiled_map_monsters (void)
 
static void free_equipment (struct_equipment *equip)
 
static int get_elevation_color (int elevation, gdImagePtr elevationmap)
 
static struct_equipmentget_equipment (void)
 
static struct_map_infoget_map_info (const char *path)
 
static struct_questget_quest_info (const char *name)
 
static struct_raceget_race (const char *name)
 
static struct_slaying_infoget_slaying_struct (const char *slaying)
 
static void init_map_list (struct_map_list *list)
 
static void init_npc_list (struct_npc_list *list)
 
static void init_race_list (struct_race_list *list)
 
static void init_struct_map_in_quest_list (struct_map_in_quest_list *list)
 
static int is_blocking (object *item)
 
static int is_road (object *item)
 
static int is_slaying (object *item)
 
static int is_special_equipment (object *item)
 
static void list_map (const char *path)
 
int main (int argc, char **argv)
 
static void merge_tiled_maps (struct_map_info *map, int tile, struct_map_info *tiled_map)
 
void move_firewall (object *ob)
 
SockListplayer_get_delayed_buffer (player *pl)
 
static void process_map (struct_map_info *info)
 
static void process_map_lore (struct_map_info *map)
 
static void quest_callback (const quest_definition *quest, void *user)
 
static void read_template (const char *name, char **buffer)
 
static void relative_path (const char *from, const char *to, char *result)
 
void rod_adjust (object *rod)
 
static void save_picture (FILE *file, gdImagePtr pic)
 
void set_darkness_map (mapstruct *m)
 
static int sort_equipment (const void *a, const void *b)
 
static int sort_map_info (const void *left, const void *right)
 
static int sort_map_info_by_level (const void *left, const void *right)
 
static int sort_mapname (const void *left, const void *right)
 
static int sort_race (const void *a, const void *b)
 
static int sort_region (const void *left, const void *right)
 
static int sort_slaying (const void *left, const void *right)
 
static int sort_struct_map_in_quest (const void *left, const void *right)
 
static int sort_system_quest (const void *a, const void *b)
 
static int sort_system_quest_step (const void *a, const void *b)
 
static int sortbyname (const void *a, const void *b)
 
static int tiled_map_need_pic (struct_map_info *map)
 
static void write_all_maps (void)
 
static void write_all_regions (void)
 
static void write_equipment_index (void)
 
static void write_map_page (struct_map_info *map)
 
static void write_maps_by_level (void)
 
static void write_maps_index (void)
 
static void write_npc_list (void)
 
static void write_one_slaying_info (FILE *file, struct_slaying_info *info, int item, const char *with, const char *without)
 
static void write_quests_list (void)
 
static void write_quests_page (void)
 
static void write_race_index (void)
 
static void write_readable_list (void)
 
static void write_region_index (void)
 
static void write_region_page (struct_region_info *reg)
 
static void write_regions_link (void)
 
static void write_slaying_info (void)
 
static void write_slaying_map_name (FILE *file, struct_map_info *map)
 
static void write_tiled_map_page (struct_map_info *map)
 
static void write_tiled_maps (void)
 
static void write_world_info (void)
 
static void write_world_map (void)
 
static const char * yesno (int value)
 

Variables

static int cached_pics = 0
 
static int color_blocking
 
static int color_linked_exit
 
static int color_road
 
static int color_slowing
 
static int color_unlinked_exit
 
static int created_pics = 0
 
static bool detail_quests = false
 
static int do_regions_link = 0
 
static int ** elevation_info
 
static int elevation_max
 
static int elevation_min
 
static int equipment_allocated = 0
 
static int equipment_count = 0
 
static int force_pics = 0
 
static char ** found_maps = NULL
 
static int found_maps_allocated = 0
 
static int found_maps_count = 0
 
static gdImagePtr * gdfaces
 
static int generate_index = 1
 
static int generate_pics = 1
 
static const char * ignore_name []
 
static const char * ignore_path []
 
static char * index_letter
 
static char * index_map
 
static char * index_quest_template
 
static char * index_region_region_template
 
static char * index_region_template
 
static char * index_template
 
static gdImagePtr infomap
 
static int jpeg_quality = -1
 
static char * level_map_template
 
static char * level_template
 
static char * level_value_template
 
static bool list_system_quests = false
 
static int list_unused_maps = 0
 
static char * map_exit_template
 
static char * map_exit_to_template
 
static int map_limit = -1
 
static char * map_lore_template
 
static char * map_monster_after_template
 
static char * map_monster_before_template
 
static char * map_monster_between_template
 
static char * map_monster_one_template
 
static char * map_no_exit_template
 
static char * map_no_exit_to_template
 
static char * map_no_lore_template
 
static char * map_no_monster_template
 
static char * map_no_quest_template
 
static char * map_one_quest_template
 
static char * map_template
 
static char * map_with_exit_template
 
static char * map_with_exit_to_template
 
static char * map_with_quests_template
 
static struct_map_list maps_list
 
static const int num_sizes = sizeof(sizes)/sizeof(int)
 
static const char * output_extensions []
 
static enum output_format_type output_format = OF_PNG
 
static int pics_allocated
 
static char * quest_map_template
 
static char * quest_template
 
static struct_quest ** quests = NULL
 
static int quests_allocated = 0
 
static int quests_count = 0
 
static struct_race_list races
 
static int rawmaps = 0
 
static int region_allocated = 0
 
static int region_count = 0
 
static char * region_letter_template
 
static char * region_map_template
 
static char * region_template
 
static struct struct_region_info ** regions = NULL
 
static char ** regions_link
 
static int regions_link_allocated = 0
 
static int regions_link_count = 0
 
static char root [500]
 
static int show_maps = 0
 
static int sizes [] = {32, 16, 8, 4, 2}
 
static int slaying_allocated = 0
 
static int slaying_count = 0
 
static struct_slaying_info ** slaying_info = NULL
 
static struct_equipment ** special_equipment = NULL
 
static const quest_definitionsystem_quests [500]
 
static size_t system_quests_count = 0
 
static struct_map_list tiled_map_list
 
static int tileset = 0
 
static int warn_no_path = 0
 
static int world_exit_info = 1
 
static int world_map = 1
 
static char * world_map_template
 
static char * world_row_template
 
static char * world_template
 

Detailed Description

This program generates map browsing web pages.

Quick run: without arguments, will make sensible choices.

For help, try the -help option.

The following information is generated:

  • a page per map
  • a page per region
  • a global map index
  • the world map, including regions information
  • the world map, with exits and blocking zones
  • the world map, with elevation information.

Since this program browses maps from the first map, only maps linked from there will be processed.

Maps are generated as the server sees them, that is with weather effects, treasures instead of markers, and things like that.

For maps, 2 pictures are generated, one real size and one small-size.

Three maps are generated for the world: raw world map, world map with region information, region information only.

Maps are always sorted, by the map name (part after the last /).

Files are generated based on templates, where tags are replaced by their runtime value.

Templates are recursively included. Here is the list:

  • map.template: main map template.
    • map_no_exit.template: template to use when no exit on the map.
    • map_with_exit.template: template to use when there are exits on the map.
      • map_exit.template: template to use for each exit on the map.
    • map_lore: template to use to insert the map's lore.
    • map_no_lore: template when no lore for the map.
    • map_no_quest.template: when the map is linked to no quest.
    • map_with_quests.template: the map is linked to at least one quest.
      • map_one_quest.template: one quest link.
    • map_no_monster: used when no monster on map.
    • map_monster_before: applied before the monster list.
    • map_monster_one: one monster on the map.
    • map_monster_between: added after each monster except the last.
    • map_monster_after: added after the last monster in the list.
  • region.template: region page template.
    • region_letter: template for one letter
      • region_map.template: one map in a region
  • world.template: world map template
    • world_row.template: one row of world maps.
      • world_map.template: one map in the template.
  • index.template: global map index.
    • index_letter.template: one letter in the index
      • index_map.template: one map in the whole index
  • index_region.template: region index template.
    • index_region_region.template: one region in the index.
  • level.template: index of maps by level.
    • level_value.template: one level.
      • level_map.template: one map in the level.
  • quests.template: quest index.
    • quests_quest.template: one quest.
      • quests_map.template: one map in a quest.

Tags must be in the form #TAG#. To have a # in the code, please put ##. Valid tags are:

  • map:
    • NAME: map relative path
    • MAPPATH: full path to currently generated file.
    • MAPNAME: name of the map (part of the path after last /).
    • MAPPIC: name of full-size pic of the map.
    • MAPSMALLPIC: name of reduced-size pic of the map.
    • MAPEXIT: text generated by map_with_exit or map_no_exit.
    • INDEXPATH: path to index.html file.
    • REGIONPATH: path to region's file.
    • REGIONNAME: name of map's region.
    • REGIONINDEXPATH: path to region index file.
    • WORLDMAPPATH: path to world map file.
    • MAPLORE: map's lore.
    • MAPLEVEL: level as defined in the map.
    • MINMONSTER and MAXMONSTER: minimum and maximum level of monsters on the map.
  • map_no_exit:
    • tags for map, except MAPEXIT.
  • map_with_exit:
    • tags for map, except MAPEXIT.
    • EXIT: text generated by the map exits.
  • map_exit:
    • map's tags.
    • EXITNAME: name of exit (part of the path after /).
    • EXITPATH: relative path of exit's page.
  • map_lore:
    • tags for map, except MAPEXIT.
    • MAPLORE: map's lore.
  • map_no_lore:
    • tags for map, except MAPEXIT.
  • map_with_quests:
    • tags for map
    • QUESTS: result of map_one_quest processing.
      • map_one_quest:
        • NAME: map's name.
        • PATH: path to the quest page from the index.
        • TEXT: text associated to the map about the quest.
  • map_no_quest: not processed.
  • map_no_monster:
    • map's tags
  • map_monster_before:
    • map's tags
  • map_monster_one:
    • NAME: monster's name.
  • map_monster_between:
    • map's tags
  • map_monster_after:
    • map's tags
  • region:
    • MAPCOUNT: count of maps in region.
    • LETTERS: text generated by region_letter processing.
  • region_letter:
    • region's tags, except LETTERS.
    • MAPNAME: name of the map (part of the path after last /).
    • MAPPATH: relative path of the map from the map's root.
    • MAPHTML: relative path of HTML file for map.
  • region_map:
    • tags of region_letter.
    • MAPNAME: name of the map (part of the path after last /).
    • MAPPATH: relative path of the map from the map's root.
    • MAPHTML: relative path of HTML file for map.
  • world:
    • MAPS: text generated by world_row processing.
    • WORLDMAP: path to world map picture, with regions information.
    • WORLDRAW: path to raw world map, without regions information.
    • WORLDREGIONS: path to world map picture containing only regions information.
  • world_row:
    • MAPS: text generated by world_map processing.
  • world_map:
    • MAPNAME: name of the map (part of the path after last /).
    • MAPPATH: relative path of the map's generated page.
    • MAPLEFT, MAPTOP, MAPRIGHT, MAPBOTTOM: coordinates (in pixels) of current map in full world map.
  • index:
    • MAPCOUNT: count of maps.
    • LETTERS: text generated by index_letter processing.
  • index_letter:
    • tags of index, except LETTERS.
    • MAPS: text generated by index_letter processing.
    • LETTER: letter being processed, uppercase.
    • LETTERCOUNT: number of maps for current letter.
  • index_map:
    • tags of index_letter.
    • MAPNAME: name of the map (part of the path after last /).
    • MAPPATH: relative path of the map from the map's root.
    • MAPHTML: relative path of HTML file for map.
  • index_region:
    • REGIONCOUNT: total number of regions.
    • REGIONS: text generated by index_region_region processing.
  • index_region_region:
    • REGIONFILE: relative path to region page.
    • REGIONNAME: region name.
  • level:
    • COUNT: count of different levels.
    • LEVELS: result of the sub-level templates.
  • level_value:
    • LEVEL: current level.
    • MAPS: result of the level maps templates.
  • level_map:
    • MAPNAME: name of the map.
    • MAPPATH: relative path of the map from the index.
  • quests:
    • QUESTS: processing of quest.
  • quests_quest:
    • QUESTNAME: quest name.
    • QUESTTEXT: quest description.
    • QUESTMAPS: processing of quests_map.
    • QUESTID: unique quest identifier, anchor to index page.
    • MAINMAPPATH: path to the map defining the quest.
    • MAINMAPNAME: name of the map defining the quest.
  • quests_map:
    • MAPPATH: path to the map.
    • MAPNAME: map name.
    • MAPTEXT: description associated.

To build this program, add the '–enable-mapper' flag to 'configure' then run 'make' at the server root.

Todo:
  • split this file in multiple ones for easier maintenance
  • add missing documentation on variables / functions
  • add command line argument for large / small picture size
  • add maximum width/height for small picture
  • add slaying information to maps themselves
  • make the equipment page use templates
  • shop catalog
  • treasure list use

Definition in file mapper.c.

Macro Definition Documentation

◆ S_CONNECT

#define S_CONNECT   4

Definition at line 497 of file mapper.c.

◆ S_CONTAINER

#define S_CONTAINER   2

Definition at line 495 of file mapper.c.

◆ S_DETECTOR

#define S_DETECTOR   3

Definition at line 496 of file mapper.c.

◆ S_DOOR

#define S_DOOR   0

Connection/slaying information.

Definition at line 493 of file mapper.c.

◆ S_KEY

#define S_KEY   1

Definition at line 494 of file mapper.c.

◆ S_MAX

#define S_MAX   5

Definition at line 498 of file mapper.c.

◆ SIZE

#define SIZE   50

◆ size_large

#define size_large   sizes[0]

Definition at line 377 of file mapper.c.

◆ size_small

#define size_small   sizes[1]

Definition at line 378 of file mapper.c.

◆ VARSADD

#define VARSADD   6

Typedef Documentation

◆ struct_equipment

One special item (weapon, shield, ...).

◆ struct_map_in_quest

Link between a quest and a map.

◆ struct_map_info

Map information.

◆ struct_npc_info

Information about a NPC with a custom message.

◆ struct_npc_list

List of NPCs with a custom message.

◆ struct_quest

typedef struct struct_quest struct_quest

One quest.

◆ struct_race

typedef struct struct_race struct_race

One monster race in the maps.

◆ struct_race_list

Collection of races.

◆ struct_region_info

Region information.

Enumeration Type Documentation

◆ output_format_type

Map output formats.

Enumerator
OF_PNG 

PNG, default value.

OF_JPG 

JPG.

Definition at line 434 of file mapper.c.

Function Documentation

◆ account_char_free()

void account_char_free ( Account_Char chars)

This frees all data associated with the character information.

Parameters
charsData to free. The caller should make sure it no longer uses any data in this list.

Definition at line 4158 of file mapper.c.

Referenced by account_add_player_cmd(), free_newsocket(), key_confirm_quit(), and START_TEST().

+ Here is the caller graph for this function:

◆ account_char_load()

Account_Char* account_char_load ( const char *  account_name)

For a given account name, load the character information and return it. It is the responsibility of the caller to call account_char_free() on the returned value to free it.

Parameters
account_nameName of the account. The name should be validated before this routine is called (eg, passed checks for legitimate characters and logged in)
Returns
linked list of the character data.

Definition at line 4151 of file mapper.c.

Referenced by account_add_player_cmd(), send_account_players(), and START_TEST().

+ Here is the caller graph for this function:

◆ account_char_save()

void account_char_save ( const char *  account,
Account_Char chars 
)

Saves the character information for the given account.

Parameters
accountaccount name to save data for.
charspreviously loaded/generated list of character information for this account.

Definition at line 4155 of file mapper.c.

Referenced by account_add_player_cmd(), free_newsocket(), key_confirm_quit(), save_player(), and START_TEST().

+ Here is the caller graph for this function:

◆ add_map()

static void add_map ( struct_map_info info,
struct_map_list list 
)
static

Adds a map to specified array, if it isn't already.

Parameters
infomap to add.
listlist to add to.
Note
will allocate memory and update variables when required.

Definition at line 1547 of file mapper.c.

References guildoracle::list, and disinfect::map.

Referenced by add_map_to_region(), add_map_to_slaying(), add_monster(), add_one_item(), CREMapInformationManager::checkItem(), create_tiled_map(), do_parameters(), fix_exits_for_map(), fix_exits_to_tiled_maps(), fix_tiled_map_monsters(), get_map_info(), merge_tiled_maps(), and process_map().

+ Here is the caller graph for this function:

◆ add_map_to_quest()

static void add_map_to_quest ( struct_map_info map,
const char *  name,
const char *  description 
)
static

Links a map to a quest.

Parameters
mapmap to link.
namequest name.
descriptionassociated link description. Must not be NULL.

Definition at line 1275 of file mapper.c.

References add_to_struct_map_in_quest_list(), struct_map_in_quest::description, get_quest_info(), disinfect::map, struct_map_in_quest::map, give::name, and struct_map_in_quest::quest.

Referenced by process_map_lore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_map_to_region()

static void add_map_to_region ( struct_map_info map,
region reg 
)
static

Links a map to a region.

Will not readd the map if already linked.

Parameters
mapmap name.
regregion to link the map to.

Definition at line 1693 of file mapper.c.

References add_map(), struct_region_info::is_world, disinfect::map, maps_list, struct_region_info::reg, region_allocated, region_count, regions, struct_region_info::sum, struct_region_info::sum_x, struct_region_info::sum_y, diamondslots::x, and diamondslots::y.

Referenced by process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_map_to_slaying()

static void add_map_to_slaying ( struct_slaying_info info,
int  item,
struct_map_info map 
)
static

Adds the specified map to the slaying information if not already present.

Parameters
infostructure to add to.
itemone of the S_xxx values specifying what type of slaying this is.
mapmap to add.

Definition at line 1826 of file mapper.c.

References add_map(), disinfect::map, and struct_slaying_info::maps.

Referenced by add_slaying().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_monster()

static void add_monster ( object *  monster,
struct_map_info map 
)
static

Adds a monster to the monster list.

Parameters
monstermonster to add. Can be any part.
mapmap to add the monster to.

Definition at line 746 of file mapper.c.

References add_map(), add_race_to_list(), get_race(), disinfect::map, MAX, MIN, and struct_race::origin.

Referenced by process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_npc_to_map()

static void add_npc_to_map ( struct_npc_list list,
const object *  npc 
)
static

Add the specified NPC to the list.

Parameters
listwhere to add the NPC.
npcNPC to add. Must have a name and message.

Definition at line 1525 of file mapper.c.

References create_npc_info(), guildoracle::list, and npc_dialog::npc.

Referenced by process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_one_item()

static void add_one_item ( object *  item,
struct_map_info map 
)
static

◆ add_race_to_list()

static void add_race_to_list ( struct_race race,
struct_race_list list,
int  check 
)
static

Appends a race to a race list.

Parameters
racerace to add.
listlist to add to.
checkif 0, don't check if race is already on the list ; else don't make duplicated entries.

Definition at line 347 of file mapper.c.

References reputation_trigger_connect::check(), and guildoracle::list.

Referenced by add_monster(), fix_tiled_map_monsters(), and get_race().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_region_link()

static void add_region_link ( mapstruct source,
mapstruct dest,
const char *  linkname 
)
static

Creates a link between two maps if they are on different regions.

Parameters
sourcemap from.
destmap to.
linknamename of the link as it should appear. Unused.

Definition at line 1743 of file mapper.c.

References convert::dest, get_region_by_map(), regiondef::name, regions_link, regions_link_allocated, and regions_link_count.

Referenced by CREMapInformationManager::checkItem(), and process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_slaying()

static void add_slaying ( struct_map_info map,
object *  item 
)
static

Adds the item's information to the map.

Parameters
mapmap containing the item.
itemitem which slaying field we're considering.

Definition at line 1838 of file mapper.c.

References add_map_to_slaying(), get_slaying_struct(), disinfect::map, S_CONNECT, S_CONTAINER, S_DOOR, and S_KEY.

Referenced by check_slaying_inventory(), and process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_to_struct_map_in_quest_list()

static void add_to_struct_map_in_quest_list ( struct_map_in_quest_list list,
struct_map_in_quest item 
)
static

Definition at line 1216 of file mapper.c.

References say::item, and guildoracle::list.

Referenced by add_map_to_quest().

+ Here is the caller graph for this function:

◆ apply_auto()

int apply_auto ( object *  op)

Map was just loaded, handle op's initialization.

Generates shop floor's item, and treasures.

Parameters
opobject to initialize.
Returns
1 if object was initialized, 0 else.

Definition at line 4088 of file mapper.c.

References CLEAR_FLAG, create_treasure(), FLAG_AUTO_APPLY, FLAG_CURSED, FLAG_DAMNED, FLAG_IS_A_TEMPLATE, FLAG_UNPAID, FOR_INV_FINISH, FOR_INV_PREPARE, generate_treasure(), HAS_RANDOM_ITEMS, identify(), MAX, object_free_drop_inventory(), object_insert_in_map_at(), object_insert_in_ob(), object_remove(), give::op, QUERY_FLAG, SET_FLAG, and Ice::tmp.

Referenced by do_auto_apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ apply_auto_fix()

void apply_auto_fix ( 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 apply_auto() if appropriate.

Parameters
mmap to fix.

Those are dummy functions defined to resolve all symboles. Added as part of glue cleaning. Ryo 2005-07-15

Definition at line 4140 of file mapper.c.

Referenced by enter_unique_map(), generate_random_map(), mapfile_load(), and START_TEST().

+ Here is the caller graph for this function:

◆ cat_template()

static char* cat_template ( char *  source,
char *  add 
)
static

Concatenates a string, and free concatenated string.

Parameters
sourcestring to append to. Can be NULL.
addstring that is appened. Will be free()d after. Must not be NULL.
Returns
new string that should be free()d by caller.

Definition at line 914 of file mapper.c.

Referenced by do_map_index(), write_map_page(), write_maps_by_level(), write_quests_page(), write_region_index(), and write_world_map().

+ Here is the caller graph for this function:

◆ check_equipment()

static void check_equipment ( object *  item,
struct_map_info map 
)
static

Checks if item and its inventory are worthy to be listed.

Parameters
itemitem to check.
mapmap the item is on.

Definition at line 682 of file mapper.c.

References add_one_item(), FOR_INV_FINISH, FOR_INV_PREPARE, commongive::inv, is_special_equipment(), and disinfect::map.

Referenced by process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_slaying_inventory()

static void check_slaying_inventory ( struct_map_info map,
object *  item 
)
static

Recursively checks if the object should be considered for slaying information.

Parameters
mapmap containing the items.
itemitem to consider. Must not be NULL.

Definition at line 1864 of file mapper.c.

References add_slaying(), FOR_INV_FINISH, FOR_INV_PREPARE, commongive::inv, is_slaying(), and disinfect::map.

Referenced by process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clean_tmp_files()

void clean_tmp_files ( void  )

Save unique maps and clean up temporary map files unless recycling temporary maps. The function name is somewhat misleading.

Definition at line 4056 of file mapper.c.

Referenced by fatal(), and LOG().

+ Here is the caller graph for this function:

◆ command_help()

void command_help ( object *  ob,
const char *  params 
)

Player is asking for some help.

Parameters
opplayer asking for information.
paramswhat kind of help to ask for.

Definition at line 4161 of file mapper.c.

Referenced by command_knowledge(), command_party(), command_quest(), command_shutdown(), and commands_init().

+ Here is the caller graph for this function:

◆ compare_map_info()

static int compare_map_info ( const struct_map_info left,
const struct_map_info right 
)
static

Compares struct_map_info according to the map name or the path if equal.

Parameters
leftfirst item.
rightsecond item.
Returns
comparison on name, and if equal then on whole path.

Definition at line 1120 of file mapper.c.

References c, struct_map_info::name, struct_map_info::path, strcasecmp(), and struct_map_info::tiled_group.

Referenced by sort_map_info(), and sort_map_info_by_level().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_destination()

static void create_destination ( void  )
static

Ensures destination directory exists.

Definition at line 3735 of file mapper.c.

References make_path_to_file(), and root.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_map_info()

◆ create_npc_info()

static struct_npc_info* create_npc_info ( const object *  npc)
static

Create the struct_npc_info from the specified NPC. It must have a name and message.

Parameters
npcNPC to gather info for.
Returns
structure with info.

Definition at line 1507 of file mapper.c.

References struct_npc_info::message, struct_npc_info::name, npc_dialog::npc, struct_npc_info::x, and struct_npc_info::y.

Referenced by add_npc_to_map().

+ Here is the caller graph for this function:

◆ create_tiled_map()

static struct_map_info* create_tiled_map ( void  )
static

Create a new tiled map and link it to the tiled map list.

Returns
new tiled map.

Definition at line 1590 of file mapper.c.

References add_map(), create_map_info(), and tiled_map_list.

Referenced by process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ define_quest()

static void define_quest ( const char *  name,
struct_map_info mainmap,
const char *  description 
)
static

Sets the main map for a quest.

Parameters
namequest name.
mainmapmain map to associate.
descriptionquest description. Must not be NULL.

Definition at line 1327 of file mapper.c.

References get_quest_info(), give::name, and struct_map_info::path.

Referenced by process_map_lore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_auto_apply()

void do_auto_apply ( mapstruct m)

Definition at line 3936 of file mapper.c.

References apply_auto(), check_trigger(), create_treasure(), FLAG_AUTO_APPLY, FLAG_IS_LINKED, FOR_INV_FINISH, FOR_INV_PREPARE, FOR_MAP_FINISH, FOR_MAP_PREPARE, HAS_RANDOM_ITEMS, m, MAP_HEIGHT, MAP_WIDTH, object_update_speed(), QUERY_FLAG, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_exit_map()

static void do_exit_map ( mapstruct map)
static

Proceses exit / road / blocking information for specified map into the global infomap map.

If map isn't a world map, won't do anything.

Parameters
mapmap to write info for.

Definition at line 846 of file mapper.c.

References color_blocking, color_linked_exit, color_road, color_slowing, color_unlinked_exit, elevation_info, elevation_max, elevation_min, FOR_MAP_FINISH, FOR_MAP_PREPARE, infomap, is_blocking(), is_road(), disinfect::map, MAP_HEIGHT, MAP_WIDTH, MAX, MIN, object_get_value(), sstring, diamondslots::x, and diamondslots::y.

Referenced by process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_help()

static void do_help ( const char *  program)
static

Prints usage information, and exit.

Parameters
programprogram path.

Definition at line 3628 of file mapper.c.

Referenced by do_parameters().

+ Here is the caller graph for this function:

◆ do_map_index()

static char* do_map_index ( const char *  dest,
struct_map_list maps_list,
const char *  template_page,
const char *  template_letter,
const char *  template_map,
const char **  vars,
const char **  values 
)
static

Creates the page for a map index.

Parameters
destpath relative to root where the index will be located, without leading /. Used to compute the map's path relative to the index.
maps_listmaps in the index.
template_pageglobal page template.
template_lettertemplate for one letter of the index.
template_maptemplate for one map.
varstemplate variables to give access to.
valuesassociated values.
Returns
processed template. Should be free() by the caller.

Definition at line 2148 of file mapper.c.

References cat_template(), disinfect::count, struct_map_list::count, convert::dest, do_template(), generate_index, disinfect::map, struct_map_list::maps, maps_list, struct_map_info::name, struct_map_info::path, relative_path(), sort_map_info(), struct_map_info::tiled_group, Ice::tmp, tolower, and VARSADD.

Referenced by write_maps_index(), and write_region_page().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_parameters()

static void do_parameters ( int  argc,
char **  argv 
)
static

Handles command-line parameters.

Parameters
argcnumber of parameters, including program name.
argvarguments, including program name.

Definition at line 3663 of file mapper.c.

References add_map(), detail_quests, do_help(), do_regions_link, force_pics, generate_index, generate_pics, get_map_info(), jpeg_quality, list_system_quests, list_unused_maps, map_limit, maps_list, OF_JPG, output_format, python_event::path, rawmaps, root, show_maps, tileset, warn_no_path, world_exit_info, and world_map.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_quest_item()

static void do_quest_item ( const quest_definition quest,
FILE *  file 
)
static

◆ do_template()

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.

Parameters
templatetemplate to process.
varsvariables to replace. Array must be NULL-terminated.
valuesvariables to replace by. Must be the same size as vars, no NULL element allowed.
Returns
filled-in template, that must be free()d be caller. NULL if memory allocation error.
Note
returned string will be a memory block larger than required, for performance reasons.

Definition at line 985 of file mapper.c.

References disinfect::count.

Referenced by do_map_index(), write_map_page(), write_maps_by_level(), write_quests_page(), write_region_index(), and write_world_map().

+ Here is the caller graph for this function:

◆ do_tiled_map_picture()

static void do_tiled_map_picture ( struct_map_info map)
static

Generates the large and small pictures for a tiled map. This uses the large/small pictures made during process_map(), so having a map limit could lead to maps not found and invalid results.

Parameters
maptiled map to make the picture of.
Todo:
add a field to struct_map_info to remember if pic was updated or not, and update the tiled map only if one map has changed / the pic doesn't exist.

Definition at line 2917 of file mapper.c.

References disinfect::count, replace::current, generate_pics, disinfect::map, OF_PNG, make_face_from_files::out, output_extensions, output_format, root, save_picture(), size_large, size_small, and tiled_map_need_pic().

Referenced by write_tiled_map_page().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dragon_ability_gain()

void dragon_ability_gain ( object *  ob,
int  x,
int  y 
)

When a dragon-player gains a new stage of evolution, he gets some treasure.

Parameters
whothe dragon player.
atnrthe attack-number of the ability focus.
levelability level.

Definition at line 4062 of file mapper.c.

Referenced by dragon_level_gain().

+ Here is the caller graph for this function:

◆ draw_ext_info()

void draw_ext_info ( int  flags,
int  pri,
const object *  pl,
uint8_t  type,
uint8_t  subtype,
const char *  txt 
)

Dummy functions to link the library.

Definition at line 4034 of file mapper.c.

References logfile.

Referenced by adj_stealchance(), adjust_sign_msg(), alchemy_failure_effect(), animate_weapon(), apply_builder_floor(), apply_builder_item(), apply_builder_remove(), apply_builder_wall(), apply_builder_window(), apply_by_living(), apply_check_apply_restrictions(), apply_check_item_power(), apply_check_owner(), apply_manual(), apply_map_builder(), apply_sign(), apply_special(), armour_improver_type_apply(), attack_hth(), attack_melee_weapon(), attack_message(), attack_ob_simple(), attempt_do_alchemy(), attempt_jump(), attempt_recipe(), attempt_steal(), basic_emote(), blocked_link(), book_type_apply(), can_pay(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_change_map_lightlevel(), cast_cone(), cast_consecrate(), cast_create_food(), cast_create_obj(), cast_create_town_portal(), cast_curse(), cast_heal(), cast_identify(), cast_invisible(), cast_item_curse_or_curse(), cast_light(), cast_raise_dead_spell(), cast_smite_spell(), cast_spell(), cast_transfer(), cast_word_of_recall(), cf_handle_type_apply(), cfapi_player_message(), change_abil(), change_spell(), charge_mana_effect(), check_login(), check_name(), check_pick(), command_abil(), command_accountpasswd(), command_addexp(), command_afk(), command_arrest(), command_banish(), command_body(), command_bowmode(), command_brace(), command_create(), command_delete(), command_diff(), command_drop(), command_dropall(), command_dump(), command_empty(), command_face(), command_fire(), command_follow(), command_forget_spell(), command_free(), command_freeze(), command_goto(), command_gsay(), command_insert_into(), command_inventory(), command_invisible(), command_kill_pets(), command_language(), command_learn_spell_or_prayer(), command_list(), command_loadplugin(), command_loadtest(), command_lock_item(), command_mark(), command_mon_aggr(), command_nowiz(), command_overlay_reset(), command_overlay_save(), command_party(), command_passwd(), command_patch(), command_peaceful(), command_pickup(), command_possess(), command_purge_quest(), command_purge_quest_definitions(), command_quest(), command_quit(), command_remove(), command_rename_item(), command_reply(), command_reset(), command_resistances(), command_rskill(), command_run(), command_save(), command_search_items(), command_setgod(), command_settings(), command_showpets(), command_shutdown(), command_sound(), command_stack_clear(), command_stack_list(), command_statistics(), command_stats(), command_strings(), command_style_map_info(), command_summon(), command_take(), command_teleport(), command_tell_all(), command_title(), command_toggle_shout(), command_unloadplugin(), command_use(), command_uskill(), command_whereabouts(), command_wizcast(), command_wizpass(), confuse_living(), create_aura(), create_bomb(), cure_disease(), current_map_info(), cursed_food_effects(), dimension_door(), dispel_rune(), display_help_file(), display_motd(), display_new_pickup(), display_who_entry(), dm_stack_peek(), dm_stack_pop(), dm_stack_push(), do_dump(), do_hidden_move(), do_shutdown(), do_skill(), do_skill_attack(), do_skill_by_number(), do_tell(), do_throw(), do_turn(), do_wizard_dm(), do_wizard_hide(), dragon_ability_gain(), dragon_eat_flesh(), drain_specific_stat(), drop(), drop_object(), eat_common(), emergency_save(), enter_map(), examine(), examine_monster(), exit_type_apply(), exit_type_move_on(), find_or_create_connection_for_map(), find_traps(), fire(), fire_arch_from_position(), fire_bow(), fire_misc_object(), food_type_apply(), get_other_player_from_name(), god_enchants_weapon(), god_intervention(), god_removes_curse(), handle_newcs_player(), help_topics(), hide(), hiscore_check(), hiscore_display(), hole_type_move_on(), identify_altar_type_move_on(), improve_armour(), improve_weapon(), improve_weapon_magic(), improve_weapon_stat(), infect_object(), inscribe_scroll_cmd(), inventory(), jump(), key_change_class(), key_confirm_quit(), key_roll_stat(), kill_object(), kill_player(), kill_player_not_permadeath(), kill_player_permadeath(), knowledge_alchemy_attempt(), knowledge_display(), knowledge_do_attempt(), knowledge_do_display(), knowledge_item_can_be_used_alchemy(), knowledge_show(), knowledge_show_monster_detail(), knowledge_write_player_data(), lighter_type_apply(), list_players(), lock_item_cmd(), look_at(), look_at_cmd(), magic_wall(), map_info(), mark_item_cmd(), meditate(), mimic_type_apply(), monster_can_see_enemy(), monster_communicate(), move_marker(), move_player_attack(), move_symptom(), paralyze_living(), party_send_message(), perceive_self(), pets_follow_owner(), pets_move(), pets_move_golem(), pets_summon_golem(), pets_summon_object(), pick_lock(), pick_up(), pick_up_object(), player_attack_door(), player_lvl_adj(), plugins_display_list(), poison_living(), poison_type_apply(), poisoning_type_process(), potion_type_apply(), power_crystal_type_apply(), pray(), pray_at_altar(), prayer_failure(), prepare_weapon(), print_los(), probe(), put_object_in_sack(), quest_info(), quest_set_state(), quest_write_player_data(), receive_party_password(), receive_play_again(), receive_player_name(), receive_player_password(), recharge(), remove_curse(), remove_depletion(), remove_force(), restore_player(), ring_bell(), save_player(), scroll_failure(), scroll_type_apply(), send_rules(), set_pickup_mode(), shop_describe(), shop_inventory_type_apply(), shop_mat_type_move_on(), show_commands(), show_matching_spells(), show_skills(), skill_attack(), skill_ident(), slow_living(), spell_failure(), spellbook_type_apply(), spring_trap(), tailor_god_spell(), town_portal_destroy_existing(), town_portal_find_force(), trap_disarm(), trapdoor_type_move_on(), treasure_type_apply(), trigger_type_apply(), unapply_for_ob(), unhide(), use_alchemy(), use_oratory(), weapon_improver_type_apply(), write_mark(), write_note(), write_on_item(), write_rune(), write_scroll(), and wrong_password().

◆ draw_ext_info_format()

void draw_ext_info_format ( int  flags,
int  pri,
const object *  pl,
uint8_t  type,
uint8_t  subtype,
const char *  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.

Parameters
flagsVarious flags - mostly color, plus a few specials.
priPriority. 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.
plCan be passed as NULL - in fact, this will be done if NDI_ALL is set in the flags.
typeThe type MSG_TYPE for the type of message.
subtypeThe type MSG_TYPE for the subtype of message.
formatThe message to send, with optional format specifiers.

Definition at line 4038 of file mapper.c.

References logfile.

Referenced by action_makes_visible(), alchemy_failure_effect(), altar_type_move_on(), animate_weapon(), apply_builder_item(), apply_builder_remove(), apply_by_living(), apply_check_apply_restrictions(), apply_check_personalized_blessings(), apply_check_race_restrictions(), apply_container(), apply_savebed(), apply_special(), apply_update_ranged_skill(), attack_hth(), attack_message(), attack_ob_simple(), attempt_do_alchemy(), attempt_jump(), attempt_recipe(), attempt_steal(), basic_emote(), become_follower(), blind_living(), book_type_apply(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_consecrate(), cast_create_missile(), cast_curse(), cast_dust(), cast_identify(), cast_item_curse_or_curse(), cast_raise_dead_spell(), cast_smite_spell(), cast_spell(), change_abil(), change_spell(), check_login(), check_name(), check_pick(), check_sacrifice(), check_shutdown(), check_spell_expiry(), choose_cult_monster(), clock_type_apply(), command_abil(), command_addexp(), command_apply(), command_applymode(), command_arrest(), command_banish(), command_body(), command_bowmode(), command_cast_spell(), command_cointoss(), command_create(), command_debug(), command_drop(), command_examine(), command_execute(), command_face(), command_follow(), command_forget_spell(), command_freeze(), command_help(), command_insert_into(), command_kick2(), command_kill_pets(), command_language(), command_learn_spell_or_prayer(), command_listen(), command_loadplugin(), command_loadtest(), command_lock_item(), command_mark(), command_party(), command_party_rejoin(), command_patch(), command_petmode(), command_pickup(), command_players(), command_quest(), command_remove(), command_rename_item(), command_reply(), command_reset(), command_resistances(), command_rskill(), command_search_items(), command_setgod(), command_settings(), command_showpets(), command_shutdown(), command_speed(), command_stack_list(), command_statistics(), command_stats(), command_strings(), command_style_map_info(), command_summon(), command_take(), command_teleport(), command_tell_all(), command_toggle_shout(), command_unarmed_skill(), command_unloadplugin(), command_use(), command_usekeys(), command_version(), command_whereabouts(), command_wimpy(), converter_type_move_on(), create_player_cmd(), cure_disease(), current_map_info(), current_region_info(), deep_swamp_type_move_on(), deep_swamp_type_process(), display_new_pickup(), dm_stack_pop(), dm_stack_push(), do_follow(), do_forget_spell(), do_harvest(), do_learn_spell(), do_light(), do_skill_attack(), do_tell(), do_throw(), do_turn(), do_wizard_hide(), dragon_ability_gain(), dragon_eat_flesh(), dragon_level_gain(), drop_object(), empty_container(), enter_exit(), enter_fixed_template_map(), enter_player_maplevel(), enter_unique_map(), examine(), exit_type_apply(), find_best_player_hth_skill(), find_key(), find_throw_ob(), fire_bow(), fire_misc_object(), follower_remove_given_items(), food_type_apply(), gate_type_process(), get_dm_object(), get_spell_by_name(), god_enchants_weapon(), god_examines_item(), god_examines_priest(), god_gives_present(), god_intervention(), hiscore_check(), hiscore_display(), hit_with_one_attacktype(), i18n_list_languages(), identify_altar_type_move_on(), identify_object_with_skill(), improve_weapon(), improve_weapon_stat(), inventory(), key_change_class(), key_confirm_quit(), key_roll_stat(), kill_object(), kill_player_not_permadeath(), knowledge_alchemy_attempt(), knowledge_display(), knowledge_do_display(), knowledge_give(), lamp_type_apply(), leave(), lightable_type_apply(), lighter_type_apply(), list_players(), lock_item_cmd(), login_check_shutdown(), look_at(), magic_wall(), make_matcher(), malloc_info(), map_info(), mark_item_cmd(), monster_can_detect_enemy(), monster_communicate(), new_player_cmd(), party_form(), party_join(), party_leave(), peacemaker_type_process(), perceive_self(), pets_move_golem(), pets_summon_golem(), pets_summon_object(), pick_up(), player_attack_door(), plugins_display_list(), poison_living(), polymorph_melt(), potion_type_apply(), pray_at_altar(), prayer_failure(), print_tod(), process_object(), push_ob(), put_object_in_sack(), quest_display(), quest_info(), quest_list(), quest_set_state(), quest_start(), recharge(), recursive_roll(), remove_force(), remove_special_prayers(), resurrect_player(), sack_can_hold(), save_life(), save_player(), save_throw_object(), scroll_type_apply(), sell_item(), send_news(), shop_describe(), shop_inventory_type_apply(), shop_pay_unpaid(), show_matching_spells(), show_skills(), singing(), skill_ident(), skillscroll_type_apply(), spell_consume_items(), spellbook_type_apply(), swap_map(), swap_random_stats(), swap_stat(), time_info(), transmute_item_to_flower(), transport_type_apply(), trap_disarm(), trap_see(), treasure_type_apply(), unapply_for_ob(), unapply_special(), unhide(), use_alchemy(), use_oratory(), use_skill(), worship_forbids_use(), write_note(), write_on_item(), write_rune(), and write_scroll().

◆ dump_unused_maps()

static void dump_unused_maps ( void  )
static

Writes the list of unused maps, maps found in the directories but not linked from the other maps.

Definition at line 3283 of file mapper.c.

References dump(), guild_entry::found, found_maps, found_maps_count, npc_dialog::index, python_event::path, and root.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ emergency_save()

void emergency_save ( int  x)

Save all players.

Parameters
flagif non zero, it means that we want to try and save everyone, but keep the game running. Thus, we don't want to free any information.

Definition at line 4053 of file mapper.c.

Referenced by fatal(), and LOG().

+ Here is the caller graph for this function:

◆ ensure_unique()

static struct_equipment* ensure_unique ( struct_equipment item)
static

Searches the item list for an identical item, except maps.

Parameters
itemitem to search. The variable may be freed, so must not be used after calling this function.
Returns
item guaranteed to be unique in the item list.

Definition at line 569 of file mapper.c.

References struct_equipment::calc_power, reputation_trigger_connect::check(), struct_equipment::diff, equipment_allocated, equipment_count, free_equipment(), say::item, struct_equipment::name, struct_equipment::power, and special_equipment.

Referenced by add_one_item().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ esrv_del_item()

void esrv_del_item ( player pl,
object *  ob 
)

Tells the client to delete an item. Uses the item command with a -1 location.

Definition at line 4072 of file mapper.c.

Referenced by object_remove(), and transmute_item_to_flower().

+ Here is the caller graph for this function:

◆ esrv_send_item()

void esrv_send_item ( object *  ob,
object *  obx 
)

Sends item's info to player.

Definition at line 4059 of file mapper.c.

Referenced by apply_container(), cast_detection(), dragon_ability_gain(), object_insert_in_ob(), and transmute_item_to_flower().

+ Here is the caller graph for this function:

◆ esrv_update_item()

◆ esrv_update_spells()

void esrv_update_spells ( player pl)

This looks for any spells the player may have that have changed their stats. It then sends an updspell packet for each spell that has changed in this way.

Definition at line 4078 of file mapper.c.

Referenced by fix_player().

+ Here is the caller graph for this function:

◆ ext_info_map()

void ext_info_map ( int  color,
const mapstruct map,
uint8_t  type,
uint8_t  subtype,
const char *  str1 
)

Writes to everyone on the specified map

Parameters
colorThe color of the message
mapThe map where the players receiving the message are located
typeThe message type
subtypeThe message subtype
str1The message to be sent

Definition at line 4046 of file mapper.c.

References logfile.

Referenced by cfapi_map_message(), change_map_light(), command_me(), monster_do_say(), monster_do_talk_npc(), operate_altar(), and trigger_connected().

+ Here is the caller graph for this function:

◆ find_maps()

static void find_maps ( const char *  from)
static

Recursively find all all maps in a directory.

Parameters
frompath to search from, without trailing /.

Definition at line 3238 of file mapper.c.

References closedir(), Settings::datadir, dirent, mad_mage_user::file, found_maps, found_maps_allocated, found_maps_count, ignore_name, ignore_path, Settings::mapdir, opendir(), python_event::path, readdir(), settings, and takeitem::status.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_player_partial_name()

player* find_player_partial_name ( const char *  name)

Find a player by a partial name.

Parameters
plnamename to match.
Returns
matching player if only one matching, or one perfectly matching, NULL if no match or more than one.

Definition at line 4147 of file mapper.c.

Referenced by cfapi_player_find(), command_follow(), command_quest(), command_stats(), command_teleport(), do_follow(), and do_tell().

+ Here is the caller graph for this function:

◆ find_quest_info()

static struct_quest* find_quest_info ( const char *  name)
static

Gets the information for a quest if it exists.

Parameters
namequest's name.
Returns
quest information, NULL if no match.

Definition at line 1229 of file mapper.c.

References give::name, quests, and quests_count.

Referenced by do_quest_item(), and get_quest_info().

+ Here is the caller graph for this function:

◆ find_skill_by_number()

object* find_skill_by_number ( object *  who,
int  skillno 
)

This returns the first skill pointer of the given subtype (the one that accumulates 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 subtype.

Warning: skill subtypes are not unique to skills, various skills (eg harvesting-like) will share the same subtype, so this function should only be used if the skill's subtype is known to be used only by one skill.

Parameters
whoplayer applying a skill.
skillnoskill subtype.
Returns
skill object if player can use it, NULL else.

Definition at line 4068 of file mapper.c.

Referenced by compute_price_variation_with_bargaining(), cost_approx_str(), do_skill_by_number(), examine(), god_enchants_weapon(), monster_can_detect_enemy(), object_check_move_on(), price_approx(), and scroll_type_apply().

+ Here is the caller graph for this function:

◆ fix_exits_for_map()

static void fix_exits_for_map ( struct_map_info current,
struct_map_list from,
int  is_from 
)
static

Changes for the list all maps to the tiled map they are part of, if applicable.

Parameters
currentmap currently being processed.
fromlist that contains the exits to/from map to be fixed.
is_fromif non zero, from is exit_from field, else it is an exit_to.

Definition at line 2798 of file mapper.c.

References add_map(), struct_map_list::count, replace::current, struct_map_info::exits_from, struct_map_info::exits_to, disinfect::map, struct_map_list::maps, say::max, and struct_map_info::tiled_group.

Referenced by fix_exits_to_tiled_maps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fix_exits_to_tiled_maps()

static void fix_exits_to_tiled_maps ( void  )
static

Changes all exits to maps in a tiled map to point directly to the tiled map. Same for region lists.

Definition at line 2817 of file mapper.c.

References add_map(), struct_map_list::count, struct_map_info::exits_from, struct_map_info::exits_to, fix_exits_for_map(), disinfect::map, struct_map_list::maps, maps_list, struct_region_info::maps_list, say::max, region_count, regions, and struct_map_info::tiled_group.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fix_map_names()

static void fix_map_names ( void  )
static

Ensures all maps have a name (if there was a limit to map processing, some maps will have a NULL name which causes issues).

Definition at line 2709 of file mapper.c.

References struct_map_list::count, struct_map_info::filename, disinfect::map, struct_map_list::maps, maps_list, and struct_map_info::name.

Referenced by main().

+ Here is the caller graph for this function:

◆ fix_tiled_map()

static void fix_tiled_map ( void  )
static

Ensures all tiled maps have a name, a region, a filename and a path. Will try to find a suitable name and region from the maps in the group.

Todo:
use a better filename, try to get the start of the map filenames.

Definition at line 2729 of file mapper.c.

References struct_map_info::cfregion, struct_map_list::count, struct_map_info::filename, disinfect::map, struct_map_list::maps, give::name, struct_map_info::name, regiondef::name, struct_map_info::path, tiled_map_list, and struct_map_info::tiled_maps.

Referenced by main().

+ Here is the caller graph for this function:

◆ fix_tiled_map_monsters()

static void fix_tiled_map_monsters ( void  )
static

Makes all monsters point to tiled maps instead of map when appliable, and merge map monster to tiled map.

Definition at line 2845 of file mapper.c.

References add_map(), add_race_to_list(), struct_race_list::count, struct_map_list::count, disinfect::map, struct_map_list::maps, maps_list, say::max, struct_map_info::monsters, struct_race::origin, struct_race_list::races, races, and struct_map_info::tiled_group.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_equipment()

static void free_equipment ( struct_equipment equip)
static

Frees a struct_equipment.

Parameters
equipitem to free.

Definition at line 555 of file mapper.c.

References struct_equipment::diff, and struct_equipment::name.

Referenced by add_one_item(), and ensure_unique().

+ Here is the caller graph for this function:

◆ get_elevation_color()

static int get_elevation_color ( int  elevation,
gdImagePtr  elevationmap 
)
static

Gets the color for an elevation.

Parameters
elevationelevation to get color for.
elevationmappicture that will get the color.
Returns
color.

Definition at line 831 of file mapper.c.

References elevation_max, and elevation_min.

Referenced by write_world_info().

+ Here is the caller graph for this function:

◆ get_equipment()

static struct_equipment* get_equipment ( void  )
static

Gets an empty struct_equipment.

Returns
new item.

Definition at line 542 of file mapper.c.

References init_map_list(), and struct_equipment::origin.

Referenced by add_one_item().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_map_info()

static struct_map_info* get_map_info ( const char *  path)
static

Gets or creates if required the info structure for a map.

Parameters
pathmap to consider.
Returns
associated structure.

Definition at line 1642 of file mapper.c.

References add_map(), struct_map_list::count, create_map_info(), struct_map_info::filename, disinfect::map, struct_map_list::maps, maps_list, python_event::path, struct_map_info::path, and Ice::tmp.

Referenced by CREMapInformationManager::checkItem(), do_parameters(), main(), and process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_quest_info()

static struct_quest* get_quest_info ( const char *  name)
static

Gets the information for a quest, create the field if needed.

Parameters
namequest's name.
Returns
information, never NULL.

Definition at line 1246 of file mapper.c.

References find_quest_info(), init_struct_map_in_quest_list(), struct_quest::maps, give::name, struct_quest::name, struct_quest::number, quests, quests_allocated, and quests_count.

Referenced by add_map_to_quest(), and define_quest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_race()

static struct_race* get_race ( const char *  name)
static

Returns the race for specified name.

Parameters
namemonster's name.
Returns
race structure.

Definition at line 717 of file mapper.c.

References add_race_to_list(), struct_race_list::count, struct_race::count, init_map_list(), say::item, give::name, struct_race::name, struct_race_list::races, and races.

Referenced by add_monster().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_slaying_struct()

static struct_slaying_info* get_slaying_struct ( const char *  slaying)
static

Returns a struct_slaying_info for specified slaying. Creates a new one if required.

Parameters
slayingvalue to get the structure of.
Returns
structure for slaying. Never NULL.

Definition at line 1792 of file mapper.c.

References init_map_list(), banquet::l, struct_slaying_info::maps, S_MAX, struct_slaying_info::slaying, slaying_allocated, slaying_count, and slaying_info.

Referenced by add_slaying().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_map_list()

static void init_map_list ( struct_map_list list)
static

Initialises a list structure.

Parameters
listlist to blank.

Definition at line 515 of file mapper.c.

References guildoracle::list.

Referenced by create_map_info(), get_equipment(), get_race(), get_slaying_struct(), and main().

+ Here is the caller graph for this function:

◆ init_npc_list()

static void init_npc_list ( struct_npc_list list)
static

Initialise a list of NPCs.

Parameters
listlist to initialise.

Definition at line 1494 of file mapper.c.

References guildoracle::list.

Referenced by create_map_info().

+ Here is the caller graph for this function:

◆ init_race_list()

static void init_race_list ( struct_race_list list)
static

Blanks a struct_race_list.

Parameters
listlist to blank.

Definition at line 331 of file mapper.c.

References guildoracle::list.

Referenced by create_map_info(), and main().

+ Here is the caller graph for this function:

◆ init_struct_map_in_quest_list()

static void init_struct_map_in_quest_list ( struct_map_in_quest_list list)
static

Definition at line 1210 of file mapper.c.

References guildoracle::list.

Referenced by create_map_info(), and get_quest_info().

+ Here is the caller graph for this function:

◆ is_blocking()

static int is_blocking ( object *  item)
static

Checks if item blocks movement or not.

Parameters
item::object to test.
Returns
1 if item blocks all movement, 0 else.

Definition at line 817 of file mapper.c.

References MOVE_ALL.

Referenced by do_exit_map().

+ Here is the caller graph for this function:

◆ is_road()

static int is_road ( object *  item)
static

Checks if ::object is considered a road or not.

Parameters
item::object to check.
Returns
1 if object is a road, 0 else.

Definition at line 781 of file mapper.c.

References FLAG_IS_FLOOR, and QUERY_FLAG.

Referenced by do_exit_map().

+ Here is the caller graph for this function:

◆ is_slaying()

static int is_slaying ( object *  item)
static

Is the slaying field relevant for this item?

Parameters
itemitem to check.
Returns
1 if relevant, 0 else.

Definition at line 1779 of file mapper.c.

Referenced by check_slaying_inventory(), and process_map().

+ Here is the caller graph for this function:

◆ is_special_equipment()

static int is_special_equipment ( object *  item)
static

Definition at line 523 of file mapper.c.

References FLAG_NO_PICK, IS_ARMOR, IS_ARROW, IS_SHIELD, IS_WEAPON, MOVE_ALL, and QUERY_FLAG.

Referenced by check_equipment().

+ Here is the caller graph for this function:

◆ list_map()

static void list_map ( const char *  path)
static

Marks specified path as processed.

Parameters
pathmap to remove.

Definition at line 1670 of file mapper.c.

References found_maps, found_maps_count, npc_dialog::index, and python_event::path.

Referenced by process_map().

+ Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 3755 of file mapper.c.

References cached_pics, color_blocking, color_linked_exit, color_road, color_slowing, color_unlinked_exit, struct_map_list::count, create_destination(), created_pics, Settings::debug, detail_quests, do_parameters(), do_regions_link, dump_unused_maps(), elevation_info, elevation_max, elevation_min, regiondef::fallback, find_faceset(), find_maps(), first_map_path, first_region, fix_exits_to_tiled_maps(), fix_map_names(), fix_tiled_map(), fix_tiled_map_monsters(), force_pics, found_maps, found_maps_count, gdfaces, generate_index, generate_pics, get_faces_count(), get_map_info(), get_region_struct(), index_letter, index_map, index_quest_template, index_region_region_template, index_region_template, index_template, infomap, init_globals(), init_gods(), init_library(), init_map_list(), init_race_list(), init_readable(), init_regions(), is_valid_faceset(), jpeg_quality, level_map_template, level_template, level_value_template, list_system_quests, list_unused_maps, regiondef::longname, map_exit_template, map_exit_to_template, map_limit, map_lore_template, map_monster_after_template, map_monster_before_template, map_monster_between_template, map_monster_one_template, map_no_exit_template, map_no_exit_to_template, map_no_lore_template, map_no_monster_template, map_no_quest_template, map_one_quest_template, map_template, map_with_exit_template, map_with_exit_to_template, map_with_quests_template, struct_map_list::maps, maps_list, say::max, regiondef::name, regiondef::next, OF_JPG, output_extensions, output_format, pics_allocated, process_map(), quest_map_template, quest_template, races, rawmaps, read_template(), region_letter_template, region_map_template, region_template, root, settings, show_maps, sortbyname(), strdup_local, tiled_map_list, tileset, warn_no_path, world_exit_info, world_map, world_map_template, world_row_template, world_template, write_all_maps(), write_all_regions(), write_equipment_index(), write_maps_by_level(), write_maps_index(), write_npc_list(), write_quests_list(), write_quests_page(), write_race_index(), write_readable_list(), write_region_index(), write_regions_link(), write_slaying_info(), write_tiled_maps(), write_world_info(), write_world_map(), and yesno().

+ Here is the call graph for this function:

◆ merge_tiled_maps()

static void merge_tiled_maps ( struct_map_info map,
int  tile,
struct_map_info tiled_map 
)
static

Merge two tiled maps groups. This can happen if based on processing we do one map with tiled maps, another with tiled maps, and later figure out the tiles are actually linked.

Parameters
mapthe map that being processed has a tiling to a map in another group. Its group will be the final merging group.
tilethe tile index causing the merge
tiled_mapthe map tiled to another group. Its group will disappear.

Definition at line 1608 of file mapper.c.

References add_map(), struct_map_list::count, Ice::g, disinfect::map, struct_map_list::maps, struct_map_info::tiled_group, tiled_map_list, and struct_map_info::tiled_maps.

Referenced by process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move_firewall()

void move_firewall ( object *  ob)

Move for ::FIREWALL.

firewalls fire other spells. The direction of the wall is stored in op->direction. walls can have hp, so they can be torn down.

Parameters
opfirewall.

Definition at line 4050 of file mapper.c.

Referenced by legacy_ob_process(), and trigger_connected().

+ Here is the caller graph for this function:

◆ player_get_delayed_buffer()

SockList* player_get_delayed_buffer ( player pl)

Get a delayed socket buffer, that will be sent after the player's tick is complete. Will fatal() if memory error.

Parameters
plplayer to get a buffer for.
Returns
buffer, never NULL.

Definition at line 4143 of file mapper.c.

Referenced by draw_ext_info(), and quest_set_state().

+ Here is the caller graph for this function:

◆ process_map()

static void process_map ( struct_map_info info)
static

Processes a map.

Generates the map pictures (big and small), and exit information.

Parameters
infomap to process.

Definition at line 1880 of file mapper.c.

References add_map(), add_map_to_region(), add_monster(), add_npc_to_map(), add_region_link(), add_slaying(), archininventory::arch, spell_arrow::archetype, cached_pics, struct_map_info::cfregion, check_equipment(), check_slaying_inventory(), create_pathname(), create_tiled_map(), created_pics, face_info::data, face_info::datalen, delete_map(), do_auto_apply(), do_exit_map(), do_regions_link, EXIT_PATH, struct_map_info::exits_from, struct_map_info::exits_to, face_sets::faces, struct_map_info::filename, find_archetype(), find_faceset(), FLAG_FRIENDLY, FLAG_MONSTER, FLAG_UNAGGRESSIVE, FOR_MAP_FINISH, FOR_MAP_PREPARE, force_pics, gdfaces, generate_pics, get_face_fallback(), get_map_info(), get_region_by_map(), struct_map_info::height, mapdef::in_memory, is_slaying(), struct_map_info::level, list_map(), list_unused_maps, struct_map_info::lore, m, make_path_to_file(), MAP_HEIGHT, MAP_IN_MEMORY, MAP_WIDTH, MAX_BUF, merge_tiled_maps(), struct_map_info::name, struct_map_info::npcs, num_sizes, object_get_multi_size(), make_face_from_files::out, output_extensions, output_format, struct_map_info::path, path_combine_and_normalize(), struct_map_info::pic_was_done, pics_allocated, process_map_lore(), QUERY_FLAG, rawmaps, struct_map_info::readable, ready_map_name(), mapdef::reset_time, root, save_picture(), show_maps, size_large, sizes, struct_map_info::tiled_group, struct_map_info::tiled_maps, struct_map_info::tiles, tileset, warn_no_path, struct_map_info::width, diamondslots::x, and diamondslots::y.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ process_map_lore()

static void process_map_lore ( struct_map_info map)
static

Extracts from the map's lore quest information if found. May modify map->lore.

Parameters
mapmap to process.

Definition at line 1346 of file mapper.c.

References add_map_to_quest(), define_quest(), disinfect::map, give::name, and give::next.

Referenced by process_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quest_callback()

static void quest_callback ( const quest_definition quest,
void *  user 
)
static

Definition at line 3543 of file mapper.c.

References list_system_quests, system_quests, and system_quests_count.

Referenced by write_quests_list().

+ Here is the caller graph for this function:

◆ read_template()

static void read_template ( const char *  name,
char **  buffer 
)
static

Reads a file in memory.

Parameters
namefile path to read.
bufferwhere to store. Can be left uninitialized in case of errors.
Note
will exit() with code 1 if any error occurs or if the file doesn't exist.

Definition at line 933 of file mapper.c.

References mad_mage_user::file, and give::name.

Referenced by main().

+ Here is the caller graph for this function:

◆ relative_path()

static void relative_path ( const char *  from,
const char *  to,
char *  result 
)
static

Computes the shortest path from one file to another.

Parameters
fromorigin.
todestination.
resultstring that will contain the calculated path. Must be large enough, no test done.
Warning
from and to must be absolute paths (starting with /).

Definition at line 1053 of file mapper.c.

Referenced by do_map_index(), and write_map_page().

+ Here is the caller graph for this function:

◆ rod_adjust()

void rod_adjust ( object *  rod)

Adjusts rod attributes. This function must be called after a new rod has been created.

Parameters
rodthe rod to update

Definition at line 4081 of file mapper.c.

Referenced by fix_generated_item().

+ Here is the caller graph for this function:

◆ save_picture()

static void save_picture ( FILE *  file,
gdImagePtr  pic 
)
static

Saves a map to a file, based on jpg/png settings.

Parameters
fileopened file to which to save.
picpicture to save.

Definition at line 1727 of file mapper.c.

References mad_mage_user::file, jpeg_quality, OF_PNG, and output_format.

Referenced by do_tiled_map_picture(), process_map(), write_world_info(), and write_world_map().

+ Here is the caller graph for this function:

◆ set_darkness_map()

void set_darkness_map ( mapstruct m)

Set the darkness level for a map, based on the time of the day.

Parameters
mmap to alter.

Definition at line 4065 of file mapper.c.

Referenced by generate_random_map(), and ready_map_name().

+ Here is the caller graph for this function:

◆ sort_equipment()

static int sort_equipment ( const void *  a,
const void *  b 
)
static

Sort 2 struct_equipment, first on item power then name.

Parameters
a
bitems to compare.
Returns
-1, 0 or 1.

Definition at line 699 of file mapper.c.

References disinfect::a, Ice::b, c, banquet::l, ring_occidental_mages::r, and strcasecmp().

Referenced by write_equipment_index().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sort_map_info()

static int sort_map_info ( const void *  left,
const void *  right 
)
static

Sorts the struct_map_info according to the map name or the path if equal.

Parameters
leftfirst item.
rightsecond item.
Returns
comparison on name, and if equal then on whole path.

Definition at line 1145 of file mapper.c.

References compare_map_info(), banquet::l, and ring_occidental_mages::r.

Referenced by do_map_index(), write_map_page(), and write_race_index().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sort_map_info_by_level()

static int sort_map_info_by_level ( const void *  left,
const void *  right 
)
static

Sorts the struct_map_info according to the map's level, and if equal the name or the path.

Parameters
leftfirst item.
rightsecond item.
Returns
comparison on name, and if equal then on whole path.

Definition at line 1161 of file mapper.c.

References c, compare_map_info(), banquet::l, and ring_occidental_mages::r.

Referenced by write_maps_by_level().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sort_mapname()

static int sort_mapname ( const void *  left,
const void *  right 
)
static

Sorts the strings according to the last part of the filename (after the last /).

Parameters
leftfirst string.
rightsecond string.
Returns
comparison on last element, and if equal then on whole string.

Definition at line 1092 of file mapper.c.

References c, banquet::l, ring_occidental_mages::r, and strcasecmp().

Referenced by write_one_slaying_info().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sort_race()

static int sort_race ( const void *  a,
const void *  b 
)
static

Sort 2 struct_race.

Parameters
a
bitems to compare.
Returns
-1, 0 or 1.

Definition at line 768 of file mapper.c.

References disinfect::a, Ice::b, banquet::l, ring_occidental_mages::r, and strcasecmp().

Referenced by write_map_page(), and write_race_index().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sort_region()

static int sort_region ( const void *  left,
const void *  right 
)
static

Sorts an array of struct_region_info by region name.

Parameters
leftfirst region.
rightsecond region.
Returns
result of strcmp() for names.

Definition at line 1180 of file mapper.c.

Referenced by write_all_regions().

+ Here is the caller graph for this function:

◆ sort_slaying()

static int sort_slaying ( const void *  left,
const void *  right 
)
static

Helper function to sort an array of struct_slaying_info.

Parameters
leftfirst item.
rightsecond item.
Returns
sort order.

Definition at line 3424 of file mapper.c.

References banquet::l, ring_occidental_mages::r, and strcasecmp().

Referenced by write_npc_list(), and write_slaying_info().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sort_struct_map_in_quest()

static int sort_struct_map_in_quest ( const void *  left,
const void *  right 
)
static

Sorts 2 struct_map_in_quest, on the map's name or path.

Parameters
left
rightitems to compare.
Returns
-1, 0 or 1.

Definition at line 1297 of file mapper.c.

References c, banquet::l, struct_map_info::name, struct_map_info::path, ring_occidental_mages::r, strcasecmp(), and struct_map_info::tiled_group.

Referenced by write_quests_page().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sort_system_quest()

static int sort_system_quest ( const void *  a,
const void *  b 
)
static

Definition at line 3549 of file mapper.c.

References disinfect::a, and Ice::b.

Referenced by write_quests_list().

+ Here is the caller graph for this function:

◆ sort_system_quest_step()

static int sort_system_quest_step ( const void *  a,
const void *  b 
)
static

Definition at line 3553 of file mapper.c.

References disinfect::a, and Ice::b.

Referenced by do_quest_item().

+ Here is the caller graph for this function:

◆ sortbyname()

static int sortbyname ( const void *  a,
const void *  b 
)
static

Sort values alphabetically Used by qsort to sort values alphabetically.

Parameters
aFirst value
bSecond value
Returns
-1 if a is less than b, 0 if a equals b, 1 else.

Definition at line 900 of file mapper.c.

References disinfect::a, and Ice::b.

Referenced by main().

+ Here is the caller graph for this function:

◆ tiled_map_need_pic()

static int tiled_map_need_pic ( struct_map_info map)
static

Definition at line 2885 of file mapper.c.

References disinfect::map, output_extensions, output_format, and root.

Referenced by do_tiled_map_picture().

+ Here is the caller graph for this function:

◆ write_all_maps()

static void write_all_maps ( void  )
static

Ensures all maps have a name, and writes all map pages.

Definition at line 2873 of file mapper.c.

References struct_map_list::count, disinfect::map, struct_map_list::maps, maps_list, struct_map_info::tiled_group, and write_map_page().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_all_regions()

static void write_all_regions ( void  )
static

Generates all map indexes for a region.

Definition at line 2316 of file mapper.c.

References region_count, regions, sort_region(), and write_region_page().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_equipment_index()

static void write_equipment_index ( void  )
static

Writes the item page.

Definition at line 3148 of file mapper.c.

References struct_map_list::count, equipment_count, say::item, disinfect::map, give::name, struct_equipment::origin, make_face_from_files::out, root, sort_equipment(), and special_equipment.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_map_page()

◆ write_maps_by_level()

static void write_maps_by_level ( void  )
static

Outputs the list of maps sorted by level.

Definition at line 3070 of file mapper.c.

References cat_template(), struct_map_list::count, do_template(), struct_map_info::level, level_map_template, level_template, level_value_template, disinfect::map, maps, struct_map_list::maps, maps_list, give::name, make_face_from_files::out, doors_galore::process(), root, and sort_map_info_by_level().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_maps_index()

static void write_maps_index ( void  )
static

Generates global map index, file maps.html.

Definition at line 2328 of file mapper.c.

References do_map_index(), npc_dialog::index, index_letter, index_map, index_template, maps_list, root, and Ice::tmp.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_npc_list()

static void write_npc_list ( void  )
static

◆ write_one_slaying_info()

static void write_one_slaying_info ( FILE *  file,
struct_slaying_info info,
int  item,
const char *  with,
const char *  without 
)
static

Writes all maps of the specified slaying information.

Parameters
filefile to write to.
infoslaying information to write.
itemwhich of the S_xxx to write.
withtext to write when there are maps to write. Mustn't be NULL.
withouttext to write when there are no maps. Can be NULL.

Definition at line 3393 of file mapper.c.

References struct_map_list::count, mad_mage_user::file, say::item, disinfect::map, struct_map_list::maps, struct_slaying_info::maps, sort_mapname(), and write_slaying_map_name().

Referenced by write_slaying_info().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_quests_list()

static void write_quests_list ( void  )
static

Write the list of quests.

Definition at line 3595 of file mapper.c.

References do_quest_item(), mad_mage_user::file, list_system_quests, MAX_BUF, python_event::path, item::q, quest_callback(), quest_for_each(), root, sort_system_quest(), system_quests, and system_quests_count.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_quests_page()

◆ write_race_index()

static void write_race_index ( void  )
static

Writes the monster information page.

Definition at line 3181 of file mapper.c.

References struct_race_list::count, struct_map_list::count, struct_race::count, say::item, disinfect::map, struct_map_list::maps, give::name, struct_race::name, struct_race::origin, make_face_from_files::out, struct_map_info::path, struct_race_list::races, races, root, sort_map_info(), and sort_race().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_readable_list()

static void write_readable_list ( void  )
static

◆ write_region_index()

static void write_region_index ( void  )
static

Generates region index.

Definition at line 2350 of file mapper.c.

References cat_template(), disinfect::count, do_template(), mad_mage_user::file, get_region_longname(), index_region_region_template, index_region_template, regiondef::name, make_face_from_files::out, region_count, regions, and root.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_region_page()

static void write_region_page ( struct_region_info reg)
static

Generates the web page for a region.

Parameters
regregion/maps for which to generate.
Note
will sort the maps.

Definition at line 2283 of file mapper.c.

References do_map_index(), get_region_longname(), get_region_msg(), npc_dialog::index, struct_region_info::maps_list, regiondef::name, struct_region_info::reg, region_letter_template, region_map_template, region_template, and root.

Referenced by write_all_regions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_regions_link()

static void write_regions_link ( void  )
static

Write the .dot file representing links between regions.

Definition at line 3348 of file mapper.c.

References do_regions_link, mad_mage_user::file, MAX_BUF, python_event::path, regions_link, regions_link_count, and root.

Referenced by main().

+ Here is the caller graph for this function:

◆ write_slaying_info()

static void write_slaying_info ( void  )
static

Writes all slaying info to file.

Definition at line 3434 of file mapper.c.

References struct_map_list::count, mad_mage_user::file, struct_slaying_info::maps, MAX_BUF, python_event::path, root, S_CONNECT, S_CONTAINER, S_DOOR, S_KEY, struct_slaying_info::slaying, slaying_count, slaying_info, sort_slaying(), and write_one_slaying_info().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_slaying_map_name()

static void write_slaying_map_name ( FILE *  file,
struct_map_info map 
)
static

Helper function to write a map to a file with its link and full path.

Parameters
filewhere to write.
mapmap info to write.

Definition at line 3375 of file mapper.c.

References mad_mage_user::file, and disinfect::map.

Referenced by write_one_slaying_info().

+ Here is the caller graph for this function:

◆ write_tiled_map_page()

static void write_tiled_map_page ( struct_map_info map)
static

Writes the page for a tiled map group.

Todo:
: do a real page, with the various levels, maps and such.

Definition at line 3048 of file mapper.c.

References do_tiled_map_picture(), disinfect::map, and write_map_page().

Referenced by write_tiled_maps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_tiled_maps()

static void write_tiled_maps ( void  )
static

Outputs all tiled map pages.

Definition at line 3058 of file mapper.c.

References struct_map_list::count, disinfect::map, struct_map_list::maps, tiled_map_list, and write_tiled_map_page().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_world_info()

static void write_world_info ( void  )
static

Writes the exit information world map.

Definition at line 3306 of file mapper.c.

References elevation_info, elevation_max, elevation_min, mad_mage_user::file, get_elevation_color(), infomap, MAX_BUF, output_extensions, output_format, python_event::path, root, save_picture(), world_exit_info, diamondslots::x, and diamondslots::y.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_world_map()

static void write_world_map ( void  )
static

◆ yesno()

static const char* yesno ( int  value)
static

Helper to write yes/no.

Parameters
valuevalue to print.
Returns
"no" if value == 0, "yes" else.

Definition at line 3751 of file mapper.c.

References autojail::value.

Referenced by main().

+ Here is the caller graph for this function:

Variable Documentation

◆ cached_pics

int cached_pics = 0
static

Non recreated pics.

Definition at line 431 of file mapper.c.

Referenced by main(), and process_map().

◆ color_blocking

int color_blocking
static

Block all movement.

Definition at line 479 of file mapper.c.

Referenced by do_exit_map(), and main().

◆ color_linked_exit

int color_linked_exit
static

Exit leading to another map.

Definition at line 477 of file mapper.c.

Referenced by do_exit_map(), and main().

◆ color_road

int color_road
static

Road or equivalent.

Definition at line 478 of file mapper.c.

Referenced by do_exit_map(), and main().

◆ color_slowing

int color_slowing
static

Slows movement.

Definition at line 480 of file mapper.c.

Referenced by do_exit_map(), and main().

◆ color_unlinked_exit

int color_unlinked_exit
static

Color for exits without a path set.

Definition at line 476 of file mapper.c.

Referenced by do_exit_map(), and main().

◆ created_pics

int created_pics = 0
static

Picture statistics. Total created pics.

Definition at line 430 of file mapper.c.

Referenced by main(), and process_map().

◆ detail_quests

bool detail_quests = false
static

Whether to show all quests details or not.

Definition at line 384 of file mapper.c.

Referenced by do_parameters(), do_quest_item(), and main().

◆ do_regions_link

int do_regions_link = 0
static

◆ elevation_info

int** elevation_info
static

All elevation spots in the "world_" maps.

Definition at line 482 of file mapper.c.

Referenced by do_exit_map(), main(), and write_world_info().

◆ elevation_max

int elevation_max
static

Lowest elevation found.

Definition at line 484 of file mapper.c.

Referenced by do_exit_map(), get_elevation_color(), main(), and write_world_info().

◆ elevation_min

int elevation_min
static

Maximal elevation found.

Definition at line 483 of file mapper.c.

Referenced by do_exit_map(), get_elevation_color(), main(), and write_world_info().

◆ equipment_allocated

int equipment_allocated = 0
static

Allocated items in special_equipment.

Definition at line 314 of file mapper.c.

Referenced by ensure_unique().

◆ equipment_count

int equipment_count = 0
static

Number of items in special_equipment.

Definition at line 312 of file mapper.c.

Referenced by ensure_unique(), and write_equipment_index().

◆ force_pics

int force_pics = 0
static

To force picture regeneration even if map didn't change.

Definition at line 373 of file mapper.c.

Referenced by do_parameters(), main(), and process_map().

◆ found_maps

char** found_maps = NULL
static

Maps found in directories.

Definition at line 470 of file mapper.c.

Referenced by dump_unused_maps(), find_maps(), list_map(), and main().

◆ found_maps_allocated

int found_maps_allocated = 0
static

Allocated size of found_maps.

Definition at line 472 of file mapper.c.

Referenced by find_maps().

◆ found_maps_count

int found_maps_count = 0
static

Number of items in found_maps.

Definition at line 471 of file mapper.c.

Referenced by dump_unused_maps(), find_maps(), list_map(), and main().

◆ gdfaces

gdImagePtr* gdfaces
static

Definition at line 233 of file mapper.c.

Referenced by main(), and process_map().

◆ generate_index

int generate_index = 1
static

Whether to do the map index or not.

Definition at line 374 of file mapper.c.

Referenced by do_map_index(), do_parameters(), and main().

◆ generate_pics

int generate_pics = 1
static

Whether to generate the picture or not.

Definition at line 372 of file mapper.c.

Referenced by do_parameters(), do_tiled_map_picture(), main(), and process_map().

◆ ignore_name

const char* ignore_name[]
static
Initial value:
= {
".",
"..",
".svn",
"README",
NULL }

File names to ignore for map search.

Definition at line 3225 of file mapper.c.

Referenced by find_maps().

◆ ignore_path

const char* ignore_path[]
static
Initial value:
= {
"/Info",
"/editor",
"/python",
"/styles",
"/templates",
"/test",
"/unlinked",
NULL }

Directories to ignore for map search.

Definition at line 3214 of file mapper.c.

Referenced by find_maps().

◆ index_letter

char* index_letter
static

Index page template: one letter, including the maps it contains.

Definition at line 407 of file mapper.c.

Referenced by main(), and write_maps_index().

◆ index_map

char* index_map
static

Index page template: one map.

Definition at line 408 of file mapper.c.

Referenced by main(), and write_maps_index().

◆ index_quest_template

char* index_quest_template
static

Definition at line 421 of file mapper.c.

Referenced by main(), and write_quests_page().

◆ index_region_region_template

char* index_region_region_template
static

One region in the region index template.

Definition at line 415 of file mapper.c.

Referenced by main(), and write_region_index().

◆ index_region_template

char* index_region_template
static

Region index template.

Definition at line 414 of file mapper.c.

Referenced by main(), and write_region_index().

◆ index_template

char* index_template
static

Index page template.

Definition at line 406 of file mapper.c.

Referenced by main(), and write_maps_index().

◆ infomap

gdImagePtr infomap
static

World map with exits / roads / blocking / ...

Definition at line 475 of file mapper.c.

Referenced by do_exit_map(), main(), write_world_info(), and write_world_map().

◆ jpeg_quality

int jpeg_quality = -1
static

Quality for jpg pictures.

Definition at line 449 of file mapper.c.

Referenced by do_parameters(), main(), and save_picture().

◆ level_map_template

char* level_map_template
static

Definition at line 419 of file mapper.c.

Referenced by main(), and write_maps_by_level().

◆ level_template

char* level_template
static

Definition at line 417 of file mapper.c.

Referenced by main(), and write_maps_by_level().

◆ level_value_template

char* level_value_template
static

Definition at line 418 of file mapper.c.

Referenced by main(), and write_maps_by_level().

◆ list_system_quests

bool list_system_quests = false
static

Whether to show 'system' quests or not.

Definition at line 385 of file mapper.c.

Referenced by do_parameters(), main(), quest_callback(), and write_quests_list().

◆ list_unused_maps

int list_unused_maps = 0
static

If set, program will list maps found in directory but not linked from the first maps.

Definition at line 469 of file mapper.c.

Referenced by do_parameters(), main(), and process_map().

◆ map_exit_template

char* map_exit_template
static

Map template: one exit.

Definition at line 394 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_exit_to_template

char* map_exit_to_template
static

Map template: one exit leading to this map.

Definition at line 397 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_limit

int map_limit = -1
static

Maximum number of maps to browse, -1 for all.

Definition at line 379 of file mapper.c.

Referenced by do_parameters(), and main().

◆ map_lore_template

char* map_lore_template
static

Map template: lore.

Definition at line 398 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_monster_after_template

char* map_monster_after_template
static

Map template: after the monster list.

Definition at line 404 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_monster_before_template

char* map_monster_before_template
static

Map template: before the monster list.

Definition at line 401 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_monster_between_template

char* map_monster_between_template
static

Map template: between each monster.

Definition at line 402 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_monster_one_template

char* map_monster_one_template
static

Map template: one monster.

Definition at line 403 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_no_exit_template

char* map_no_exit_template
static

World map template: no exit.

Definition at line 392 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_no_exit_to_template

char* map_no_exit_to_template
static

World map template: no exit leading to this map.

Definition at line 395 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_no_lore_template

char* map_no_lore_template
static

Map template: no lore.

Definition at line 399 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_no_monster_template

char* map_no_monster_template
static

Map template: no monster.

Definition at line 400 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_no_quest_template

char* map_no_quest_template
static

Definition at line 425 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_one_quest_template

char* map_one_quest_template
static

Definition at line 427 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_template

char* map_template
static

Map template.

Definition at line 391 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_with_exit_template

char* map_with_exit_template
static

Map template: exit template.

Definition at line 393 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_with_exit_to_template

char* map_with_exit_to_template
static

Map template: exits leading to this map.

Definition at line 396 of file mapper.c.

Referenced by main(), and write_map_page().

◆ map_with_quests_template

char* map_with_quests_template
static

Definition at line 426 of file mapper.c.

Referenced by main(), and write_map_page().

◆ maps_list

◆ num_sizes

const int num_sizes = sizeof(sizes)/sizeof(int)
static

Definition at line 376 of file mapper.c.

Referenced by process_map().

◆ output_extensions

const char* output_extensions[]
static
Initial value:
= {
".png",
".jpg"
}

Extensions depending on output format.

Definition at line 440 of file mapper.c.

Referenced by do_tiled_map_picture(), main(), process_map(), tiled_map_need_pic(), write_map_page(), write_world_info(), and write_world_map().

◆ output_format

enum output_format_type output_format = OF_PNG
static

◆ pics_allocated

int pics_allocated
static

Number of created pictures for GD.

Definition at line 369 of file mapper.c.

Referenced by main(), and process_map().

◆ quest_map_template

char* quest_map_template
static

Definition at line 423 of file mapper.c.

Referenced by main(), and write_quests_page().

◆ quest_template

char* quest_template
static

Definition at line 422 of file mapper.c.

Referenced by main(), and write_quests_page().

◆ quests

struct_quest** quests = NULL
static

All quests in the game.

Definition at line 1204 of file mapper.c.

Referenced by find_quest_info(), get_quest_info(), write_map_page(), and write_quests_page().

◆ quests_allocated

int quests_allocated = 0
static

Allocated items in quests.

Definition at line 1208 of file mapper.c.

Referenced by get_quest_info().

◆ quests_count

int quests_count = 0
static

Count of quests.

Definition at line 1206 of file mapper.c.

Referenced by find_quest_info(), get_quest_info(), and write_quests_page().

◆ races

struct_race_list races
static

Monsters found in maps.

Definition at line 324 of file mapper.c.

Referenced by fix_tiled_map_monsters(), get_race(), main(), and write_race_index().

◆ rawmaps

int rawmaps = 0
static

Whether to generate raw pics or instancied ones.

Definition at line 452 of file mapper.c.

Referenced by do_parameters(), main(), and process_map().

◆ region_allocated

int region_allocated = 0
static

Allocated size of regions.

Definition at line 467 of file mapper.c.

Referenced by add_map_to_region(), and write_world_map().

◆ region_count

int region_count = 0
static

◆ region_letter_template

char* region_letter_template
static

One letter for the region.

Definition at line 411 of file mapper.c.

Referenced by main(), and write_region_page().

◆ region_map_template

char* region_map_template
static

Region page template: one map.

Definition at line 412 of file mapper.c.

Referenced by main(), and write_region_page().

◆ region_template

char* region_template
static

Region page template.

Definition at line 410 of file mapper.c.

Referenced by main(), and write_region_page().

◆ regions

struct struct_region_info** regions = NULL
static

Found regions.

Definition at line 465 of file mapper.c.

Referenced by add_map_to_region(), fix_exits_to_tiled_maps(), write_all_regions(), write_region_index(), and write_world_map().

◆ regions_link

char** regions_link
static

Definition at line 488 of file mapper.c.

Referenced by add_region_link(), and write_regions_link().

◆ regions_link_allocated

int regions_link_allocated = 0
static

Definition at line 490 of file mapper.c.

Referenced by add_region_link().

◆ regions_link_count

int regions_link_count = 0
static

Definition at line 489 of file mapper.c.

Referenced by add_region_link(), and write_regions_link().

◆ root

◆ show_maps

int show_maps = 0
static

If set, will generate much information on map loaded.

Definition at line 380 of file mapper.c.

Referenced by do_parameters(), main(), and process_map().

◆ sizes

int sizes[] = {32, 16, 8, 4, 2}
static

Definition at line 375 of file mapper.c.

Referenced by process_map().

◆ slaying_allocated

int slaying_allocated = 0
static

Allocated size of slaying_info.

Definition at line 508 of file mapper.c.

Referenced by get_slaying_struct().

◆ slaying_count

int slaying_count = 0
static

Count of items in slaying_info.

Definition at line 507 of file mapper.c.

Referenced by get_slaying_struct(), write_npc_list(), and write_slaying_info().

◆ slaying_info

struct_slaying_info** slaying_info = NULL
static

Found slaying fields.

Definition at line 506 of file mapper.c.

Referenced by get_slaying_struct(), write_npc_list(), and write_slaying_info().

◆ special_equipment

struct_equipment** special_equipment = NULL
static

Special equipment list.

Definition at line 310 of file mapper.c.

Referenced by ensure_unique(), and write_equipment_index().

◆ system_quests

const quest_definition* system_quests[500]
static

Definition at line 3541 of file mapper.c.

Referenced by quest_callback(), and write_quests_list().

◆ system_quests_count

size_t system_quests_count = 0
static

Definition at line 3540 of file mapper.c.

Referenced by quest_callback(), and write_quests_list().

◆ tiled_map_list

struct_map_list tiled_map_list
static

Pseudo-maps grouping other maps.

Definition at line 299 of file mapper.c.

Referenced by create_tiled_map(), fix_tiled_map(), main(), merge_tiled_maps(), and write_tiled_maps().

◆ tileset

int tileset = 0
static

Tileset to use to generate pics.

Definition at line 383 of file mapper.c.

Referenced by do_parameters(), main(), and process_map().

◆ warn_no_path

int warn_no_path = 0
static

Whether to warn of exits without a path

Definition at line 455 of file mapper.c.

Referenced by do_parameters(), main(), and process_map().

◆ world_exit_info

int world_exit_info = 1
static

If set, will generate a world map of exits.

Definition at line 382 of file mapper.c.

Referenced by do_parameters(), main(), and write_world_info().

◆ world_map

int world_map = 1
static

If set, will generate a world map.

Definition at line 381 of file mapper.c.

Referenced by do_parameters(), main(), and write_world_map().

◆ world_map_template

char* world_map_template
static

One map in a row.

Definition at line 389 of file mapper.c.

Referenced by main(), and write_world_map().

◆ world_row_template

char* world_row_template
static

One row in the world map.

Definition at line 388 of file mapper.c.

Referenced by main(), and write_world_map().

◆ world_template

char* world_template
static

World map template.

Definition at line 387 of file mapper.c.

Referenced by main(), and write_world_map().