Freeciv21
Develop your civilization from humble roots to a global empire
mapimg.h File Reference
#include "tile.h"
#include "specenum_gen.h"
+ Include dependency graph for mapimg.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAX_LEN_MAPDEF   256
 
#define SPECENUM_NAME   mapimg_layer
 
#define SPECENUM_VALUE0   MAPIMG_LAYER_AREA
 
#define SPECENUM_VALUE0NAME   "a"
 
#define SPECENUM_VALUE1   MAPIMG_LAYER_BORDERS
 
#define SPECENUM_VALUE1NAME   "b"
 
#define SPECENUM_VALUE2   MAPIMG_LAYER_CITIES
 
#define SPECENUM_VALUE2NAME   "c"
 
#define SPECENUM_VALUE3   MAPIMG_LAYER_FOGOFWAR
 
#define SPECENUM_VALUE3NAME   "f"
 
#define SPECENUM_VALUE4   MAPIMG_LAYER_KNOWLEDGE
 
#define SPECENUM_VALUE4NAME   "k"
 
#define SPECENUM_VALUE5   MAPIMG_LAYER_TERRAIN
 
#define SPECENUM_VALUE5NAME   "t"
 
#define SPECENUM_VALUE6   MAPIMG_LAYER_UNITS
 
#define SPECENUM_VALUE6NAME   "u"
 
#define SPECENUM_COUNT   MAPIMG_LAYER_COUNT
 
#define SPECENUM_COUNTNAME   "-"
 

Typedefs

typedef enum known_type(* mapimg_tile_known_func) (const struct tile *ptile, const struct player *pplayer, bool knowledge)
 
typedef struct terrain *(* mapimg_tile_terrain_func) (const struct tile *ptile, const struct player *pplayer, bool knowledge)
 
typedef struct player *(* mapimg_tile_player_func) (const struct tile *ptile, const struct player *pplayer, bool knowledge)
 
typedef int(* mapimg_plrcolor_count_func) ()
 
typedef struct rgbcolor *(* mapimg_plrcolor_get_func) (int)
 

Functions

void mapimg_init (mapimg_tile_known_func mapimg_tile_known, mapimg_tile_terrain_func mapimg_tile_terrain, mapimg_tile_player_func mapimg_tile_owner, mapimg_tile_player_func mapimg_tile_city, mapimg_tile_player_func mapimg_tile_unit, mapimg_plrcolor_count_func mapimg_plrcolor_count, mapimg_plrcolor_get_func mapimg_plrcolor_get)
 Initialisation of the map image subsystem. More...
 
void mapimg_reset ()
 Reset the map image subsystem. More...
 
void mapimg_free ()
 Free all memory allocated by the map image subsystem. More...
 
int mapimg_count ()
 Return the number of map image definitions. More...
 
char * mapimg_help (const char *cmdname)
 Return a help string for the 'mapimg' command. More...
 
const char * mapimg_error ()
 Returns the last error. More...
 
bool mapimg_define (const char *maparg, bool check)
 Define on map image. More...
 
bool mapimg_delete (int id)
 Delete a map image definition. More...
 
bool mapimg_show (int id, char *str, size_t str_len, bool detail)
 Show a map image definition. More...
 
bool mapimg_id2str (int id, char *str, size_t str_len)
 Return the map image definition 'id' as a mapdef string. More...
 
bool mapimg_create (struct mapdef *pmapdef, bool force, const char *savename, const char *path)
 Create the requested map image. More...
 
bool mapimg_colortest (const char *savename, const char *path)
 Create images which shows all map colors (playercolor, terrain colors). More...
 
struct mapdefmapimg_isvalid (int id)
 Check if a map image definition is valid. More...
 

Macro Definition Documentation

◆ MAX_LEN_MAPDEF

#define MAX_LEN_MAPDEF   256

Definition at line 52 of file mapimg.h.

◆ SPECENUM_COUNT

#define SPECENUM_COUNT   MAPIMG_LAYER_COUNT

Definition at line 71 of file mapimg.h.

◆ SPECENUM_COUNTNAME

#define SPECENUM_COUNTNAME   "-"

Definition at line 72 of file mapimg.h.

◆ SPECENUM_NAME

#define SPECENUM_NAME   mapimg_layer

Definition at line 55 of file mapimg.h.

◆ SPECENUM_VALUE0

#define SPECENUM_VALUE0   MAPIMG_LAYER_AREA

Definition at line 56 of file mapimg.h.

◆ SPECENUM_VALUE0NAME

#define SPECENUM_VALUE0NAME   "a"

Definition at line 57 of file mapimg.h.

◆ SPECENUM_VALUE1

#define SPECENUM_VALUE1   MAPIMG_LAYER_BORDERS

Definition at line 58 of file mapimg.h.

◆ SPECENUM_VALUE1NAME

#define SPECENUM_VALUE1NAME   "b"

Definition at line 59 of file mapimg.h.

◆ SPECENUM_VALUE2

#define SPECENUM_VALUE2   MAPIMG_LAYER_CITIES

Definition at line 60 of file mapimg.h.

◆ SPECENUM_VALUE2NAME

#define SPECENUM_VALUE2NAME   "c"

Definition at line 61 of file mapimg.h.

◆ SPECENUM_VALUE3

#define SPECENUM_VALUE3   MAPIMG_LAYER_FOGOFWAR

Definition at line 62 of file mapimg.h.

◆ SPECENUM_VALUE3NAME

#define SPECENUM_VALUE3NAME   "f"

Definition at line 63 of file mapimg.h.

◆ SPECENUM_VALUE4

#define SPECENUM_VALUE4   MAPIMG_LAYER_KNOWLEDGE

Definition at line 64 of file mapimg.h.

◆ SPECENUM_VALUE4NAME

#define SPECENUM_VALUE4NAME   "k"

Definition at line 65 of file mapimg.h.

◆ SPECENUM_VALUE5

#define SPECENUM_VALUE5   MAPIMG_LAYER_TERRAIN

Definition at line 66 of file mapimg.h.

◆ SPECENUM_VALUE5NAME

#define SPECENUM_VALUE5NAME   "t"

Definition at line 67 of file mapimg.h.

◆ SPECENUM_VALUE6

#define SPECENUM_VALUE6   MAPIMG_LAYER_UNITS

Definition at line 68 of file mapimg.h.

◆ SPECENUM_VALUE6NAME

#define SPECENUM_VALUE6NAME   "u"

Definition at line 69 of file mapimg.h.

Typedef Documentation

◆ mapimg_plrcolor_count_func

typedef int(* mapimg_plrcolor_count_func) ()

Definition at line 84 of file mapimg.h.

◆ mapimg_plrcolor_get_func

typedef struct rgbcolor*(* mapimg_plrcolor_get_func) (int)

Definition at line 84 of file mapimg.h.

◆ mapimg_tile_known_func

typedef enum known_type(* mapimg_tile_known_func) (const struct tile *ptile, const struct player *pplayer, bool knowledge)

Definition at line 1 of file mapimg.h.

◆ mapimg_tile_player_func

typedef struct player*(* mapimg_tile_player_func) (const struct tile *ptile, const struct player *pplayer, bool knowledge)

Definition at line 1 of file mapimg.h.

◆ mapimg_tile_terrain_func

typedef struct terrain*(* mapimg_tile_terrain_func) (const struct tile *ptile, const struct player *pplayer, bool knowledge)

Definition at line 1 of file mapimg.h.

Function Documentation

◆ mapimg_colortest()

bool mapimg_colortest ( const char *  savename,
const char *  path 
)

Create images which shows all map colors (playercolor, terrain colors).

One image is created for each supported image format. The filename will be [basename as used for savegames]-colortest.[format].

Definition at line 1156 of file mapimg.cpp.

Referenced by mapimg_command().

◆ mapimg_count()

int mapimg_count ( )

Return the number of map image definitions.

Definition at line 420 of file mapimg.cpp.

Referenced by freeciv::server::begin_phase(), mapimg_client_define(), mapimg_command(), mapimg_define(), mapimg_test(), sg_load_mapimg(), sg_save_mapimg(), and show_mapimg().

◆ mapimg_create()

bool mapimg_create ( struct mapdef pmapdef,
bool  force,
const char *  savename,
const char *  path 
)

Create the requested map image.

The filename is created as basename as used for savegames-mapstr.mapext where mapstr contains the map definition and mapext the selected image extension. If 'force' is FALSE, the image is only created if game.info.turn is a multiple of the map setting turns.

Definition at line 1050 of file mapimg.cpp.

Referenced by freeciv::server::begin_phase(), and mapimg_command().

◆ mapimg_define()

bool mapimg_define ( const char *  maparg,
bool  check 
)

Define on map image.

Definition at line 590 of file mapimg.cpp.

Referenced by mapimg_client_define(), mapimg_command(), and sg_load_mapimg().

◆ mapimg_delete()

bool mapimg_delete ( int  id)

Delete a map image definition.

Definition at line 918 of file mapimg.cpp.

Referenced by mapimg_client_define(), mapimg_command(), and sg_load_mapimg().

◆ mapimg_error()

const char* mapimg_error ( )

Returns the last error.

Definition at line 585 of file mapimg.cpp.

Referenced by freeciv::server::begin_phase(), and mapimg_command().

◆ mapimg_free()

void mapimg_free ( )

Free all memory allocated by the map image subsystem.

Definition at line 405 of file mapimg.cpp.

Referenced by client_game_free(), and server_quit().

◆ mapimg_help()

char* mapimg_help ( const char *  cmdname)

Return a help string for the 'mapimg' command.

Definition at line 457 of file mapimg.cpp.

◆ mapimg_id2str()

bool mapimg_id2str ( int  id,
char *  str,
size_t  str_len 
)

Return the map image definition 'id' as a mapdef string.

This function is a wrapper for mapimg_def2str().

Definition at line 1029 of file mapimg.cpp.

Referenced by mapimg_command(), and sg_save_mapimg().

◆ mapimg_init()

void mapimg_init ( mapimg_tile_known_func  mapimg_tile_known,
mapimg_tile_terrain_func  mapimg_tile_terrain,
mapimg_tile_player_func  mapimg_tile_owner,
mapimg_tile_player_func  mapimg_tile_city,
mapimg_tile_player_func  mapimg_tile_unit,
mapimg_plrcolor_count_func  mapimg_plrcolor_count,
mapimg_plrcolor_get_func  mapimg_plrcolor_get 
)

Initialisation of the map image subsystem.

The arguments are used to determine the map knowledge, the terrain type as well as the tile, city and unit owner.

Definition at line 351 of file mapimg.cpp.

Referenced by client_game_init().

◆ mapimg_isvalid()

struct mapdef* mapimg_isvalid ( int  id)

Check if a map image definition is valid.

This function is a wrapper for mapimg_checkplayers().

Definition at line 886 of file mapimg.cpp.

Referenced by freeciv::server::begin_phase(), mapimg_client_define(), and mapimg_command().

◆ mapimg_reset()

void mapimg_reset ( )

Reset the map image subsystem.

Definition at line 386 of file mapimg.cpp.

Referenced by client_game_reset(), mapimg_free(), and freeciv::server::shut_game_down().

◆ mapimg_show()

bool mapimg_show ( int  id,
char *  str,
size_t  str_len,
bool  detail 
)

Show a map image definition.

Definition at line 937 of file mapimg.cpp.

Referenced by mapimg_command(), and show_mapimg().