Crossfire Server, Trunk  R20513
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
mapper.c File Reference

This program generates map browsing web pages. More...

#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 <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
 One special item (weapon, shield, ...). More...
 
struct  struct_map_in_quest
 Link between a quest and a map. More...
 
struct  struct_map_in_quest_list
 Utility structure to group map-quest link structure. More...
 
struct  struct_map_info
 Map information. More...
 
struct  struct_map_list
 List of maps. More...
 
struct  struct_npc_info
 Information about a NPC with a custom message. More...
 
struct  struct_npc_list
 List of NPCs with a custom message. More...
 
struct  struct_quest
 One quest. More...
 
struct  struct_race
 One monster race in the maps. More...
 
struct  struct_race_list
 Collection of races. More...
 
struct  struct_region_info
 Region information. More...
 
struct  struct_slaying_info
 slaying information. More...
 

Macros

#define S_CONNECT   4
 
#define S_CONTAINER   2
 
#define S_DETECTOR   3
 
#define S_DOOR   0
 Connection/slaying information. More...
 
#define S_KEY   1
 
#define S_MAX   5
 
#define SIZE   50
 
#define VARSADD   6
 

Typedefs

typedef struct struct_equipment struct_equipment
 One special item (weapon, shield, ...). More...
 
typedef struct struct_map_in_quest struct_map_in_quest
 Link between a quest and a map. More...
 
typedef struct struct_map_info struct_map_info
 Map information. More...
 
typedef struct struct_npc_info struct_npc_info
 Information about a NPC with a custom message. More...
 
typedef struct struct_npc_list struct_npc_list
 List of NPCs with a custom message. More...
 
typedef struct struct_quest struct_quest
 One quest. More...
 
typedef struct struct_race struct_race
 One monster race in the maps. More...
 
typedef struct struct_race_list struct_race_list
 Collection of races. More...
 
typedef struct struct_region_info struct_region_info
 Region information. More...
 

Enumerations

enum  output_format_type { OF_PNG = 0, OF_JPG = 1 }
 Map output formats. More...
 

Functions

static void add_map (struct_map_info *info, struct_map_list *list)
 Adds a map to specified array, if it isn't already. More...
 
static void add_map_to_quest (struct_map_info *map, const char *name, const char *description)
 Links a map to a quest. More...
 
static void add_map_to_region (struct_map_info *map, region *reg)
 Links a map to a region. More...
 
static void add_map_to_slaying (struct_slaying_info *info, int item, struct_map_info *map)
 Adds the specified map to the slaying information if not already present. More...
 
static void add_monster (object *monster, struct_map_info *map)
 Adds a monster to the monster list. More...
 
static void add_npc_to_map (struct_npc_list *list, const object *npc)
 Add the specified NPC to the list. More...
 
static void add_one_item (object *item, struct_map_info *map)
 Adds an item to the list of special items. More...
 
static void add_race_to_list (struct_race *race, struct_race_list *list, int check)
 Appends a race to a race list. More...
 
static void add_region_link (mapstruct *source, mapstruct *dest, const char *linkname)
 Creates a link between two maps if they are on different regions. More...
 
static void add_slaying (struct_map_info *map, object *item)
 Adds the item's information to the map. More...
 
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)
 Map was just loaded, handle op's initialization. More...
 
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). More...
 
static char * cat_template (char *source, char *add)
 Concatenates a string, and free concatenated string. More...
 
static void check_equipment (object *item, struct_map_info *map)
 Checks if item and its inventory are worthy to be listed. More...
 
static void check_slaying_inventory (struct_map_info *map, object *item)
 Recursively checks if the object should be considered for slaying information. More...
 
void clean_tmp_files (void)
 Remove temporary map files. More...
 
static int compare_map_info (const struct_map_info *left, const struct_map_info *right)
 Compares struct_map_info according to the map name or the path if equal. More...
 
static void create_destination (void)
 Ensures destination directory exists. More...
 
static struct_map_infocreate_map_info (void)
 Returns an initialised struct_map_info. More...
 
static struct_npc_infocreate_npc_info (const object *npc)
 Create the struct_npc_info from the specified NPC. More...
 
static struct_map_infocreate_tiled_map (void)
 Create a new tiled map and link it to the tiled map list. More...
 
static void define_quest (const char *name, struct_map_info *mainmap, const char *description)
 Sets the main map for a quest. More...
 
void do_auto_apply (mapstruct *m)
 
static void do_exit_map (mapstruct *map)
 Proceses exit / road / blocking information for specified map into the global infomap map. More...
 
static void do_help (const char *program)
 Prints usage information, and exit. More...
 
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)
 Creates the page for a map index. More...
 
static void do_parameters (int argc, char **argv)
 Handles command-line parameters. More...
 
static char * do_template (const char *template, const char **vars, const char **values)
 Processes a template. More...
 
static void do_tiled_map_picture (struct_map_info *map)
 Generates the large and small pictures for a tiled map. More...
 
void dragon_ability_gain (object *ob, int x, int y)
 When a dragon-player gains a new stage of evolution, he gets some treasure. More...
 
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. More...
 
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). More...
 
static void dump_unused_maps (void)
 Writes the list of unused maps, maps found in the directories but not linked from the other maps. More...
 
void emergency_save (int x)
 Save all players. More...
 
static struct_equipmentensure_unique (struct_equipment *item)
 Searches the item list for an identical item, except maps. More...
 
void esrv_del_item (player *pl, object *ob)
 Tells the client to delete an item. More...
 
void esrv_send_item (object *ob, object *obx)
 Sends item's info to player. More...
 
void esrv_update_item (int flags, object *pl, object *op)
 Updates object *op for player *pl. More...
 
void esrv_update_spells (player *pl)
 This looks for any spells the player may have that have changed their stats. More...
 
int execute_event (object *op, int eventcode, object *activator, object *third, const char *message, int fix)
 
int execute_global_event (int eventcode,...)
 
void ext_info_map (int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1)
 Writes to everyone on the specified map. More...
 
static void find_maps (const char *from)
 Recursively find all all maps in a directory. More...
 
objectfind_skill_by_number (object *who, int skillno)
 This returns the skill pointer of the given name (the one that accumulates exp, has the level, etc). More...
 
static void fix_exits_for_map (struct_map_info *current, struct_map_list *from, int is_from)
 Changes for the list all maps to the tiled map they are part of, if applicable. More...
 
static void fix_exits_to_tiled_maps (void)
 Changes all exits to maps in a tiled map to point directly to the tiled map. More...
 
static void fix_map_names (void)
 Ensures all maps have a name (if there was a limit to map processing, some maps will have a NULL name which causes issues). More...
 
static void fix_tiled_map (void)
 Ensures all tiled maps have a name, a region, a filename and a path. More...
 
static void fix_tiled_map_monsters (void)
 Makes all monsters point to tiled maps instead of map when appliable, and merge map monster to tiled map. More...
 
static void free_equipment (struct_equipment *equip)
 Frees a struct_equipment. More...
 
static int get_elevation_color (int elevation, gdImagePtr elevationmap)
 Gets the color for an elevation. More...
 
static struct_equipmentget_equipment (void)
 Gets an empty struct_equipment. More...
 
static struct_map_infoget_map_info (const char *path)
 Gets or creates if required the info structure for a map. More...
 
static struct_questget_quest_info (const char *name)
 Gets the information for a quest, create the field if needed. More...
 
static struct_raceget_race (const char *name)
 Returns the race for specified name. More...
 
static struct_slaying_infoget_slaying_struct (const char *slaying)
 Returns a struct_slaying_info for specified slaying. More...
 
static void init_map_list (struct_map_list *list)
 Initialises a list structure. More...
 
static void init_npc_list (struct_npc_list *list)
 Initialise a list of NPCs. More...
 
static void init_race_list (struct_race_list *list)
 Blanks a struct_race_list. More...
 
static void init_struct_map_in_quest_list (struct_map_in_quest_list *list)
 
static int is_blocking (object *item)
 Checks if item blocks movement or not. More...
 
static int is_road (object *item)
 Checks if object is considered a road or not. More...
 
static int is_slaying (object *item)
 Is the slaying field relevant for this item? More...
 
static int is_special_equipment (object *item)
 
static void list_map (const char *path)
 Marks specified path as processed. More...
 
int main (int argc, char **argv)
 
static void merge_tiled_maps (struct_map_info *map, int tile, struct_map_info *tiled_map)
 Merge two tiled maps groups. More...
 
void move_firewall (object *ob)
 Move for FIREWALL. More...
 
static void process_map (struct_map_info *info)
 Processes a map. More...
 
static void process_map_lore (struct_map_info *map)
 Extracts from the map's lore quest information if found. More...
 
static void read_template (const char *name, char **buffer)
 Reads a file in memory. More...
 
static void relative_path (const char *from, const char *to, char *result)
 Computes the shortest path from one file to another. More...
 
void rod_adjust (object *rod)
 Adjusts rod attributes. More...
 
static void save_picture (FILE *file, gdImagePtr pic)
 Saves a map to a file, based on jpg/png settings. More...
 
void set_darkness_map (mapstruct *m)
 Set the darkness level for a map, based on the time of the day. More...
 
static int sort_equipment (const void *a, const void *b)
 Sort 2 struct_equipment, first on item power then name. More...
 
static int sort_map_info (const void *left, const void *right)
 Sorts the struct_map_info according to the map name or the path if equal. More...
 
static int sort_map_info_by_level (const void *left, const void *right)
 Sorts the struct_map_info according to the map's level, and if equal the name or the path. More...
 
static int sort_mapname (const void *left, const void *right)
 Sorts the strings according to the last part of the filename (after the last /). More...
 
static int sort_race (const void *a, const void *b)
 Sort 2 struct_race. More...
 
static int sort_region (const void *left, const void *right)
 Sorts an array of struct_region_info by region name. More...
 
static int sort_slaying (const void *left, const void *right)
 Helper function to sort an array of struct_slaying_info. More...
 
static int sort_struct_map_in_quest (const void *left, const void *right)
 Sorts 2 struct_map_in_quest, on the map's name or path. More...
 
static int sortbyname (const void *a, const void *b)
 Sort values alphabetically Used by qsort to sort values alphabetically. More...
 
static int tiled_map_need_pic (struct_map_info *map)
 
static void write_all_maps (void)
 Ensures all maps have a name, and writes all map pages. More...
 
static void write_all_regions (void)
 Generates all map indexes for a region. More...
 
static void write_equipment_index (void)
 Writes the item page. More...
 
static void write_map_page (struct_map_info *map)
 Write a map page. More...
 
static void write_maps_by_level (void)
 Outputs the list of maps sorted by level. More...
 
static void write_maps_index (void)
 Generates global map index, file maps.html. More...
 
static void write_npc_list (void)
 Write the list of all found NPCs in maps. More...
 
static void write_one_slaying_info (FILE *file, struct_slaying_info *info, int item, const char *with, const char *without)
 Writes all maps of the specified slaying information. More...
 
static void write_quests_page (void)
 Writes the global quests page. More...
 
static void write_race_index (void)
 Writes the monster information page. More...
 
static void write_readable_list (void)
 Write the list of all found SIGN and BOOK in maps. More...
 
static void write_region_index (void)
 Generates region index. More...
 
static void write_region_page (struct_region_info *reg)
 Generates the web page for a region. More...
 
static void write_regions_link (void)
 Write the .dot file representing links between regions. More...
 
static void write_slaying_info (void)
 Writes all slaying info to file. More...
 
static void write_slaying_map_name (FILE *file, struct_map_info *map)
 Helper function to write a map to a file with its link and full path. More...
 
static void write_tiled_map_page (struct_map_info *map)
 Writes the page for a tiled map group. More...
 
static void write_tiled_maps (void)
 Outputs all tiled map pages. More...
 
static void write_world_info (void)
 Writes the exit information world map. More...
 
static void write_world_map (void)
 Generates a big world map. More...
 
static const char * yesno (int value)
 Helper to write yes/no. More...
 

Variables

static int cached_pics = 0
 Non recreated pics. More...
 
static int color_blocking
 Block all movement. More...
 
static int color_linked_exit
 Exit leading to another map. More...
 
static int color_road
 Road or equivalent. More...
 
static int color_slowing
 Slows movement. More...
 
static int color_unlinked_exit
 Color for exits without a path set. More...
 
static int created_pics = 0
 Picture statistics. More...
 
static int do_regions_link = 0
 
static int ** elevation_info
 All elevation spots in the "world_" maps. More...
 
static int elevation_max
 Lowest elevation found. More...
 
static int elevation_min
 Maximal elevation found. More...
 
static int equipment_allocated = 0
 Allocated items in special_equipment. More...
 
static int equipment_count = 0
 Number of items in special_equipment. More...
 
static int force_pics = 0
 To force picture regeneration even if map didn't change. More...
 
static char ** found_maps = NULL
 Maps found in directories. More...
 
static int found_maps_allocated = 0
 Allocated size of found_maps. More...
 
static int found_maps_count = 0
 Number of items in found_maps. More...
 
static gdImagePtr * gdfaces
 
static int generate_index = 1
 Whether to do the map index or not. More...
 
static int generate_pics = 1
 Whether to generate the picture or not. More...
 
static const char * ignore_name []
 File names to ignore for map search. More...
 
static const char * ignore_path []
 Directories to ignore for map search. More...
 
static char * index_letter
 Index page template: one letter, including the maps it contains. More...
 
static char * index_map
 Index page template: one map. More...
 
static char * index_quest_template
 
static char * index_region_region_template
 One region in the region index template. More...
 
static char * index_region_template
 Region index template. More...
 
static char * index_template
 Index page template. More...
 
static gdImagePtr infomap
 World map with exits / roads / blocking / ... More...
 
static int jpeg_quality = -1
 Quality for jpg pictures. More...
 
static char * level_map_template
 
static char * level_template
 
static char * level_value_template
 
static int list_unused_maps = 0
 If set, program will list maps found in directory but not linked from the first maps. More...
 
static char * map_exit_template
 Map template: one exit. More...
 
static char * map_exit_to_template
 Map template: one exit leading to this map. More...
 
static int map_limit = -1
 Maximum number of maps to browse, -1 for all. More...
 
static char * map_lore_template
 Map template: lore. More...
 
static char * map_monster_after_template
 Map template: after the monster list. More...
 
static char * map_monster_before_template
 Map template: before the monster list. More...
 
static char * map_monster_between_template
 Map template: between each monster. More...
 
static char * map_monster_one_template
 Map template: one monster. More...
 
static char * map_no_exit_template
 World map template: no exit. More...
 
static char * map_no_exit_to_template
 World map template: no exit leading to this map. More...
 
static char * map_no_lore_template
 Map template: no lore. More...
 
static char * map_no_monster_template
 Map template: no monster. More...
 
static char * map_no_quest_template
 
static char * map_one_quest_template
 
static char * map_template
 Map template. More...
 
static char * map_with_exit_template
 Map template: exit template. More...
 
static char * map_with_exit_to_template
 Map template: exits leading to this map. More...
 
static char * map_with_quests_template
 
static struct_map_list maps_list
 Maps to process or found. More...
 
static const char * output_extensions []
 Extensions depending on output format. More...
 
static enum output_format_type output_format = OF_PNG
 Selected output format. More...
 
static int pics_allocated
 Number of created pictures for GD. More...
 
static char * quest_map_template
 
static char * quest_template
 
static struct_quest ** quests = NULL
 All quests in the game. More...
 
static int quests_allocated = 0
 Allocated items in quests. More...
 
static int quests_count = 0
 Count of quests. More...
 
static struct_race_list races
 Monsters found in maps. More...
 
static int rawmaps = 0
 Whether to generate raw pics or instancied ones. More...
 
static int region_allocated = 0
 Allocated size of regions. More...
 
static int region_count = 0
 Count of regions. More...
 
static char * region_letter_template
 One letter for the region. More...
 
static char * region_map_template
 Region page template: one map. More...
 
static char * region_template
 Region page template. More...
 
static struct struct_region_info ** regions = NULL
 Found regions. More...
 
static char ** regions_link
 
static int regions_link_allocated = 0
 
static int regions_link_count = 0
 
static char root [500]
 Path to store generated files. More...
 
static int show_maps = 0
 If set, will generate much information on map loaded. More...
 
static int size_small = 16
 Tile size for small map. More...
 
static int slaying_allocated = 0
 Allocated size of slaying_info. More...
 
static int slaying_count = 0
 Count of items in slaying_info. More...
 
static struct_slaying_info ** slaying_info = NULL
 Found slaying fields. More...
 
static struct_equipment ** special_equipment = NULL
 Special equipment list. More...
 
static struct_map_list tiled_map_list
 Pseudo-maps grouping other maps. More...
 
static int tileset = 0
 Tileset to use to generate pics. More...
 
static int warn_no_path = 0
 Whether to warn of exits without a path. More...
 
static int world_exit_info = 1
 If set, will generate a world map of exits. More...
 
static int world_map = 1
 If set, will generate a world map. More...
 
static char * world_map_template
 One map in a row. More...
 
static char * world_row_template
 One row in the world map. More...
 
static char * world_template
 World map template. More...
 

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:

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:

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

To build this program, from the utils directory:

gcc mapper.c -I../include ../common/libcross.a -o mapper -lm -lgd
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

#define S_CONNECT   4

Definition at line 491 of file mapper.c.

Referenced by add_slaying(), and write_slaying_info().

#define S_CONTAINER   2

Definition at line 489 of file mapper.c.

Referenced by add_slaying(), and write_slaying_info().

#define S_DETECTOR   3

Definition at line 490 of file mapper.c.

#define S_DOOR   0

Connection/slaying information.

Definition at line 487 of file mapper.c.

Referenced by add_slaying(), and write_slaying_info().

#define S_KEY   1

Definition at line 488 of file mapper.c.

Referenced by add_slaying(), and write_slaying_info().

#define S_MAX   5

Definition at line 492 of file mapper.c.

Referenced by get_slaying_struct().

#define SIZE   50

Referenced by write_world_map().

#define VARSADD   6

Referenced by do_map_index().

Typedef Documentation

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

Link between a quest and a map.

Map information.

Information about a NPC with a custom message.

List of NPCs with a custom message.

typedef struct struct_quest struct_quest

One quest.

typedef struct struct_race struct_race

One monster race in the maps.

Collection of races.

Region information.

Enumeration Type Documentation

Map output formats.

Enumerator
OF_PNG 

PNG, default value.

OF_JPG 

JPG.

Definition at line 428 of file mapper.c.

Function Documentation

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 1530 of file mapper.c.

References struct_map_list::allocated, struct_map_list::count, and struct_map_list::maps.

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

Here is the caller graph for this function:

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 1258 of file mapper.c.

References add_to_struct_map_in_quest_list(), struct_map_in_quest::description, get_quest_info(), struct_map_in_quest::map, struct_quest::maps, struct_map_in_quest::quest, struct_map_info::quests, and strdup().

Referenced by process_map_lore().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1676 of file mapper.c.

References add_map(), struct_region_info::is_world, struct_map_info::path, struct_region_info::reg, region_allocated, region_count, struct_region_info::sum, struct_region_info::sum_x, struct_region_info::sum_y, struct_npc_info::x, and struct_npc_info::y.

Referenced by process_map().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1809 of file mapper.c.

References add_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:

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 740 of file mapper.c.

References add_map(), add_race_to_list(), get_race(), obj::head, obj::level, MAX, struct_map_info::max_monster, MIN, struct_map_info::min_monster, struct_map_info::monsters, 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:

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 1508 of file mapper.c.

References struct_npc_list::allocated, struct_npc_list::count, create_npc_info(), and struct_npc_list::npc.

Referenced by process_map().

Here is the call graph for this function:

Here is the caller graph for this function:

static void add_one_item ( object item,
struct_map_info map 
)
static
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 346 of file mapper.c.

References struct_race_list::allocated, struct_race_list::count, and struct_race_list::races.

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

Here is the caller graph for this function:

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 1726 of file mapper.c.

References get_region_by_map(), regiondef::name, regions_link, regions_link_allocated, regions_link_count, snprintf, and strdup().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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 1821 of file mapper.c.

References add_map_to_slaying(), CONTAINER, get_slaying_struct(), LOCKED_DOOR, S_CONNECT, S_CONTAINER, S_DOOR, S_KEY, obj::slaying, SPECIAL_KEY, and obj::type.

Referenced by check_slaying_inventory(), and process_map().

Here is the call graph for this function:

Here is the caller graph for this function:

static void add_to_struct_map_in_quest_list ( struct_map_in_quest_list list,
struct_map_in_quest item 
)
static

Definition at line 1210 of file mapper.c.

References struct_map_in_quest_list::allocated, struct_map_in_quest_list::count, and struct_map_in_quest_list::list.

Referenced by add_map_to_quest().

Here is the caller graph for this function:

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.
Note
auto_apply() has been renamed to apply_auto()

Definition at line 3992 of file mapper.c.

References BOOK, CLEAR_FLAG, create_treasure(), mapdef::difficulty, obj::env, liv::exp, FLAG_AUTO_APPLY, FLAG_CURSED, FLAG_DAMNED, FLAG_IS_A_TEMPLATE, FLAG_UNPAID, FOR_INV_FINISH, FOR_INV_PREPARE, generate_treasure(), HAS_RANDOM_ITEMS, liv::hp, identify(), obj::map, MAX, object_free_drop_inventory(), object_insert_in_map_at(), object_insert_in_ob(), object_remove(), QUERY_FLAG, obj::randomitems, SET_FLAG, SHOP_FLOOR, obj::stats, TREASURE, obj::type, obj::x, and obj::y.

Referenced by do_auto_apply().

Here is the call graph for this function:

Here is the caller graph for this function:

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.
Note
fix_auto_apply() has been renamed to apply_auto_fix()

Go through the entire map (only the first time when an original map is loaded) and performs special actions for certain objects (most initialization of chests and creation of treasures and stuff).

Added as part of glue cleaning. Ryo 2005-07-15

Definition at line 4044 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:

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 908 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:

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 676 of file mapper.c.

References add_one_item(), FOR_INV_FINISH, FOR_INV_PREPARE, and is_special_equipment().

Referenced by process_map().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1847 of file mapper.c.

References add_slaying(), FOR_INV_FINISH, FOR_INV_PREPARE, and is_slaying().

Referenced by process_map().

Here is the call graph for this function:

Here is the caller graph for this function:

void clean_tmp_files ( void  )

Remove temporary map files.

Todo:
check logic, why is file only removed if map is in memory?

Definition at line 3953 of file mapper.c.

Referenced by fatal(), and LOG().

Here is the caller graph for this function:

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 1114 of file mapper.c.

References 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:

static void create_destination ( void  )
static

Ensures destination directory exists.

Definition at line 3631 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:

static struct_map_info* create_map_info ( void  )
static
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 1490 of file mapper.c.

References struct_npc_info::message, obj::msg, struct_npc_info::name, obj::name, strdup(), struct_npc_info::x, obj::x, struct_npc_info::y, and obj::y.

Referenced by add_npc_to_map().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1573 of file mapper.c.

References add_map(), and create_map_info().

Referenced by process_map().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1310 of file mapper.c.

References struct_quest::description, get_quest_info(), struct_quest::mainmap, struct_quest::name, struct_map_info::path, and strdup().

Referenced by process_map_lore().

Here is the call graph for this function:

Here is the caller graph for this function:

void do_auto_apply ( mapstruct m)
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 840 of file mapper.c.

References color_blocking, color_linked_exit, color_road, color_slowing, color_unlinked_exit, do_auto_apply(), elevation_info, elevation_max, elevation_min, EXIT, FOR_MAP_FINISH, FOR_MAP_PREPARE, HEAD, infomap, is_blocking(), is_road(), MAP_HEIGHT, MAP_WIDTH, MAX, MIN, obj::move_slow, object_get_value(), mapdef::path, obj::slaying, TELEPORTER, obj::type, struct_npc_info::x, and struct_npc_info::y.

Referenced by process_map().

Here is the call graph for this function:

Here is the caller graph for this function:

static void do_help ( const char *  program)
static

Prints usage information, and exit.

Parameters
programprogram path.

Definition at line 3530 of file mapper.c.

Referenced by do_parameters().

Here is the caller graph for this function:

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 2132 of file mapper.c.

References cat_template(), struct_map_list::count, do_template(), generate_index, struct_map_list::maps, struct_map_info::name, struct_map_info::path, relative_path(), snprintf, sort_map_info(), strdup(), struct_map_info::tiled_group, 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:

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 3563 of file mapper.c.

References add_map(), do_help(), do_regions_link, force_pics, generate_index, generate_pics, get_map_info(), jpeg_quality, list_unused_maps, map_limit, OF_JPG, output_format, rawmaps, root, show_maps, snprintf, 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:

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 979 of file mapper.c.

References strdup().

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 call graph for this function:

Here is the caller graph for this function:

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 2901 of file mapper.c.

References struct_map_list::count, generate_pics, struct_map_info::height, struct_map_list::maps, struct_map_info::name, OF_PNG, output_extensions, output_format, struct_map_info::path, struct_map_info::processed, root, save_picture(), size_small, snprintf, tiled_map_need_pic(), struct_map_info::tiled_maps, struct_map_info::tiled_x_from, struct_map_info::tiled_y_from, struct_map_info::tiles, and struct_map_info::width.

Referenced by write_tiled_map_page().

Here is the call graph for this function:

Here is the caller graph for this function:

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 3959 of file mapper.c.

Referenced by dragon_level_gain().

Here is the caller graph for this function:

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.

Sends message to player(s).

Definition at line 3931 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_addexp(), command_afk(), command_arrest(), command_banish(), command_body(), command_bowmode(), command_brace(), command_create(), command_diff(), command_drop(), command_dropall(), command_dump(), command_dumpbelow(), command_empty(), command_fire(), command_follow(), command_forget_spell(), command_free(), command_freeze(), command_goto(), command_gsay(), command_help(), command_insert_into(), command_inventory(), command_invisible(), command_kill_pets(), command_language(), command_learn_spell_or_prayer(), 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_throw(), 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(), dimension_door(), dispel_rune(), display_motd(), display_new_pickup(), display_who_entry(), dm_stack_peek(), dm_stack_pop(), dm_stack_push(), do_hidden_move(), do_skill(), do_skill_attack(), 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_special_food(), emergency_save(), enter_map(), examine(), examine_monster(), execute_word_of_recall(), 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_give(), 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(), magic_wall(), map_info(), mark_item_cmd(), meditate(), monster_can_see_enemy(), monster_communicate(), move_marker(), move_player_attack(), move_symptom(), paralyze_living(), party_help(), 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_help(), 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(), save_player(), scroll_failure(), scroll_type_apply(), send_rules(), server_check_shutdown(), 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(), trap_disarm(), trapdoor_type_move_on(), treasure_type_apply(), trigger_type_apply(), unapply_for_ob(), use_alchemy(), use_oratory(), weapon_improver_type_apply(), write_mark(), write_note(), write_on_item(), write_rune(), write_scroll(), and wrong_password().

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 3935 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(), arch_info(), 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_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_follow(), command_forget_spell(), command_freeze(), command_goto(), 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_nowiz(), 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(), 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_forget_spell(), do_harvest(), do_learn_spell(), 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(), execute_newserver_command(), 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(), 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(), lamp_type_apply(), leave(), lighter_type_apply(), list_players(), look_at(), magic_wall(), 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(), prepare_weapon(), print_tod(), process_object(), process_players1(), 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(), server_check_shutdown(), shop_describe(), shop_inventory_type_apply(), shop_pay_unpaid(), show_matching_spells(), show_skills(), singing(), 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(), use_alchemy(), use_oratory(), use_skill(), worship_forbids_use(), write_note(), write_on_item(), write_rune(), and write_scroll().

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 3267 of file mapper.c.

References found_maps, found_maps_count, root, and snprintf.

Referenced by main().

Here is the caller graph for this function:

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 3950 of file mapper.c.

Referenced by fatal(), and LOG().

Here is the caller graph for this function:

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 563 of file mapper.c.

References struct_equipment::calc_power, struct_equipment::diff, equipment_allocated, equipment_count, free_equipment(), struct_equipment::name, and struct_equipment::power.

Referenced by add_one_item().

Here is the call graph for this function:

Here is the caller graph for this function:

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 3969 of file mapper.c.

Referenced by object_remove(), and transmute_item_to_flower().

Here is the caller graph for this function:

void esrv_send_item ( object ob,
object obx 
)

Sends item's info to player.

Definition at line 3956 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:

void esrv_update_item ( int  flags,
object pl,
object op 
)
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 3975 of file mapper.c.

Referenced by fix_player().

Here is the caller graph for this function:

int execute_event ( object op,
int  eventcode,
object activator,
object third,
const char *  message,
int  fix 
)
int execute_global_event ( int  eventcode,
  ... 
)
void ext_info_map ( int  color,
const mapstruct map,
uint8_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 3943 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:

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 3222 of file mapper.c.

References closedir(), dirent::d_name, Settings::datadir, found_maps, found_maps_allocated, found_maps_count, ignore_name, ignore_path, Settings::mapdir, opendir(), readdir(), S_ISDIR, settings, snprintf, and strdup().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

object* find_skill_by_number ( object who,
int  skillno 
)

This returns the skill pointer of the given name (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 number.

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

Definition at line 3965 of file mapper.c.

Referenced by cost_approx_str(), examine(), god_enchants_weapon(), monster_can_detect_enemy(), object_check_move_on(), price_approx(), and shop_price_buy().

Here is the caller graph for this function:

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 2782 of file mapper.c.

References add_map(), struct_map_list::count, struct_map_info::exits_from, struct_map_info::exits_to, struct_map_list::maps, 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:

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 2801 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(), struct_map_list::maps, struct_region_info::maps_list, region_count, 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:

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 2693 of file mapper.c.

References struct_map_list::count, struct_map_info::filename, struct_map_list::maps, struct_map_info::name, and strdup().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

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 2713 of file mapper.c.

References struct_map_info::cfregion, struct_map_list::count, struct_map_info::filename, struct_map_list::maps, struct_npc_info::name, struct_map_info::name, regiondef::name, struct_map_info::path, snprintf, strdup(), and struct_map_info::tiled_maps.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

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 2829 of file mapper.c.

References add_map(), add_race_to_list(), struct_race_list::count, struct_map_list::count, struct_map_list::maps, struct_map_info::monsters, struct_race::origin, struct_race_list::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:

static void free_equipment ( struct_equipment equip)
static

Frees a struct_equipment.

Parameters
equipitem to free.

Definition at line 549 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:

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 825 of file mapper.c.

References elevation_max, and elevation_min.

Referenced by write_world_info().

Here is the caller graph for this function:

static struct_equipment* get_equipment ( void  )
static

Gets an empty struct_equipment.

Returns
new item.

Definition at line 536 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:

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 1625 of file mapper.c.

References add_map(), struct_map_list::count, create_map_info(), struct_map_info::filename, struct_map_list::maps, struct_map_info::path, and strdup().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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 1226 of file mapper.c.

References init_struct_map_in_quest_list(), struct_quest::maps, struct_quest::name, struct_quest::number, quests_allocated, quests_count, and strdup().

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:

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 711 of file mapper.c.

References add_race_to_list(), struct_race_list::count, struct_race::count, init_map_list(), struct_race::name, struct_race::origin, struct_race_list::races, and strdup().

Referenced by add_monster().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1775 of file mapper.c.

References init_map_list(), struct_slaying_info::maps, S_MAX, struct_slaying_info::slaying, slaying_allocated, slaying_count, and strdup().

Referenced by add_slaying().

Here is the call graph for this function:

Here is the caller graph for this function:

static void init_map_list ( struct_map_list list)
static

Initialises a list structure.

Parameters
listlist to blank.

Definition at line 509 of file mapper.c.

References add_map(), struct_map_list::allocated, struct_map_list::count, and struct_map_list::maps.

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

Here is the call graph for this function:

Here is the caller graph for this function:

static void init_npc_list ( struct_npc_list list)
static

Initialise a list of NPCs.

Parameters
listlist to initialise.

Definition at line 1477 of file mapper.c.

References struct_npc_list::allocated, struct_npc_list::count, and struct_npc_list::npc.

Referenced by create_map_info().

Here is the caller graph for this function:

static void init_race_list ( struct_race_list list)
static

Blanks a struct_race_list.

Parameters
listlist to blank.

Definition at line 330 of file mapper.c.

References struct_race_list::allocated, struct_race_list::count, and struct_race_list::races.

Referenced by create_map_info(), and main().

Here is the caller graph for this function:

static void init_struct_map_in_quest_list ( struct_map_in_quest_list list)
static

Definition at line 1204 of file mapper.c.

References struct_map_in_quest_list::allocated, struct_map_in_quest_list::count, and struct_map_in_quest_list::list.

Referenced by create_map_info(), and get_quest_info().

Here is the caller graph for this function:

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 811 of file mapper.c.

References MOVE_ALL, and obj::move_block.

Referenced by do_exit_map().

Here is the caller graph for this function:

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 775 of file mapper.c.

References obj::arch, FLAG_IS_FLOOR, archt::name, and QUERY_FLAG.

Referenced by do_exit_map().

Here is the caller graph for this function:

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 1762 of file mapper.c.

References CHECK_INV, CONTAINER, LOCKED_DOOR, SPECIAL_KEY, and obj::type.

Referenced by check_slaying_inventory(), and process_map().

Here is the caller graph for this function:

static int is_special_equipment ( object item)
static

Definition at line 517 of file mapper.c.

References AMULET, obj::arch, archt::clone, FLAG_NO_PICK, IS_ARMOR, IS_ARROW, IS_SHIELD, IS_WEAPON, MOVE_ALL, obj::move_block, obj::name, QUERY_FLAG, RING, ROD, obj::title, obj::type, and WAND.

Referenced by check_equipment().

Here is the caller graph for this function:

static void list_map ( const char *  path)
static

Marks specified path as processed.

Parameters
pathmap to remove.

Definition at line 1653 of file mapper.c.

References found_maps, and found_maps_count.

Referenced by process_map().

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 3651 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, do_parameters(), do_regions_link, dump_unused_maps(), elevation_info, elevation_max, elevation_min, facesets, regiondef::fallback, 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_map_info(), get_region_struct(), index_letter, index_map, index_quest_template, index_region_region_template, index_region_template, index_template, infomap, init_archetypes(), init_artifacts(), init_formulae(), 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_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, regiondef::name, regiondef::next, nrofpixmaps, OF_JPG, output_extensions, output_format, pics_allocated, process_map(), quest_map_template, quest_template, rawmaps, read_client_images(), read_template(), region_letter_template, region_map_template, region_template, root, settings, show_maps, snprintf, sortbyname(), strdup_local, 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_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().

Referenced by ServiceCtrlHandler(), and ServiceMain().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1591 of file mapper.c.

References add_map(), struct_map_list::count, struct_map_list::maps, struct_map_info::tiled_group, 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:

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 3947 of file mapper.c.

Referenced by legacy_ob_process(), and trigger_connected().

Here is the caller graph for this function:

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 1863 of file mapper.c.

References add_map(), add_map_to_region(), add_monster(), add_npc_to_map(), add_region_link(), add_slaying(), BOOK, cached_pics, struct_map_info::cfregion, check_equipment(), check_slaying_inventory(), archt::clone, create_pathname(), create_tiled_map(), created_pics, face_info::data, delete_map(), mapdef::difficulty, 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, facesets, struct_map_info::filename, find_archetype(), 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, make_path_to_file(), MAP_HEIGHT, MAP_IN_MEMORY, MAP_WIDTH, mapdef::maplore, MAX_BUF, merge_tiled_maps(), obj::msg, struct_map_info::name, mapdef::name, struct_map_info::npcs, object_get_multi_size(), output_extensions, output_format, struct_map_info::path, mapdef::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, root, save_picture(), show_maps, SIGN, size_small, snprintf, strdup(), TELEPORTER, mapdef::tile_path, struct_map_info::tiled_group, struct_map_info::tiled_maps, struct_map_info::tiles, tileset, warn_no_path, struct_map_info::width, struct_npc_info::x, and struct_npc_info::y.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1329 of file mapper.c.

References add_map_to_quest(), define_quest(), struct_map_info::lore, and struct_npc_info::name.

Referenced by process_map().

Here is the call graph for this function:

Here is the caller graph for this function:

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 927 of file mapper.c.

Referenced by main().

Here is the caller graph for this function:

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 1047 of file mapper.c.

Referenced by do_map_index(), and write_map_page().

Here is the caller graph for this function:

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 3978 of file mapper.c.

Referenced by fix_generated_item().

Here is the caller graph for this function:

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 1710 of file mapper.c.

References 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:

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 3962 of file mapper.c.

Referenced by ready_map_name().

Here is the caller graph for this function:

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 693 of file mapper.c.

References struct_equipment::name, struct_equipment::power, and strcasecmp().

Referenced by write_equipment_index().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1139 of file mapper.c.

References compare_map_info().

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:

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 1155 of file mapper.c.

References compare_map_info(), and struct_map_info::level.

Referenced by write_maps_by_level().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1086 of file mapper.c.

References strcasecmp().

Referenced by write_one_slaying_info().

Here is the call graph for this function:

Here is the caller graph for this function:

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 762 of file mapper.c.

References struct_race::name, 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:

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 1174 of file mapper.c.

Referenced by write_all_regions().

Here is the caller graph for this function:

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 3408 of file mapper.c.

References struct_slaying_info::slaying, 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:

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 1280 of file mapper.c.

References struct_map_in_quest::map, struct_map_info::name, struct_map_info::path, 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:

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 894 of file mapper.c.

Referenced by main().

Here is the caller graph for this function:

static int tiled_map_need_pic ( struct_map_info map)
static
static void write_all_maps ( void  )
static

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

Definition at line 2857 of file mapper.c.

References struct_map_list::count, struct_map_list::maps, 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:

static void write_all_regions ( void  )
static

Generates all map indexes for a region.

Definition at line 2300 of file mapper.c.

References region_count, 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:

static void write_equipment_index ( void  )
static

Writes the item page.

Definition at line 3132 of file mapper.c.

References struct_map_list::count, equipment_count, struct_npc_info::name, struct_equipment::origin, root, snprintf, and sort_equipment().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void write_map_page ( struct_map_info map)
static
static void write_maps_by_level ( void  )
static

Outputs the list of maps sorted by level.

Definition at line 3054 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, struct_map_list::maps, struct_npc_info::name, struct_map_info::name, struct_map_info::path, root, snprintf, sort_map_info_by_level(), 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:

static void write_maps_index ( void  )
static

Generates global map index, file maps.html.

Definition at line 2312 of file mapper.c.

References do_map_index(), index_letter, index_map, index_template, and root.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void write_npc_list ( void  )
static

Write the list of all found NPCs in maps.

Definition at line 3457 of file mapper.c.

References struct_npc_list::count, struct_map_list::count, struct_map_list::maps, MAX_BUF, struct_npc_info::message, struct_npc_info::name, struct_npc_list::npc, struct_map_info::npcs, struct_map_info::path, root, slaying_count, snprintf, sort_slaying(), struct_npc_info::x, and struct_npc_info::y.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

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

References struct_map_list::count, 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:

static void write_quests_page ( void  )
static
static void write_race_index ( void  )
static

Writes the monster information page.

Definition at line 3165 of file mapper.c.

References struct_race_list::count, struct_map_list::count, struct_race::count, struct_map_list::maps, struct_npc_info::name, struct_race::name, struct_race::origin, struct_map_info::path, struct_race_list::races, root, snprintf, 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:

static void write_readable_list ( void  )
static

Write the list of all found SIGN and BOOK in maps.

Definition at line 3493 of file mapper.c.

References struct_npc_list::count, struct_map_list::count, struct_map_list::maps, MAX_BUF, struct_npc_info::message, struct_npc_info::name, struct_npc_list::npc, struct_map_info::path, struct_map_info::readable, root, snprintf, struct_npc_info::x, and struct_npc_info::y.

Referenced by main().

Here is the caller graph for this function:

static void write_region_index ( void  )
static

Generates region index.

Definition at line 2334 of file mapper.c.

References cat_template(), do_template(), get_region_longname(), index_region_region_template, index_region_template, regiondef::name, struct_region_info::reg, region_count, root, and snprintf.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

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 2267 of file mapper.c.

References do_map_index(), get_region_longname(), get_region_msg(), 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:

static void write_regions_link ( void  )
static

Write the .dot file representing links between regions.

Definition at line 3332 of file mapper.c.

References do_regions_link, MAX_BUF, regions_link, regions_link_count, root, and snprintf.

Referenced by main().

Here is the caller graph for this function:

static void write_slaying_info ( void  )
static

Writes all slaying info to file.

Definition at line 3418 of file mapper.c.

References struct_map_list::count, struct_slaying_info::maps, MAX_BUF, root, S_CONNECT, S_CONTAINER, S_DOOR, S_KEY, struct_slaying_info::slaying, slaying_count, snprintf, 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:

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

References struct_map_info::name, struct_map_info::path, and struct_map_info::tiled_group.

Referenced by write_one_slaying_info().

Here is the caller graph for this function:

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 3032 of file mapper.c.

References do_tiled_map_picture(), 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:

static void write_tiled_maps ( void  )
static

Outputs all tiled map pages.

Definition at line 3042 of file mapper.c.

References struct_map_list::count, struct_map_list::maps, and write_tiled_map_page().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void write_world_info ( void  )
static

Writes the exit information world map.

Definition at line 3290 of file mapper.c.

References elevation_info, elevation_max, elevation_min, get_elevation_color(), infomap, MAX_BUF, output_extensions, output_format, root, save_picture(), snprintf, world_exit_info, struct_npc_info::x, and struct_npc_info::y.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void write_world_map ( void  )
static

Generates a big world map.

Definition at line 2375 of file mapper.c.

References cat_template(), do_template(), infomap, struct_npc_info::name, OF_PNG, output_extensions, output_format, region_allocated, root, save_picture(), SIZE, snprintf, struct_region_info::sum, struct_region_info::sum_x, struct_region_info::sum_y, world_map, world_map_template, world_row_template, world_template, struct_npc_info::x, and struct_npc_info::y.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

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 3647 of file mapper.c.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

int cached_pics = 0
static

Non recreated pics.

Definition at line 425 of file mapper.c.

Referenced by main(), and process_map().

int color_blocking
static

Block all movement.

Definition at line 473 of file mapper.c.

Referenced by do_exit_map(), and main().

int color_linked_exit
static

Exit leading to another map.

Definition at line 471 of file mapper.c.

Referenced by do_exit_map(), and main().

int color_road
static

Road or equivalent.

Definition at line 472 of file mapper.c.

Referenced by do_exit_map(), and main().

int color_slowing
static

Slows movement.

Definition at line 474 of file mapper.c.

Referenced by do_exit_map(), and main().

int color_unlinked_exit
static

Color for exits without a path set.

Definition at line 470 of file mapper.c.

Referenced by do_exit_map(), and main().

int created_pics = 0
static

Picture statistics.

Total created pics.

Definition at line 424 of file mapper.c.

Referenced by main(), and process_map().

int do_regions_link = 0
static
int** elevation_info
static

All elevation spots in the "world_" maps.

Definition at line 476 of file mapper.c.

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

int elevation_max
static

Lowest elevation found.

Definition at line 478 of file mapper.c.

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

int elevation_min
static

Maximal elevation found.

Definition at line 477 of file mapper.c.

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

int equipment_allocated = 0
static

Allocated items in special_equipment.

Definition at line 313 of file mapper.c.

Referenced by ensure_unique().

int equipment_count = 0
static

Number of items in special_equipment.

Definition at line 311 of file mapper.c.

Referenced by ensure_unique(), and write_equipment_index().

int force_pics = 0
static

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

Definition at line 372 of file mapper.c.

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

char** found_maps = NULL
static

Maps found in directories.

Definition at line 464 of file mapper.c.

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

int found_maps_allocated = 0
static

Allocated size of found_maps.

Definition at line 466 of file mapper.c.

Referenced by find_maps().

int found_maps_count = 0
static

Number of items in found_maps.

Definition at line 465 of file mapper.c.

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

gdImagePtr* gdfaces
static

Definition at line 232 of file mapper.c.

Referenced by main(), and process_map().

int generate_index = 1
static

Whether to do the map index or not.

Definition at line 373 of file mapper.c.

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

int generate_pics = 1
static

Whether to generate the picture or not.

Definition at line 371 of file mapper.c.

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

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

File names to ignore for map search.

Definition at line 3209 of file mapper.c.

Referenced by find_maps().

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

Directories to ignore for map search.

Definition at line 3198 of file mapper.c.

Referenced by find_maps().

char* index_letter
static

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

Definition at line 401 of file mapper.c.

Referenced by main(), and write_maps_index().

char* index_map
static

Index page template: one map.

Definition at line 402 of file mapper.c.

Referenced by main(), and write_maps_index().

char* index_quest_template
static

Definition at line 415 of file mapper.c.

Referenced by main(), and write_quests_page().

char* index_region_region_template
static

One region in the region index template.

Definition at line 409 of file mapper.c.

Referenced by main(), and write_region_index().

char* index_region_template
static

Region index template.

Definition at line 408 of file mapper.c.

Referenced by main(), and write_region_index().

char* index_template
static

Index page template.

Definition at line 400 of file mapper.c.

Referenced by main(), and write_maps_index().

gdImagePtr infomap
static

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

Definition at line 469 of file mapper.c.

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

int jpeg_quality = -1
static

Quality for jpg pictures.

Definition at line 443 of file mapper.c.

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

char* level_map_template
static

Definition at line 413 of file mapper.c.

Referenced by main(), and write_maps_by_level().

char* level_template
static

Definition at line 411 of file mapper.c.

Referenced by main(), and write_maps_by_level().

char* level_value_template
static

Definition at line 412 of file mapper.c.

Referenced by main(), and write_maps_by_level().

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 463 of file mapper.c.

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

char* map_exit_template
static

Map template: one exit.

Definition at line 388 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_exit_to_template
static

Map template: one exit leading to this map.

Definition at line 391 of file mapper.c.

Referenced by main(), and write_map_page().

int map_limit = -1
static

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

Definition at line 375 of file mapper.c.

Referenced by do_parameters(), and main().

char* map_lore_template
static

Map template: lore.

Definition at line 392 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_monster_after_template
static

Map template: after the monster list.

Definition at line 398 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_monster_before_template
static

Map template: before the monster list.

Definition at line 395 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_monster_between_template
static

Map template: between each monster.

Definition at line 396 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_monster_one_template
static

Map template: one monster.

Definition at line 397 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_no_exit_template
static

World map template: no exit.

Definition at line 386 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_no_exit_to_template
static

World map template: no exit leading to this map.

Definition at line 389 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_no_lore_template
static

Map template: no lore.

Definition at line 393 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_no_monster_template
static

Map template: no monster.

Definition at line 394 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_no_quest_template
static

Definition at line 419 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_one_quest_template
static

Definition at line 421 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_template
static

Map template.

Definition at line 385 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_with_exit_template
static

Map template: exit template.

Definition at line 387 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_with_exit_to_template
static

Map template: exits leading to this map.

Definition at line 390 of file mapper.c.

Referenced by main(), and write_map_page().

char* map_with_quests_template
static

Definition at line 420 of file mapper.c.

Referenced by main(), and write_map_page().

struct_map_list maps_list
static

Maps to process or found.

Definition at line 295 of file mapper.c.

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

Extensions depending on output format.

Definition at line 434 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().

enum output_format_type output_format = OF_PNG
static
int pics_allocated
static

Number of created pictures for GD.

Definition at line 368 of file mapper.c.

Referenced by main(), and process_map().

char* quest_map_template
static

Definition at line 417 of file mapper.c.

Referenced by main(), and write_quests_page().

char* quest_template
static

Definition at line 416 of file mapper.c.

Referenced by main(), and write_quests_page().

struct_quest** quests = NULL
static

All quests in the game.

Definition at line 1198 of file mapper.c.

Referenced by write_map_page().

int quests_allocated = 0
static

Allocated items in quests.

Definition at line 1202 of file mapper.c.

Referenced by get_quest_info().

int quests_count = 0
static

Count of quests.

Definition at line 1200 of file mapper.c.

Referenced by get_quest_info(), and write_quests_page().

struct_race_list races
static

Monsters found in maps.

Definition at line 323 of file mapper.c.

int rawmaps = 0
static

Whether to generate raw pics or instancied ones.

Definition at line 446 of file mapper.c.

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

int region_allocated = 0
static

Allocated size of regions.

Definition at line 461 of file mapper.c.

Referenced by add_map_to_region(), and write_world_map().

int region_count = 0
static
char* region_letter_template
static

One letter for the region.

Definition at line 405 of file mapper.c.

Referenced by main(), and write_region_page().

char* region_map_template
static

Region page template: one map.

Definition at line 406 of file mapper.c.

Referenced by main(), and write_region_page().

char* region_template
static

Region page template.

Definition at line 404 of file mapper.c.

Referenced by main(), and write_region_page().

struct struct_region_info** regions = NULL
static

Found regions.

Definition at line 459 of file mapper.c.

Referenced by CREResourcesWindow::fillMaps().

char** regions_link
static

Definition at line 482 of file mapper.c.

Referenced by add_region_link(), and write_regions_link().

int regions_link_allocated = 0
static

Definition at line 484 of file mapper.c.

Referenced by add_region_link().

int regions_link_count = 0
static

Definition at line 483 of file mapper.c.

Referenced by add_region_link(), and write_regions_link().

char root[500]
static
int show_maps = 0
static

If set, will generate much information on map loaded.

Definition at line 376 of file mapper.c.

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

int size_small = 16
static

Tile size for small map.

Definition at line 374 of file mapper.c.

Referenced by do_tiled_map_picture(), and process_map().

int slaying_allocated = 0
static

Allocated size of slaying_info.

Definition at line 502 of file mapper.c.

Referenced by get_slaying_struct().

int slaying_count = 0
static

Count of items in slaying_info.

Definition at line 501 of file mapper.c.

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

struct_slaying_info** slaying_info = NULL
static

Found slaying fields.

Definition at line 500 of file mapper.c.

struct_equipment** special_equipment = NULL
static

Special equipment list.

Definition at line 309 of file mapper.c.

struct_map_list tiled_map_list
static

Pseudo-maps grouping other maps.

Definition at line 298 of file mapper.c.

int tileset = 0
static

Tileset to use to generate pics.

Definition at line 379 of file mapper.c.

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

int warn_no_path = 0
static

Whether to warn of exits without a path.

Definition at line 449 of file mapper.c.

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

int world_exit_info = 1
static

If set, will generate a world map of exits.

Definition at line 378 of file mapper.c.

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

int world_map = 1
static

If set, will generate a world map.

Definition at line 377 of file mapper.c.

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

char* world_map_template
static

One map in a row.

Definition at line 383 of file mapper.c.

Referenced by main(), and write_world_map().

char* world_row_template
static

One row in the world map.

Definition at line 382 of file mapper.c.

Referenced by main(), and write_world_map().

char* world_template
static

World map template.

Definition at line 381 of file mapper.c.

Referenced by main(), and write_world_map().