Freeciv-3.1: /fast/freeciv/nightly/S3_1/common/mapimg.h File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Macros | Typedefs | Functions
mapimg.h File Reference
`#include "support.h"`
`#include "tile.h"`
`#include "specenum_gen.h"`

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) (void)
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)
void | mapimg_reset (void)
void | mapimg_free (void)
bool | mapimg_initialised (void)
int | mapimg_count (void)
char * | mapimg_help (const char *cmdname)
const char * | mapimg_error (void)
bool | mapimg_define (const char *maparg, bool check)
bool | mapimg_delete (int id)
bool | mapimg_show (int id, char *str, size_t str_len, bool detail)
bool | mapimg_id2str (int id, char *str, size_t str_len)
bool | mapimg_create (struct mapdef *pmapdef, bool force, const char *savename, const char *path)
bool | mapimg_colortest (const char *savename, const char *path)
struct mapdef * | mapimg_isvalid (int id)
const struct strvec * | mapimg_get_format_list (void)
const char * | mapimg_get_format_default (void)

## Macro Definition Documentation

## ◆ MAX_LEN_MAPDEF

#define MAX_LEN_MAPDEF 256

Definition at line 65 of file mapimg.h.

## ◆ SPECENUM_COUNT

#define SPECENUM_COUNT MAPIMG_LAYER_COUNT

Definition at line 84 of file mapimg.h.

## ◆ SPECENUM_COUNTNAME

#define SPECENUM_COUNTNAME "-"

Definition at line 85 of file mapimg.h.

## ◆ SPECENUM_NAME

#define SPECENUM_NAME mapimg_layer

Definition at line 68 of file mapimg.h.

## ◆ SPECENUM_VALUE0

#define SPECENUM_VALUE0 MAPIMG_LAYER_AREA

Definition at line 69 of file mapimg.h.

## ◆ SPECENUM_VALUE0NAME

#define SPECENUM_VALUE0NAME "a"

Definition at line 70 of file mapimg.h.

## ◆ SPECENUM_VALUE1

#define SPECENUM_VALUE1 MAPIMG_LAYER_BORDERS

Definition at line 71 of file mapimg.h.

## ◆ SPECENUM_VALUE1NAME

#define SPECENUM_VALUE1NAME "b"

Definition at line 72 of file mapimg.h.

## ◆ SPECENUM_VALUE2

#define SPECENUM_VALUE2 MAPIMG_LAYER_CITIES

Definition at line 73 of file mapimg.h.

## ◆ SPECENUM_VALUE2NAME

#define SPECENUM_VALUE2NAME "c"

Definition at line 74 of file mapimg.h.

## ◆ SPECENUM_VALUE3

#define SPECENUM_VALUE3 MAPIMG_LAYER_FOGOFWAR

Definition at line 75 of file mapimg.h.

## ◆ SPECENUM_VALUE3NAME

#define SPECENUM_VALUE3NAME "f"

Definition at line 76 of file mapimg.h.

## ◆ SPECENUM_VALUE4

#define SPECENUM_VALUE4 MAPIMG_LAYER_KNOWLEDGE

Definition at line 77 of file mapimg.h.

## ◆ SPECENUM_VALUE4NAME

#define SPECENUM_VALUE4NAME "k"

Definition at line 78 of file mapimg.h.

## ◆ SPECENUM_VALUE5

#define SPECENUM_VALUE5 MAPIMG_LAYER_TERRAIN

Definition at line 79 of file mapimg.h.

## ◆ SPECENUM_VALUE5NAME

#define SPECENUM_VALUE5NAME "t"

Definition at line 80 of file mapimg.h.

## ◆ SPECENUM_VALUE6

#define SPECENUM_VALUE6 MAPIMG_LAYER_UNITS

Definition at line 81 of file mapimg.h.

## ◆ SPECENUM_VALUE6NAME

#define SPECENUM_VALUE6NAME "u"

Definition at line 82 of file mapimg.h.

## Typedef Documentation

## ◆ mapimg_plrcolor_count_func

typedef int(* mapimg_plrcolor_count_func) (void)

Definition at line 103 of file mapimg.h.

## ◆ mapimg_plrcolor_get_func

typedef struct rgbcolor *(* mapimg_plrcolor_get_func) (int)

Definition at line 103 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 toolkit and image format. The filename will be [basename as used for savegames]-colortest-[toolkit].[format].

Definition at line 1435 of file mapimg.c.

Referenced by mapimg_command().

## ◆ mapimg_count()

int mapimg_count | ( | void |  | ) |

Return the number of map image definitions.

Definition at line 572 of file mapimg.c.

Referenced by mapimg_client_define(), mapimg_command(), mapimg_define(), mapimg_test(), sg_load_mapimg(), sg_load_mapimg(), sg_save_mapimg(), show_mapimg(), and srv_running().

## ◆ 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 1331 of file mapimg.c.

Referenced by mapimg_client_createmap(), mapimg_command(), and srv_running().

## ◆ mapimg_define()

bool mapimg_define | ( | const char * | maparg,
|  | bool | check
| ) |  |

Definition at line 768 of file mapimg.c.

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

## ◆ mapimg_delete()

bool mapimg_delete | ( | int | id | ) |

Delete a map image definition.

Definition at line 1203 of file mapimg.c.

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

## ◆ mapimg_error()

const char * mapimg_error | ( | void |  | ) |

Returns the last error.

Definition at line 758 of file mapimg.c.

Referenced by mapimg_client_save(), mapimg_command(), and srv_running().

## ◆ mapimg_free()

void mapimg_free | ( | void |  | ) |

Free all memory allocated by the map image subsystem.

Definition at line 557 of file mapimg.c.

Referenced by client_game_free(), and server_quit().

## ◆ mapimg_get_format_default()

const char * mapimg_get_format_default | ( | void |  | ) |

Return the default value of the toolkit and the image format for the client.

Definition at line 1189 of file mapimg.c.

## ◆ mapimg_get_format_list()

const struct strvec * mapimg_get_format_list | ( | void |  | ) |

Return a list of all available toolkits and formats for the client.

Definition at line 1152 of file mapimg.c.

## ◆ mapimg_help()

char * mapimg_help | ( | const char * | cmdname | ) |

Return a help string for the 'mapimg' command.

Definition at line 602 of file mapimg.c.

## ◆ 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 1310 of file mapimg.c.

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 505 of file mapimg.c.

Referenced by client_game_init(), and srv_prepare().

## ◆ mapimg_initialised()

bool mapimg_initialised | ( | void |  | ) |

Check if the map image subsustem is initialised.

Definition at line 1552 of file mapimg.c.

Referenced by mapimg_count(), mapimg_define(), mapimg_free(), mapimg_init(), mapimg_reset(), and mapimg_test().

## ◆ 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 1120 of file mapimg.c.

Referenced by mapimg_client_createmap(), mapimg_client_define(), mapimg_command(), and srv_running().

## ◆ mapimg_reset()

void mapimg_reset | ( | void |  | ) |

Reset the map image subsystem.

Definition at line 540 of file mapimg.c.

Referenced by client_game_reset(), mapimg_free(), and srv_main().

## ◆ mapimg_show()

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

Show a map image definition.

Definition at line 1222 of file mapimg.c.

Referenced by mapimg_command(), and show_mapimg().