Crossfire Server, Trunk
mapper.cpp 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 "inja.hpp"
#include <map>
#include <set>
+ Include dependency graph for mapper.cpp:

Go to the source code of this file.

Data Structures

class  pageToRender
 
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]
 

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_Chars *)
 
Account_Charsaccount_char_load (const char *)
 
void account_char_save (Account_Chars *)
 
void account_logout (const char *)
 
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)
 
static void add_slaying (struct_map_info *map, object *item)
 
void add_template_to_render (const std::string &template_name, const std::string &output_name, const std::string &param)
 
static void add_to_struct_map_in_quest_list (struct_map_in_quest_list *list, struct_map_in_quest *item)
 
static void append_map_list (struct_map_list &dest, struct_map_list &src)
 
int apply_auto (object *op)
 
void apply_auto_fix (mapstruct *)
 
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 *, const char *)
 
static int compare_map_info (const struct_map_info *left, const struct_map_info *right)
 
static void create_destination (void)
 
static nlohmann::json create_map_in_quest_array (struct_map_in_quest_list &list)
 
static struct_map_infocreate_map_info (void)
 
static nlohmann::json create_map_object (struct_map_info *map, const std::string &key)
 
static nlohmann::json create_maps_array (struct_map_list &maps)
 
static nlohmann::json create_npc_array (struct_npc_list &list)
 
static struct_npc_infocreate_npc_info (const object *npc)
 
static nlohmann::json create_quest_object (struct_quest *quest, const std::string &key)
 
static nlohmann::json create_race_array (struct_race_list &list)
 
static nlohmann::json create_region_array (const std::set< region * > &regions)
 
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 void do_parameters (int argc, char **argv)
 
static void do_tiled_map_picture (struct_map_info *map)
 
void dragon_ability_gain (object *, int, int)
 
void draw_ext_info (int, int, const object *, uint8_t, uint8_t, const char *txt)
 
void draw_ext_info_format (int, int, const object *, uint8_t, uint8_t, const char *format,...)
 
static void dump_unused_maps (void)
 
void emergency_save (int)
 
static struct_equipmentensure_unique (struct_equipment *item)
 
void esrv_del_item (player *, object *)
 
void esrv_send_item (object *, object *)
 
void esrv_update_item (int, object *, object *)
 
void esrv_update_spells (player *)
 
void ext_info_map (int, const mapstruct *, uint8_t, uint8_t, const char *str1)
 
static void fill_json (nlohmann::json &json)
 
static void fill_reverse_maps (struct_map_list &list)
 
static struct_map_infofind_map_by_key (const std::string &key)
 
static void find_maps (const char *from)
 
playerfind_player_partial_name (const char *)
 
static struct_questfind_quest_info (const char *name)
 
static regionfind_region_by_key (const std::string &key)
 
objectfind_skill_by_number (object *, int)
 
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 nlohmann::json generate_page_and_link (inja::Arguments &args)
 
static nlohmann::json generate_picture_link (inja::Arguments &args)
 
static void generate_picture_path (const char *path, size_t pic_size, char *out, size_t len)
 
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 inja::Template get_template (const std::string &filename)
 
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_renderer_env ()
 
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, struct_map_info *tiled_map)
 
void move_firewall (object *)
 
static std::string path_from_current (const std::string &path)
 
SockListplayer_get_delayed_buffer (player *)
 
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 *)
 
static void relative_path (const char *from, const char *to, char *result)
 
void rod_adjust (object *)
 
static void save_picture (FILE *file, gdImagePtr pic)
 
void set_darkness_map (mapstruct *)
 
static int sort_equipment (const void *a, const void *b)
 
static int sort_map_info (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_struct_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 std::vector< std::string > split (const std::string &field, const std::string &by)
 
static std::string templates_root ("templates/")
 
static int tiled_map_need_pic (struct_map_info *map)
 
static void write_pictures_from_real_size (const char *path, gdImagePtr real, int width, int height)
 
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 nlohmann::json all_data
 
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 bool display_rendered_template = false
 
static bool do_regions_link = false
 
static int ** elevation_info
 
static int elevation_max
 
static int elevation_min
 
static std::shared_ptr< inja::Environmentenv
 
static size_t equipment_allocated = 0
 
static size_t 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_pics = 1
 
static const char * ignore_name []
 
static const char * ignore_path []
 
static gdImagePtr infomap
 
static int jpeg_quality = -1
 
static bool list_system_quests = false
 
static int list_unused_maps = 0
 
static int map_limit = -1
 
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 std::vector< pageToRenderpages
 
static std::vector< std::string > path_stack
 
static int pics_allocated
 
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 size_t region_allocated = 0
 
static size_t region_count = 0
 
static std::map< region *, std::set< region * > > region_links
 
static struct struct_region_info ** regions = NULL
 
static std::set< std::string > rendered_templates
 
static std::map< struct_map_info *, std::string > reverse_maps
 
static std::map< region *, std::string > reverse_regions
 
static char root [500]
 
static int show_maps = 0
 
static int sizes [] = {32, 16, 8, 4, 2}
 
static size_t slaying_allocated = 0
 
static size_t 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 inja::TemplateStorage templateCache
 
static std::vector< std::string > templates
 
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
 

Detailed Description

This program generates, by default, map browsing web pages (but it can be customized for other things).

Quick run: without arguments, will make sensible choices.

For help, try the -help option.

Since this program browses maps from the first map, only maps linked from there will be processed. A command line parameter, "-addmap=", allows to specify more maps.

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

Generated files use "templates", stored (by default) in "templates/" subdirectory. A list of files to process is specified on the command line (by default "index.html"), and from there the program will generate all requested pages.

Templates use the inja C++ template engine, found at https://github.com/pantor/inja Provided templates should give much samples of use, see "index.html" for entry point.

The following objects exist:

  • map: identified by a unique key, the following fields are defined:
    • _key: unique map key
    • name: map name as defined in the map itself
    • path: map path from the map root
    • region: key of the region this map is part of
    • level: map level as defined in the map
    • lore: map lore as defined in the map
    • exits_to: array of map keys that this map contains exits to
    • exits_from: array of map keys that link to this map
    • npcs: array of npc objects that are on this map
    • readables: array of npc objects that represent books on this map
    • monsters: array of monster objects
    • quests: array of quest_in_map objects that this map is part of
  • region: identified by a unique key, the following fields are defined:
    • _key: unique region identifier
    • name: region short name
    • longname: region long name
    • description: region description
    • maps: array of map keys that are part of the region
    • links: array of region keys this region has exits to
  • item: contains the following fields:
    • name: item name as found on the map
    • power: item power as found on the map
    • calc_power: item power as computed by the game
    • diff: item specific fields, as an (CF) object difference with the archetype
    • maps: array of map keys the item is found on
  • monster: contains the following fields:
    • name: monster's name
    • count: how many are found in the world
    • maps: array of map keys the monster is found on
  • system_quest: information about a quest, with the following fields:
    • code: unique quest code
    • title: quest title as seen by the player
    • description: long description, as seen by the player
    • steps: only filled if the command-line parameter "-details-quests" is specified, array of steps:
      • description: step description
      • is_completion: true if this step completes the quest, false else
  • slaying: information about a key, detector and such, with the following fields:
    • slaying: unique code
    • doors: array of map keys that contain a door with this slaying
    • keys: array of map keys that contain a key with this slaying
    • containers: array of map keys that contain a container with this slaying
    • detectors: array of map keys that contain a detector with this slaying
    • connections: array of map keys that contain a connection with this slaying
  • quests: information about a quest as defined in map parameters, with the following fields:
    • _key: unique quest key
    • number: unique quest number
    • name: quest name, may be empty
    • description: quest description, may be empty
    • main_map: key of the main map of the quest, may be empty
    • maps: array of quest_in_map objects
  • quest_in_map: information about a link between a map and a quest
    • map: map key
    • description: relationship between the quest and the map
    • quest: quest name
    • number: unique quest number *
  • npc: information about a NPC or a readable (book, sign, message...), fields:
    • name: NPC or readable name as defined in the map
    • x: coordinate in the map
    • y: coordinate in the map
    • message: NPC or readable message
  • monster: information about a monster, fields:
    • name: monster name
    • count: number on the map

The following variables are available to the templates:

  • maps: list of maps
  • regions: list of regions
  • items: list of special equipment
  • monsters: list of monster objects
  • system_quests: list of system quest objects
  • slaying: list of slaying information objects
  • quests: list of quests defined in map objects

As well as default callbacks provided by inja, mapper adds the following ones:

  • link_to_page(page_name[, param]): process the "page_name" template, and return a link to the file. "param" is an optional string that the template will be able to access via the "param" variable. Pages with the same "page_name" and "param" are considered equal.
  • substr(what, start[, length]): return the substring from "start", of a specified length or the end of the string.
  • picture(item_key[, size]): return the path to the picture of the specified item. "size" is 1 to 5, with 1 real size and 5 the smallest size. Only map keys are allowed for now.
  • pad(val, digits): pad "val" to a string of "length" characters, adding 0 in front if needed.
  • path_to_root: return the relative path, without final /, to the output root of generated files.
  • sort(list, keys[, invert[, ignore_case]]): sort the specified list by the value of 'keys', which may include multiple field names separated by a comma. If 'invert' is true then invert order. Strings are compared in a case-unsensitive manner unless 'ignore_case' is false.
  • get_by_field(list, field, value): return the first item in the list having a field 'field' with value 'value'.

For maps, 5 pictures are generated, with sizes of 32, 16, 8, 4 and 2 pixels for tiles.

To build this program, add the '–enable-mapper' flag to 'configure' then run 'make' at the server root. It requires the GD library and its development files.

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
  • shop catalog
  • treasure list use

Definition in file mapper.cpp.

Macro Definition Documentation

◆ S_CONNECT

#define S_CONNECT   4

Definition at line 394 of file mapper.cpp.

◆ S_CONTAINER

#define S_CONTAINER   2

Definition at line 392 of file mapper.cpp.

◆ S_DETECTOR

#define S_DETECTOR   3

Definition at line 393 of file mapper.cpp.

◆ S_DOOR

#define S_DOOR   0

Connection/slaying information.

Definition at line 390 of file mapper.cpp.

◆ S_KEY

#define S_KEY   1

Definition at line 391 of file mapper.cpp.

◆ S_MAX

#define S_MAX   5

Definition at line 395 of file mapper.cpp.

◆ SIZE

#define SIZE   50

◆ size_large

#define size_large   sizes[0]

Definition at line 316 of file mapper.cpp.

◆ size_small

#define size_small   sizes[1]

Definition at line 317 of file mapper.cpp.

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 332 of file mapper.cpp.

Function Documentation

◆ account_char_free()

void account_char_free ( Account_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 3467 of file mapper.cpp.

Referenced by account_add_player_cmd(), free_newsocket(), init_connection(), key_confirm_quit(), send_account_players(), set_player_socket(), and START_TEST().

+ Here is the caller graph for this function:

◆ account_char_load()

Account_Chars* account_char_load ( const char *  )

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
Character data.

Definition at line 3460 of file mapper.cpp.

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 ( Account_Chars )

Saves the character information for the given account.

Parameters
charspreviously loaded/generated list of character information for this account.

Definition at line 3464 of file mapper.cpp.

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

+ Here is the caller graph for this function:

◆ account_logout()

void account_logout ( const char *  )

Remove 'account_name' from the list of logged in accounts.

Definition at line 3473 of file mapper.cpp.

Referenced by free_newsocket().

+ 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 1208 of file mapper.cpp.

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

Referenced by add_map_to_region(), add_map_to_slaying(), add_monster(), add_one_item(), append_map_list(), 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 987 of file mapper.cpp.

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 1351 of file mapper.cpp.

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 1462 of file mapper.cpp.

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 642 of file mapper.cpp.

References add_map(), add_race_to_list(), get_race(), obj::head, obj::level, disinfect::map, MAX, MIN, obj::name, 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 1186 of file mapper.cpp.

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()

◆ 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 287 of file mapper.cpp.

References bigchest::check, and guildoracle::list.

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

+ Here is the caller graph for this function:

◆ add_region_link()

static void add_region_link ( mapstruct source,
mapstruct dest 
)
static

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

Parameters
sourcemap from.
destmap to.

Definition at line 1399 of file mapper.cpp.

References convert::dest, get_region_by_map(), and region_links.

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 1474 of file mapper.cpp.

References add_map_to_slaying(), CONTAINER, DETECTOR, get_slaying_struct(), LOCKED_DOOR, disinfect::map, S_CONNECT, S_CONTAINER, S_DETECTOR, S_DOOR, S_KEY, and SPECIAL_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_template_to_render()

void add_template_to_render ( const std::string &  template_name,
const std::string &  output_name,
const std::string &  param 
)

Push the specified template, with optional param, on the list of files to process.

Parameters
template_nametemplate name to use.
output_nameoutput file name.
paramadditional parameter to the template.

Definition at line 2640 of file mapper.cpp.

References pages, ring_occidental_mages::r, and rendered_templates.

Referenced by generate_page_and_link(), and main().

+ 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 928 of file mapper.cpp.

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

Referenced by add_map_to_quest().

+ Here is the caller graph for this function:

◆ append_map_list()

static void append_map_list ( struct_map_list dest,
struct_map_list src 
)
static

Append the contents of src to dest.

Parameters
destwhere to put items.
srcwhat to append to dest, unchanged.

Definition at line 2383 of file mapper.cpp.

References add_map(), struct_map_list::count, convert::dest, disinfect::map, and struct_map_list::maps.

Referenced by fill_json().

+ Here is the call graph for this function:
+ 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 3397 of file mapper.cpp.

References BOOK, 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, SHOP_FLOOR, Ice::tmp, and TREASURE.

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 )

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 3449 of file mapper.cpp.

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

+ 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 578 of file mapper.cpp.

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 1502 of file mapper.cpp.

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 3365 of file mapper.cpp.

Referenced by fatal(), and LOG().

+ Here is the caller graph for this function:

◆ command_help()

void command_help ( object ,
const char *   
)

Player is asking for some help.

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

Definition at line 3470 of file mapper.cpp.

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 851 of file mapper.cpp.

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

Referenced by sort_map_info().

+ 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 3031 of file mapper.cpp.

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_in_quest_array()

static nlohmann::json create_map_in_quest_array ( struct_map_in_quest_list list)
static

Return an array of map-in-quest items.

Parameters
listitems to return the JSON of.
Returns
array.

Definition at line 2303 of file mapper.cpp.

References nlohmann::basic_json::array, guildoracle::list, m, nlohmann::basic_json::push_back(), item::q, and reverse_maps.

Referenced by create_map_object(), and create_quest_object().

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

◆ create_map_info()

◆ create_map_object()

static nlohmann::json create_map_object ( struct_map_info map,
const std::string &  key 
)
static

Return a JSON map object.

Parameters
mapmap to return the JSON of.
keymap unique identifier.
Returns
JSON object.

Definition at line 2326 of file mapper.cpp.

References create_map_in_quest_array(), create_maps_array(), create_npc_array(), create_race_array(), castle_read::key, disinfect::map, and reverse_regions.

Referenced by fill_json().

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

◆ create_maps_array()

static nlohmann::json create_maps_array ( struct_map_list maps)
static

Return an array of map identifiers.

Parameters
mapsitems to return the JSON of.
Returns
array.

Definition at line 2251 of file mapper.cpp.

References nlohmann::basic_json::array, m, disinfect::map, maps, rotate-tower::result, and reverse_maps.

Referenced by create_map_object(), and fill_json().

+ Here is the caller graph for this function:

◆ create_npc_array()

static nlohmann::json create_npc_array ( struct_npc_list list)
static

Return an array of NPC information.

Parameters
listitems to return the JSON of.
Returns
array.

Definition at line 2267 of file mapper.cpp.

References guildoracle::list, npc_dialog::npc, and rotate-tower::result.

Referenced by create_map_object().

+ Here is the caller graph for this function:

◆ 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 1168 of file mapper.cpp.

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_quest_object()

static nlohmann::json create_quest_object ( struct_quest quest,
const std::string &  key 
)
static

Return a JSON quest object.

Parameters
questquest to return the JSON of.
keyquest unique key.
Returns
JSON object.

Definition at line 2349 of file mapper.cpp.

References create_map_in_quest_array(), castle_read::key, and reverse_maps.

Referenced by fill_json().

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

◆ create_race_array()

static nlohmann::json create_race_array ( struct_race_list list)
static

Return an array of monster information.

Parameters
listitems to return the JSON of.
Returns
array.

Definition at line 2286 of file mapper.cpp.

References guildoracle::list, and rotate-tower::result.

Referenced by create_map_object().

+ Here is the caller graph for this function:

◆ create_region_array()

static nlohmann::json create_region_array ( const std::set< region * > &  regions)
static

Return an array of region identifiers.

Parameters
regionsregions to process.
Returns
JSON object.

Definition at line 2393 of file mapper.cpp.

References nlohmann::basic_json::array, nlohmann::basic_json::push_back(), ring_occidental_mages::r, regions, and reverse_regions.

Referenced by fill_json().

+ Here is the call graph for this function:
+ 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 1251 of file mapper.cpp.

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 1053 of file mapper.cpp.

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()

◆ 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 742 of file mapper.cpp.

References color_blocking, color_linked_exit, color_road, color_slowing, color_unlinked_exit, elevation_info, elevation_max, elevation_min, EXIT, FOR_MAP_FINISH, FOR_MAP_PREPARE, HEAD, infomap, is_blocking(), is_road(), disinfect::map, MAP_HEIGHT, MAP_WIDTH, MAX, MIN, obj::move_slow, object_get_value(), obj::slaying, sstring, TELEPORTER, obj::type, 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 2912 of file mapper.cpp.

Referenced by do_parameters().

+ 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 2949 of file mapper.cpp.

References add_map(), detail_quests, display_rendered_template, do_help(), do_regions_link, force_pics, generate_pics, get_map_info(), jpeg_quality, list_system_quests, list_unused_maps, map_limit, maps_list, OF_JPG, output_format, python_init::path, rawmaps, root, show_maps, templates, templates_root(), 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_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 2072 of file mapper.cpp.

References disinfect::count, replace::current, generate_pics, generate_picture_path(), disinfect::map, OF_PNG, make_face_from_files::out, output_format, size_large, tiled_map_need_pic(), and write_pictures_from_real_size().

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 ,
int  ,
int   
)

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 3371 of file mapper.cpp.

Referenced by dragon_level_gain().

+ Here is the caller graph for this function:

◆ draw_ext_info()

void draw_ext_info ( int  ,
int  ,
const object ,
uint8_t  ,
uint8_t  ,
const char *  txt 
)

Dummy functions to link the library.

Definition at line 3343 of file mapper.cpp.

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_heal_and_mana(), 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_wimpy(), command_wizcast(), command_wizpass(), confuse_living(), create_aura(), create_bomb(), cure_disease(), current_map_info(), 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_add_probe_monster(), knowledge_alchemy_attempt(), knowledge_display(), knowledge_do_attempt(), knowledge_do_display(), knowledge_item_can_be_used_alchemy(), knowledge_show(), 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  ,
int  ,
const object ,
uint8_t  ,
uint8_t  ,
const char *  format,
  ... 
)

Definition at line 3347 of file mapper.cpp.

References logfile.

◆ 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 2825 of file mapper.cpp.

References dump(), is_valid_types_gen::found, found_maps, found_maps_count, npc_dialog::index, python_init::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  )

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 3362 of file mapper.cpp.

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 466 of file mapper.cpp.

References struct_equipment::calc_power, bigchest::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 ,
object  
)

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

Definition at line 3381 of file mapper.cpp.

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 ,
object  
)

Sends item's info to player.

Definition at line 3368 of file mapper.cpp.

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 )

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 3387 of file mapper.cpp.

Referenced by fix_player().

+ Here is the caller graph for this function:

◆ ext_info_map()

void ext_info_map ( int  ,
const mapstruct ,
uint8_t  ,
uint8_t  ,
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 3355 of file mapper.cpp.

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:

◆ fill_json()

◆ fill_reverse_maps()

static void fill_reverse_maps ( struct_map_list list)
static

Fill the reverse_maps array with the provided list.

Parameters
listmaps to put.

Definition at line 2364 of file mapper.cpp.

References buf, guildoracle::list, disinfect::map, reverse_maps, sort_map_info(), and sort_race().

Referenced by fill_json().

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

◆ find_map_by_key()

static struct_map_info* find_map_by_key ( const std::string &  key)
static

Get the map with the specified key, nullptr if not found.

Parameters
keykey of the map to find.
Returns
map, nullptr if not found.

Definition at line 2227 of file mapper.cpp.

References c, is_valid_types_gen::found, castle_read::key, and reverse_maps.

Referenced by generate_page_and_link(), and generate_picture_link().

+ 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 2780 of file mapper.cpp.

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_init::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 *  )

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 3456 of file mapper.cpp.

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 941 of file mapper.cpp.

References give::name, quests, and quests_count.

Referenced by fill_json(), and get_quest_info().

+ Here is the caller graph for this function:

◆ find_region_by_key()

static region* find_region_by_key ( const std::string &  key)
static

Get the region with the specified key, nullptr if not found.

Parameters
keykey of the region to find.
Returns
region, nullptr if not found.

Definition at line 2239 of file mapper.cpp.

References c, is_valid_types_gen::found, castle_read::key, and reverse_regions.

Referenced by generate_page_and_link().

+ Here is the caller graph for this function:

◆ find_skill_by_number()

object* find_skill_by_number ( object ,
int   
)

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 3377 of file mapper.cpp.

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 1968 of file mapper.cpp.

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 1987 of file mapper.cpp.

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 1881 of file mapper.cpp.

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 1899 of file mapper.cpp.

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, create-tower::tile, 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 2015 of file mapper.cpp.

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 452 of file mapper.cpp.

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

Referenced by add_one_item(), and ensure_unique().

+ Here is the caller graph for this function:

◆ generate_page_and_link()

static nlohmann::json generate_page_and_link ( inja::Arguments args)
static

Create a link to a page, generating it if needed.

Parameters
argslink arguments.
Returns
link to the page.

Definition at line 2576 of file mapper.cpp.

References add_template_to_render(), make_face_from_files::args, find_map_by_key(), find_region_by_key(), disinfect::map, and path_from_current().

Referenced by init_renderer_env().

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

◆ generate_picture_link()

static nlohmann::json generate_picture_link ( inja::Arguments args)
static

Return the link to the picture of the specified item.

Parameters
argsfunction arguments.
Returns
link, empty string if invalid.

Definition at line 2606 of file mapper.cpp.

References make_face_from_files::args, find_map_by_key(), disinfect::map, output_extensions, output_format, and path_from_current().

Referenced by init_renderer_env().

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

◆ generate_picture_path()

static void generate_picture_path ( const char *  path,
size_t  pic_size,
char *  out,
size_t  len 
)
static

Definition at line 1510 of file mapper.cpp.

References make_face_from_files::out, output_extensions, output_format, python_init::path, and root.

Referenced by do_tiled_map_picture(), process_map(), tiled_map_need_pic(), and write_pictures_from_real_size().

+ 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 727 of file mapper.cpp.

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 439 of file mapper.cpp.

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 1301 of file mapper.cpp.

References add_map(), struct_map_list::count, create_map_info(), struct_map_info::filename, disinfect::map, struct_map_list::maps, maps_list, python_init::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 958 of file mapper.cpp.

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 613 of file mapper.cpp.

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 1431 of file mapper.cpp.

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:

◆ get_template()

static inja::Template get_template ( const std::string &  filename)
static

Definition at line 3052 of file mapper.cpp.

References env, npc_dialog::filename, and templateCache.

Referenced by main().

+ 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 412 of file mapper.cpp.

References guildoracle::list.

Referenced by create_map_info(), fill_json(), 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 1155 of file mapper.cpp.

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 271 of file mapper.cpp.

References guildoracle::list.

Referenced by create_map_info(), and main().

+ Here is the caller graph for this function:

◆ init_renderer_env()

static void init_renderer_env ( )
static

Initialize env and set various callbacks and options.

Definition at line 2672 of file mapper.cpp.

References make_face_from_files::args, nlohmann::basic_json::array, buf, replace::current, env, is_valid_types_gen::found, generate_page_and_link(), generate_picture_link(), guildoracle::list, path_stack, ring_occidental_mages::r, relative_path(), root, make_face_from_files::str, templates_root(), and autojail::value.

Referenced by main().

+ Here is the call graph for this function:
+ 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 922 of file mapper.cpp.

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
itemobject to test.
Returns
1 if item blocks all movement, 0 else.

Definition at line 713 of file mapper.cpp.

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
itemobject to check.
Returns
1 if object is a road, 0 else.

Definition at line 677 of file mapper.cpp.

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 1418 of file mapper.cpp.

References CHECK_INV, CONTAINER, LOCKED_DOOR, and SPECIAL_KEY.

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 420 of file mapper.cpp.

References AMULET, FLAG_NO_PICK, IS_ARMOR, IS_ARROW, IS_SHIELD, IS_WEAPON, MOVE_ALL, QUERY_FLAG, RING, ROD, and WAND.

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 1328 of file mapper.cpp.

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

Referenced by process_map().

+ Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 3062 of file mapper.cpp.

References add_template_to_render(), all_data, cached_pics, color_blocking, color_linked_exit, color_road, color_slowing, color_unlinked_exit, struct_race_list::count, struct_map_list::count, create_destination(), created_pics, create-tower::current_map, Settings::debug, detail_quests, display_rendered_template, do_parameters(), do_regions_link, dump_unused_maps(), elevation_info, elevation_max, elevation_min, env, equipment_count, nlohmann::basic_json::erase(), regiondef::fallback, mad_mage_user::file, fill_json(), 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_pics, get_faces_count(), get_map_info(), get_region_struct(), get_template(), infomap, init_globals(), init_gods(), init_library(), init_map_list(), init_race_list(), init_readable(), init_renderer_env(), is_valid_faceset(), jpeg_quality, list_system_quests, list_unused_maps, llevError, regiondef::longname, map_limit, struct_map_list::maps, maps_list, say::max, regiondef::name, regiondef::next, OF_JPG, output_extensions, output_format, pages, path_stack, pics_allocated, process_map(), quest_callback(), quest_for_each(), quests, quests_count, struct_race_list::races, races, rawmaps, region_count, regions, root, settings, show_maps, slaying_count, slaying_info, sort_equipment(), sort_map_info(), sort_race(), sort_region(), sort_slaying(), sort_struct_quest(), sort_system_quest(), sortbyname(), special_equipment, strdup_local, system_quests, system_quests_count, guildbuy::temp, templates, templates_root(), tiled_map_list, tileset, warn_no_path, world_exit_info, world_map, 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,
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.
tiled_mapthe map tiled to another group. Its group will disappear.

Definition at line 1267 of file mapper.cpp.

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 )

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 3359 of file mapper.cpp.

Referenced by legacy_ob_process(), and trigger_connected().

+ Here is the caller graph for this function:

◆ path_from_current()

static std::string path_from_current ( const std::string &  path)
static

Compute the relative path from the specified file to the current file.

Parameters
pathpath to get from.
Returns
relative path to the current page.

Definition at line 2559 of file mapper.cpp.

References replace::current, python_init::path, path_stack, and relative_path().

Referenced by generate_page_and_link(), and generate_picture_link().

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

◆ player_get_delayed_buffer()

SockList* player_get_delayed_buffer ( player )

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 3452 of file mapper.cpp.

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 1542 of file mapper.cpp.

References add_map(), add_map_to_region(), add_monster(), add_npc_to_map(), add_region_link(), add_slaying(), archininventory::arch, BOOK, 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, 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, generate_picture_path(), 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, 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(), struct_map_info::path, path_combine_and_normalize(), struct_map_info::pic_was_done, pics_allocated, PLAYER_CHANGER, process_map_lore(), QUERY_FLAG, rawmaps, struct_map_info::readable, ready_map_name(), mapdef::reset_time, show_maps, SIGN, size_large, TELEPORTER, struct_map_info::tiled_group, struct_map_info::tiled_maps, struct_map_info::tiles, tileset, warn_no_path, struct_map_info::width, write_pictures_from_real_size(), 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 1072 of file mapper.cpp.

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 *   
)
static

Definition at line 2202 of file mapper.cpp.

References list_system_quests, system_quests, and system_quests_count.

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 812 of file mapper.cpp.

References rotate-tower::result.

Referenced by init_renderer_env(), and path_from_current().

+ Here is the caller graph for this function:

◆ rod_adjust()

void rod_adjust ( object )

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

Parameters
rodthe rod to update

Definition at line 3390 of file mapper.cpp.

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 1385 of file mapper.cpp.

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

Referenced by write_pictures_from_real_size(), write_world_info(), and write_world_map().

+ Here is the caller graph for this function:

◆ set_darkness_map()

void set_darkness_map ( mapstruct )

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

Parameters
mmap to alter.

Definition at line 3374 of file mapper.cpp.

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 595 of file mapper.cpp.

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

Referenced by main().

+ 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 876 of file mapper.cpp.

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

Referenced by fill_json(), fill_reverse_maps(), and main().

+ 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 664 of file mapper.cpp.

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

Referenced by fill_reverse_maps(), and main().

+ 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 892 of file mapper.cpp.

Referenced by main().

+ 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 2899 of file mapper.cpp.

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

Referenced by main().

+ 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 1009 of file mapper.cpp.

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 fill_json().

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

◆ sort_struct_quest()

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

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

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

Definition at line 1037 of file mapper.cpp.

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

Referenced by main().

+ 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 2208 of file mapper.cpp.

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

Referenced by main().

+ 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 2212 of file mapper.cpp.

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

Referenced by fill_json().

+ 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 796 of file mapper.cpp.

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

Referenced by main().

+ Here is the caller graph for this function:

◆ split()

◆ templates_root()

static std::string templates_root ( "templates/"  )
static

Directory to get templates from, with a leading /.

Referenced by do_parameters(), init_renderer_env(), and 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 2042 of file mapper.cpp.

References generate_picture_path(), disinfect::map, and num_sizes.

Referenced by do_tiled_map_picture().

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

◆ write_pictures_from_real_size()

static void write_pictures_from_real_size ( const char *  path,
gdImagePtr  real,
int  width,
int  height 
)
static

Definition at line 1514 of file mapper.cpp.

References generate_picture_path(), make_path_to_file(), MAX_BUF, num_sizes, make_face_from_files::out, python_init::path, save_picture(), size_large, and sizes.

Referenced by do_tiled_map_picture(), and process_map().

+ Here is the call graph for this function:
+ 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 2180 of file mapper.cpp.

References do_tiled_map_picture(), and disinfect::map.

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 2190 of file mapper.cpp.

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 2848 of file mapper.cpp.

References elevation_info, elevation_max, elevation_min, mad_mage_user::file, get_elevation_color(), infomap, MAX_BUF, output_extensions, output_format, python_init::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

Generates a big world map.

Definition at line 1778 of file mapper.cpp.

References smoking_pipe::color, mad_mage_user::file, infomap, give::name, OF_PNG, make_face_from_files::out, output_extensions, output_format, region_allocated, regions, root, save_picture(), SIZE, struct_region_info::sum, struct_region_info::sum_x, struct_region_info::sum_y, world_map, diamondslots::x, and diamondslots::y.

Referenced by main().

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

◆ 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 3047 of file mapper.cpp.

References autojail::value.

Referenced by main().

+ Here is the caller graph for this function:

Variable Documentation

◆ all_data

nlohmann::json all_data
static

All JSON data available to templates.

Definition at line 2217 of file mapper.cpp.

Referenced by main().

◆ cached_pics

int cached_pics = 0
static

Non recreated pics.

Definition at line 329 of file mapper.cpp.

Referenced by main(), and process_map().

◆ color_blocking

int color_blocking
static

Block all movement.

Definition at line 377 of file mapper.cpp.

Referenced by do_exit_map(), and main().

◆ color_linked_exit

int color_linked_exit
static

Exit leading to another map.

Definition at line 375 of file mapper.cpp.

Referenced by do_exit_map(), and main().

◆ color_road

int color_road
static

Road or equivalent.

Definition at line 376 of file mapper.cpp.

Referenced by do_exit_map(), and main().

◆ color_slowing

int color_slowing
static

Slows movement.

Definition at line 378 of file mapper.cpp.

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 374 of file mapper.cpp.

Referenced by do_exit_map(), and main().

◆ created_pics

int created_pics = 0
static

Picture statistics. Total created pics.

Definition at line 328 of file mapper.cpp.

Referenced by main(), and process_map().

◆ detail_quests

bool detail_quests = false
static

Whether to show all quests details or not.

Definition at line 323 of file mapper.cpp.

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

◆ display_rendered_template

bool display_rendered_template = false
static

Whether to display the template to be rendered or not.

Definition at line 325 of file mapper.cpp.

Referenced by do_parameters(), and main().

◆ do_regions_link

bool do_regions_link = false
static

Definition at line 385 of file mapper.cpp.

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

◆ elevation_info

int** elevation_info
static

All elevation spots in the "world_" maps.

Definition at line 380 of file mapper.cpp.

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

◆ elevation_max

int elevation_max
static

Lowest elevation found.

Definition at line 382 of file mapper.cpp.

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 381 of file mapper.cpp.

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

◆ env

◆ equipment_allocated

size_t equipment_allocated = 0
static

Allocated items in special_equipment.

Definition at line 254 of file mapper.cpp.

Referenced by ensure_unique().

◆ equipment_count

size_t equipment_count = 0
static

Number of items in special_equipment.

Definition at line 252 of file mapper.cpp.

Referenced by ensure_unique(), fill_json(), and main().

◆ force_pics

int force_pics = 0
static

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

Definition at line 313 of file mapper.cpp.

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

◆ found_maps

char** found_maps = NULL
static

Maps found in directories.

Definition at line 368 of file mapper.cpp.

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 370 of file mapper.cpp.

Referenced by find_maps().

◆ found_maps_count

int found_maps_count = 0
static

Number of items in found_maps.

Definition at line 369 of file mapper.cpp.

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

◆ gdfaces

gdImagePtr* gdfaces
static

Definition at line 173 of file mapper.cpp.

Referenced by main(), and process_map().

◆ generate_pics

int generate_pics = 1
static

Whether to generate the picture or not.

Definition at line 312 of file mapper.cpp.

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 2767 of file mapper.cpp.

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 2756 of file mapper.cpp.

Referenced by find_maps().

◆ infomap

gdImagePtr infomap
static

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

Definition at line 373 of file mapper.cpp.

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 347 of file mapper.cpp.

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

◆ list_system_quests

bool list_system_quests = false
static

Whether to show 'system' quests or not.

Definition at line 324 of file mapper.cpp.

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

◆ 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 367 of file mapper.cpp.

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

◆ map_limit

int map_limit = -1
static

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

Definition at line 318 of file mapper.cpp.

Referenced by do_parameters(), and main().

◆ maps_list

struct_map_list maps_list
static

◆ num_sizes

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

Definition at line 315 of file mapper.cpp.

Referenced by process_map(), tiled_map_need_pic(), and write_pictures_from_real_size().

◆ output_extensions

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

Extensions depending on output format.

Definition at line 338 of file mapper.cpp.

Referenced by generate_picture_link(), generate_picture_path(), main(), write_world_info(), and write_world_map().

◆ output_format

enum output_format_type output_format = OF_PNG
static

◆ pages

std::vector<pageToRender> pages
static

List of pages to render.

Definition at line 2632 of file mapper.cpp.

Referenced by add_template_to_render(), and main().

◆ path_stack

std::vector<std::string> path_stack
static

Path, relative to output root, of pages being generated.

Definition at line 2550 of file mapper.cpp.

Referenced by init_renderer_env(), main(), and path_from_current().

◆ pics_allocated

int pics_allocated
static

Number of created pictures for GD.

Definition at line 309 of file mapper.cpp.

Referenced by main(), and process_map().

◆ quests

struct_quest** quests = NULL
static

◆ quests_allocated

int quests_allocated = 0
static

Allocated items in quests.

Definition at line 920 of file mapper.cpp.

Referenced by get_quest_info().

◆ quests_count

int quests_count = 0
static

Count of quests.

Definition at line 918 of file mapper.cpp.

Referenced by fill_json(), find_quest_info(), get_quest_info(), main(), and quest_display().

◆ races

struct_race_list races
static

Monsters found in maps.

Definition at line 264 of file mapper.cpp.

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

◆ rawmaps

int rawmaps = 0
static

Whether to generate raw pics or instancied ones.

Definition at line 350 of file mapper.cpp.

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

◆ region_allocated

size_t region_allocated = 0
static

Allocated size of regions.

Definition at line 365 of file mapper.cpp.

Referenced by add_map_to_region(), and write_world_map().

◆ region_count

size_t region_count = 0
static

Count of regions.

Definition at line 364 of file mapper.cpp.

Referenced by add_map_to_region(), fill_json(), fix_exits_to_tiled_maps(), and main().

◆ region_links

std::map<region *, std::set<region *> > region_links
static

Definition at line 387 of file mapper.cpp.

Referenced by add_region_link(), and fill_json().

◆ regions

struct struct_region_info** regions = NULL
static

Found regions.

Definition at line 363 of file mapper.cpp.

Referenced by add_map_to_region(), create_region_array(), fill_json(), fix_exits_to_tiled_maps(), main(), and write_world_map().

◆ rendered_templates

std::set<std::string> rendered_templates
static

List of generated files, to not generate multiple times.

Definition at line 2218 of file mapper.cpp.

Referenced by add_template_to_render().

◆ reverse_maps

std::map<struct_map_info *, std::string> reverse_maps
static

Link between a map and its unique identifier.

Definition at line 2219 of file mapper.cpp.

Referenced by create_map_in_quest_array(), create_maps_array(), create_quest_object(), fill_json(), fill_reverse_maps(), and find_map_by_key().

◆ reverse_regions

std::map<region *, std::string> reverse_regions
static

Link between a region and its unique identifier.

Definition at line 2220 of file mapper.cpp.

Referenced by create_map_object(), create_region_array(), fill_json(), and find_region_by_key().

◆ root

◆ show_maps

int show_maps = 0
static

If set, will generate much information on map loaded.

Definition at line 319 of file mapper.cpp.

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

◆ sizes

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

Definition at line 314 of file mapper.cpp.

Referenced by write_pictures_from_real_size().

◆ slaying_allocated

size_t slaying_allocated = 0
static

Allocated size of slaying_info.

Definition at line 405 of file mapper.cpp.

Referenced by get_slaying_struct().

◆ slaying_count

size_t slaying_count = 0
static

Count of items in slaying_info.

Definition at line 404 of file mapper.cpp.

Referenced by fill_json(), get_slaying_struct(), and main().

◆ slaying_info

struct_slaying_info** slaying_info = NULL
static

Found slaying fields.

Definition at line 403 of file mapper.cpp.

Referenced by fill_json(), get_slaying_struct(), and main().

◆ special_equipment

struct_equipment** special_equipment = NULL
static

Special equipment list.

Definition at line 250 of file mapper.cpp.

Referenced by ensure_unique(), fill_json(), and main().

◆ system_quests

const quest_definition* system_quests[500]
static

Definition at line 2200 of file mapper.cpp.

Referenced by fill_json(), main(), and quest_callback().

◆ system_quests_count

size_t system_quests_count = 0
static

Definition at line 2199 of file mapper.cpp.

Referenced by fill_json(), main(), and quest_callback().

◆ templateCache

inja::TemplateStorage templateCache
static

Definition at line 3051 of file mapper.cpp.

Referenced by get_template().

◆ templates

std::vector<std::string> templates
static

List of template files to start processing from.

Definition at line 2667 of file mapper.cpp.

Referenced by do_parameters(), and main().

◆ tiled_map_list

struct_map_list tiled_map_list
static

Pseudo-maps grouping other maps.

Definition at line 239 of file mapper.cpp.

Referenced by create_tiled_map(), fill_json(), 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 322 of file mapper.cpp.

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 353 of file mapper.cpp.

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 321 of file mapper.cpp.

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 320 of file mapper.cpp.

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