![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <cstdarg>#include "bitvector.h"#include "fcintl.h"#include "log.h"#include "timing.h"#include "calendar.h"#include "fc_types.h"#include "game.h"#include "map.h"#include "player.h"#include "rgbcolor.h"#include "terrain.h"#include "tile.h"#include "mapimg.h"#include <QImage>#include <QImageWriter>#include <QPainter>#include "specenum_gen.h"#include "speclist.h"
Include dependency graph for mapimg.cpp:Go to the source code of this file.
Classes | |
| struct | tile_shape |
| struct | mapdef |
| struct | img |
Macros | |
| #define | TILE_SIZE 6 |
| #define | NUM_PIXEL TILE_SIZE *TILE_SIZE |
| #define | ARG_PLRBV "plrbv" |
| #define | ARG_PLRID "plrid" |
| #define | ARG_PLRNAME "plrname" |
| #define | SPECENUM_NAME mapdef_arg |
| #define | SPECENUM_VALUE0 MAPDEF_FORMAT |
| #define | SPECENUM_VALUE0NAME "format" |
| #define | SPECENUM_VALUE1 MAPDEF_MAP |
| #define | SPECENUM_VALUE1NAME "map" |
| #define | SPECENUM_VALUE2 MAPDEF_PLRBV |
| #define | SPECENUM_VALUE2NAME ARG_PLRBV |
| #define | SPECENUM_VALUE3 MAPDEF_PLRID |
| #define | SPECENUM_VALUE3NAME ARG_PLRID |
| #define | SPECENUM_VALUE4 MAPDEF_PLRNAME |
| #define | SPECENUM_VALUE4NAME ARG_PLRNAME |
| #define | SPECENUM_VALUE5 MAPDEF_SHOW |
| #define | SPECENUM_VALUE5NAME "show" |
| #define | SPECENUM_VALUE6 MAPDEF_TURNS |
| #define | SPECENUM_VALUE6NAME "turns" |
| #define | SPECENUM_VALUE7 MAPDEF_ZOOM |
| #define | SPECENUM_VALUE7NAME "zoom" |
| #define | SPECENUM_COUNT MAPDEF_COUNT |
| #define | SPECENUM_NAME show_player |
| #define | SPECENUM_VALUE0 SHOW_NONE |
| #define | SPECENUM_VALUE0NAME "none" |
| #define | SPECENUM_VALUE1 SHOW_EACH |
| #define | SPECENUM_VALUE1NAME "each" |
| #define | SPECENUM_VALUE2 SHOW_HUMAN |
| #define | SPECENUM_VALUE2NAME "human" |
| #define | SPECENUM_VALUE3 SHOW_ALL |
| #define | SPECENUM_VALUE3NAME "all" |
| #define | SPECENUM_VALUE4 SHOW_PLRNAME |
| #define | SPECENUM_VALUE4NAME ARG_PLRNAME |
| #define | SPECENUM_VALUE5 SHOW_PLRID |
| #define | SPECENUM_VALUE5NAME ARG_PLRID |
| #define | SPECENUM_VALUE6 SHOW_PLRBV |
| #define | SPECENUM_VALUE6NAME ARG_PLRBV |
| #define | SPECENUM_NAME mapimg_status |
| #define | SPECENUM_VALUE0 MAPIMG_STATUS_UNKNOWN |
| #define | SPECENUM_VALUE0NAME _("not checked") |
| #define | SPECENUM_VALUE1 MAPIMG_STATUS_OK |
| #define | SPECENUM_VALUE1NAME _("OK") |
| #define | SPECENUM_VALUE2 MAPIMG_STATUS_ERROR |
| #define | SPECENUM_VALUE2NAME _("error") |
| #define | MAX_LEN_MAPARG MAX_LEN_MAPDEF |
| #define | MAX_NUM_MAPIMG 10 |
| #define | SPECLIST_TAG mapdef |
| #define | SPECLIST_TYPE struct mapdef |
| #define | mapdef_list_iterate(mapdef_list, pmapdef) TYPED_LIST_ITERATE(struct mapdef, mapdef_list, pmapdef) |
| #define | mapdef_list_iterate_end LIST_ITERATE_END |
| #define | MAX_LEN_ERRORBUF 1024 |
| #define | MAPIMG_LOG(format, ...) mapimg_log(__FILE__, __FUNCTION__, __FC_LINE__, format, ##__VA_ARGS__) |
| #define | MAPIMG_ASSERT_RET_VAL(cond, expr) fc_assert_action(cond, MAPIMG_LOG(_("internal error")); return (expr)) |
| #define | SIZE_X 16 |
| #define | SIZE_Y 5 |
Typedefs | |
| typedef bv_pixel(* | plot_func) (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| typedef void(* | base_coor_func) (struct img *pimg, int *base_x, int *base_y, int x, int y) |
Enumerations | |
| enum | img_special { IMGCOLOR_ERROR , IMGCOLOR_OCEAN , IMGCOLOR_GROUND , IMGCOLOR_BACKGROUND , IMGCOLOR_TEXT } |
Functions | |
| static const struct rgbcolor * | imgcolor_special (enum img_special imgcolor) |
| Return rgbcolor for img_special. More... | |
| static const struct rgbcolor * | imgcolor_player (int plr_id) |
| Return rgbcolor for player. More... | |
| static const struct rgbcolor * | imgcolor_terrain (const struct terrain *pterrain) |
| Return rgbcolor for terrain. More... | |
| BV_DEFINE (bv_pixel, NUM_PIXEL) | |
| static bv_pixel | pixel_tile_rect (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| 0 1 2 3 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 More... | |
| static bv_pixel | pixel_city_rect (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| static bv_pixel | pixel_unit_rect (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| static bv_pixel | pixel_fogofwar_rect (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| 0 – 2 – 4 – – 7 – 9 – 11 12 – 14 – 16 – – 19 – 21 – 23 24 – 26 – 28 – – 31 – 33 – 35 More... | |
| static bv_pixel | pixel_border_rect (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| static void | base_coor_rect (struct img *pimg, int *base_x, int *base_y, int x, int y) |
| Base coordinates for the tiles on a (isometric) rectange topology,. More... | |
| static bv_pixel | pixel_tile_hexa (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| static bv_pixel | pixel_city_hexa (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| static bv_pixel | pixel_unit_hexa (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| static bv_pixel | pixel_fogofwar_hexa (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| static bv_pixel | pixel_border_hexa (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| [W] 0 1 [N] 2 – – 5 6 – – – – 11 [SW] 12 – – – – 17 [NE] 18 – – – – 23 24 – – – – 29 30 – – 33 [S] 34 35 [E] More... | |
| static void | base_coor_hexa (struct img *pimg, int *base_x, int *base_y, int x, int y) |
| Base coordinates for the tiles on a hexa topology,. More... | |
| static bv_pixel | pixel_tile_isohexa (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| static bv_pixel | pixel_city_isohexa (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| static bv_pixel | pixel_unit_isohexa (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| static bv_pixel | pixel_fogofwar_isohexa (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| static bv_pixel | pixel_border_isohexa (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
| static void | base_coor_isohexa (struct img *pimg, int *base_x, int *base_y, int x, int y) |
| Base coordinates for the tiles on a isometric hexa topology,. More... | |
| BV_DEFINE (bv_mapdef_arg, MAPDEF_COUNT) | |
| static bool | mapimg_initialised () |
| Check if the map image subsustem is initialised. More... | |
| static bool | mapimg_test (int id) |
| Check if the map image subsystem is initialised and the given ID is valid. More... | |
| static bool | mapimg_define_arg (struct mapdef *pmapdef, enum mapdef_arg arg, const char *val, bool check) |
| Helper function for mapimg_define(). More... | |
| static bool | mapimg_def2str (struct mapdef *pmapdef, char *str, size_t str_len) |
| Return a mapdef string for the map image definition given by 'pmapdef'. More... | |
| static bool | mapimg_checkplayers (struct mapdef *pmapdef, bool recheck) |
| Check the player selection. More... | |
| static char * | mapimg_generate_name (struct mapdef *pmapdef) |
| Generate an identifier for a map image. More... | |
| static struct mapdef * | mapdef_new (bool colortest) |
| Create a new map image definition with default values. More... | |
| static void | mapdef_destroy (struct mapdef *pmapdef) |
| Destroy a map image definition. More... | |
| static struct img * | img_new (struct mapdef *mapdef, int topo, int xsize, int ysize) |
| Create a new image. More... | |
| static void | img_destroy (struct img *pimg) |
| Destroy a image. More... | |
| static void | img_set_pixel (struct img *pimg, const int mindex, const struct rgbcolor *pcolor) |
| Set the color of one pixel. More... | |
| static int | img_index (const int x, const int y, const struct img *pimg) |
| Get the index for an (x,y) image coordinate. More... | |
| static void | img_plot (struct img *pimg, int x, int y, const struct rgbcolor *pcolor, const bv_pixel pixel) |
| Plot one tile at (x,y). More... | |
| static void | img_plot_tile (struct img *pimg, const struct tile *ptile, const struct rgbcolor *pcolor, const bv_pixel pixel) |
| Plot one tile. More... | |
| static bool | img_save (const struct img *pimg, const char *mapimgfile, const char *path) |
| Save an image. More... | |
| static bool | img_filename (const char *mapimgfile, const QByteArray &format, char *filename, size_t filename_len) |
| Generate the final filename. More... | |
| static void | img_createmap (struct img *pimg) |
| Create the map considering the options (terrain, player(s), cities, units, borders, known, fogofwar, ...). More... | |
| static void | mapimg_log (const char *file, const char *function, int line, const char *format,...) |
| Edit the error_buffer. More... | |
| static int | bvplayers_count (const struct mapdef *pmapdef) |
| Return the number of players defined in a map image definition. More... | |
| static const char * | bvplayers_str (const bv_player &plrbv) |
| Convert the player bitvector to a string. More... | |
| 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... | |
| static const char * | showname_help (enum show_player showplr) |
| Describe the 'show' settings. 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... | |
| struct mapdef * | mapimg_isvalid (int id) |
| Check if a map image definition is valid. 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... | |
Variables | |
| static struct tile_shape | tile_rect |
| static struct tile_shape | tile_hexa |
| static struct tile_shape | tile_isohexa |
| static const auto | MAPIMG_DEFAULT_IMGFORMAT = QByteArrayLiteral("png") |
| static char | error_buffer [MAX_LEN_ERRORBUF] = "\0" |
| struct { | |
| bool init | |
| struct mapdef_list * mapdef | |
| 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 | |
| } | mapimg = {.init = false} |
| #define ARG_PLRBV "plrbv" |
Definition at line 151 of file mapimg.cpp.
| #define ARG_PLRID "plrid" |
Definition at line 152 of file mapimg.cpp.
| #define ARG_PLRNAME "plrname" |
Definition at line 153 of file mapimg.cpp.
| #define mapdef_list_iterate | ( | mapdef_list, | |
| pmapdef | |||
| ) | TYPED_LIST_ITERATE(struct mapdef, mapdef_list, pmapdef) |
Definition at line 259 of file mapimg.cpp.
| #define mapdef_list_iterate_end LIST_ITERATE_END |
Definition at line 261 of file mapimg.cpp.
| #define MAPIMG_ASSERT_RET_VAL | ( | cond, | |
| expr | |||
| ) | fc_assert_action(cond, MAPIMG_LOG(_("internal error")); return (expr)) |
Definition at line 318 of file mapimg.cpp.
| #define MAPIMG_LOG | ( | format, | |
| ... | |||
| ) | mapimg_log(__FILE__, __FUNCTION__, __FC_LINE__, format, ##__VA_ARGS__) |
Definition at line 316 of file mapimg.cpp.
| #define MAX_LEN_ERRORBUF 1024 |
Definition at line 310 of file mapimg.cpp.
| #define MAX_LEN_MAPARG MAX_LEN_MAPDEF |
Definition at line 213 of file mapimg.cpp.
| #define MAX_NUM_MAPIMG 10 |
Definition at line 214 of file mapimg.cpp.
Definition at line 53 of file mapimg.cpp.
| #define SIZE_X 16 |
| #define SIZE_Y 5 |
| #define SPECENUM_COUNT MAPDEF_COUNT |
Definition at line 173 of file mapimg.cpp.
| #define SPECENUM_NAME mapdef_arg |
Definition at line 204 of file mapimg.cpp.
| #define SPECENUM_NAME show_player |
Definition at line 204 of file mapimg.cpp.
| #define SPECENUM_NAME mapimg_status |
Definition at line 204 of file mapimg.cpp.
| #define SPECENUM_VALUE0 MAPDEF_FORMAT |
Definition at line 205 of file mapimg.cpp.
| #define SPECENUM_VALUE0 SHOW_NONE |
Definition at line 205 of file mapimg.cpp.
| #define SPECENUM_VALUE0 MAPIMG_STATUS_UNKNOWN |
Definition at line 205 of file mapimg.cpp.
| #define SPECENUM_VALUE0NAME "format" |
Definition at line 206 of file mapimg.cpp.
| #define SPECENUM_VALUE0NAME "none" |
Definition at line 206 of file mapimg.cpp.
| #define SPECENUM_VALUE0NAME _("not checked") |
Definition at line 206 of file mapimg.cpp.
| #define SPECENUM_VALUE1 MAPDEF_MAP |
Definition at line 207 of file mapimg.cpp.
| #define SPECENUM_VALUE1 SHOW_EACH |
Definition at line 207 of file mapimg.cpp.
| #define SPECENUM_VALUE1 MAPIMG_STATUS_OK |
Definition at line 207 of file mapimg.cpp.
| #define SPECENUM_VALUE1NAME "map" |
Definition at line 208 of file mapimg.cpp.
| #define SPECENUM_VALUE1NAME "each" |
Definition at line 208 of file mapimg.cpp.
| #define SPECENUM_VALUE1NAME _("OK") |
Definition at line 208 of file mapimg.cpp.
| #define SPECENUM_VALUE2 MAPDEF_PLRBV |
Definition at line 209 of file mapimg.cpp.
| #define SPECENUM_VALUE2 SHOW_HUMAN |
Definition at line 209 of file mapimg.cpp.
| #define SPECENUM_VALUE2 MAPIMG_STATUS_ERROR |
Definition at line 209 of file mapimg.cpp.
| #define SPECENUM_VALUE2NAME ARG_PLRBV |
Definition at line 210 of file mapimg.cpp.
| #define SPECENUM_VALUE2NAME "human" |
Definition at line 210 of file mapimg.cpp.
| #define SPECENUM_VALUE2NAME _("error") |
Definition at line 210 of file mapimg.cpp.
| #define SPECENUM_VALUE3 MAPDEF_PLRID |
Definition at line 186 of file mapimg.cpp.
| #define SPECENUM_VALUE3 SHOW_ALL |
Definition at line 186 of file mapimg.cpp.
| #define SPECENUM_VALUE3NAME ARG_PLRID |
Definition at line 187 of file mapimg.cpp.
| #define SPECENUM_VALUE3NAME "all" |
Definition at line 187 of file mapimg.cpp.
| #define SPECENUM_VALUE4 MAPDEF_PLRNAME |
Definition at line 189 of file mapimg.cpp.
| #define SPECENUM_VALUE4 SHOW_PLRNAME |
Definition at line 189 of file mapimg.cpp.
| #define SPECENUM_VALUE4NAME ARG_PLRNAME |
Definition at line 190 of file mapimg.cpp.
| #define SPECENUM_VALUE4NAME ARG_PLRNAME |
Definition at line 190 of file mapimg.cpp.
| #define SPECENUM_VALUE5 MAPDEF_SHOW |
Definition at line 192 of file mapimg.cpp.
| #define SPECENUM_VALUE5 SHOW_PLRID |
Definition at line 192 of file mapimg.cpp.
| #define SPECENUM_VALUE5NAME "show" |
Definition at line 193 of file mapimg.cpp.
| #define SPECENUM_VALUE5NAME ARG_PLRID |
Definition at line 193 of file mapimg.cpp.
| #define SPECENUM_VALUE6 MAPDEF_TURNS |
Definition at line 195 of file mapimg.cpp.
| #define SPECENUM_VALUE6 SHOW_PLRBV |
Definition at line 195 of file mapimg.cpp.
| #define SPECENUM_VALUE6NAME "turns" |
Definition at line 196 of file mapimg.cpp.
| #define SPECENUM_VALUE6NAME ARG_PLRBV |
Definition at line 196 of file mapimg.cpp.
| #define SPECENUM_VALUE7 MAPDEF_ZOOM |
Definition at line 171 of file mapimg.cpp.
| #define SPECENUM_VALUE7NAME "zoom" |
Definition at line 172 of file mapimg.cpp.
| #define SPECLIST_TAG mapdef |
Definition at line 255 of file mapimg.cpp.
| #define SPECLIST_TYPE struct mapdef |
Definition at line 256 of file mapimg.cpp.
| #define TILE_SIZE 6 |
Definition at line 52 of file mapimg.cpp.
| typedef void(* base_coor_func) (struct img *pimg, int *base_x, int *base_y, int x, int y) |
Definition at line 66 of file mapimg.cpp.
| typedef bv_pixel(* plot_func) (const struct tile *ptile, const struct player *pplayer, bool knowledge) |
Definition at line 64 of file mapimg.cpp.
| enum img_special |
| Enumerator | |
|---|---|
| IMGCOLOR_ERROR | |
| IMGCOLOR_OCEAN | |
| IMGCOLOR_GROUND | |
| IMGCOLOR_BACKGROUND | |
| IMGCOLOR_TEXT | |
Definition at line 38 of file mapimg.cpp.
|
static |
Base coordinates for the tiles on a hexa topology,.
Definition at line 2382 of file mapimg.cpp.
Referenced by img_new().
|
static |
Base coordinates for the tiles on a isometric hexa topology,.
Definition at line 2621 of file mapimg.cpp.
Referenced by img_new().
|
static |
Base coordinates for the tiles on a (isometric) rectange topology,.
Definition at line 2145 of file mapimg.cpp.
Referenced by img_new().
| BV_DEFINE | ( | bv_mapdef_arg | , |
| MAPDEF_COUNT | |||
| ) |
| BV_DEFINE | ( | bv_pixel | , |
| NUM_PIXEL | |||
| ) |
|
static |
Return the number of players defined in a map image definition.
Definition at line 2664 of file mapimg.cpp.
Referenced by img_createmap().
|
static |
Convert the player bitvector to a string.
Definition at line 2641 of file mapimg.cpp.
Referenced by mapimg_def2str(), and mapimg_show().
|
static |
Create the map considering the options (terrain, player(s), cities, units, borders, known, fogofwar, ...).
Definition at line 1812 of file mapimg.cpp.
Referenced by mapimg_create().
|
static |
Destroy a image.
Definition at line 1637 of file mapimg.cpp.
Referenced by mapimg_colortest(), and mapimg_create().
|
static |
|
inlinestatic |
Get the index for an (x,y) image coordinate.
Definition at line 1665 of file mapimg.cpp.
Referenced by img_plot(), and img_save().
Create a new image.
Definition at line 1546 of file mapimg.cpp.
Referenced by mapimg_colortest(), and mapimg_create().
|
static |
Plot one tile at (x,y).
Only the pixel of the tile set within 'pixel' are ploted.
Definition at line 1677 of file mapimg.cpp.
Referenced by img_plot_tile(), and mapimg_colortest().
|
static |
Plot one tile.
Only the pixel of the tile set within 'pixel' are ploted.
Definition at line 1700 of file mapimg.cpp.
Referenced by img_createmap().
|
static |
Save an image.
Definition at line 1714 of file mapimg.cpp.
Referenced by mapimg_colortest(), and mapimg_create().
|
static |
Return rgbcolor for player.
FIXME: nearly identical with get_player_color() in colors_common.c.
Definition at line 2726 of file mapimg.cpp.
Referenced by img_createmap(), and img_save().
|
static |
Return rgbcolor for img_special.
Definition at line 2703 of file mapimg.cpp.
Referenced by img_createmap(), imgcolor_player(), imgcolor_terrain(), and mapimg_colortest().
Return rgbcolor for terrain.
FIXME: nearly identical with get_terrain_color() in colors_common.c.
Definition at line 2743 of file mapimg.cpp.
Referenced by img_createmap(), and mapimg_colortest().
|
static |
Destroy a map image definition.
Definition at line 1528 of file mapimg.cpp.
Referenced by mapimg_colortest(), mapimg_define(), mapimg_help(), and mapimg_reset().
|
static |
Create a new map image definition with default values.
Definition at line 1497 of file mapimg.cpp.
Referenced by mapimg_colortest(), mapimg_define(), and mapimg_help().
|
static |
Check the player selection.
This needs to be done before each image creationcall (see mapimg_create()) to test that the selection is still valid as players can be added or removed during the game.
Definition at line 1330 of file mapimg.cpp.
Referenced by mapimg_create(), and mapimg_isvalid().
| 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().
| 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().
| 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().
|
static |
Return a mapdef string for the map image definition given by 'pmapdef'.
Definition at line 1272 of file mapimg.cpp.
Referenced by mapimg_id2str(), and mapimg_show().
| 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().
|
static |
Helper function for mapimg_define().
Definition at line 711 of file mapimg.cpp.
Referenced by mapimg_define().
| 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().
| 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().
| 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().
|
static |
Generate an identifier for a map image.
M[map options]Z[zoom factor]P[players]
Where [players] is the player ID or vector of size MAX_NUM_PLAYER_SLOTS [0/1].
For the player bitvector all MAX_NUM_PLAYER_SLOTS values are used due to the possibility of additional players during the game (civil war, barbarians).
Definition at line 1424 of file mapimg.cpp.
Referenced by mapimg_create(), and mapimg_show().
| char* mapimg_help | ( | const char * | cmdname | ) |
Return a help string for the 'mapimg' command.
Definition at line 457 of file mapimg.cpp.
| 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().
| 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().
|
inlinestatic |
Check if the map image subsustem is initialised.
Definition at line 1251 of file mapimg.cpp.
Referenced by mapimg_count(), mapimg_define(), mapimg_free(), mapimg_init(), mapimg_reset(), and mapimg_test().
| 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().
|
static |
Edit the error_buffer.
Strings should not have a terminating period.
Definition at line 1398 of file mapimg.cpp.
| 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().
| 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().
|
static |
Check if the map image subsystem is initialised and the given ID is valid.
In case of an error, the error message is saved via MAPIMG_LOG().
Definition at line 1257 of file mapimg.cpp.
Referenced by mapimg_delete(), mapimg_id2str(), mapimg_isvalid(), and mapimg_show().
|
static |
[W] 0 1 [N] 2 – – 5 6 – – – – 11 [SW] 12 – – – – 17 [NE] 18 – – – – 23 24 – – – – 29 30 – – 33 [S] 34 35 [E]
Definition at line 2298 of file mapimg.cpp.
Referenced by img_new().
|
static |
[N]
[NW] 0 1 2 3 [E] 4 – – – – 9 10 – – – – – – 17 18 – – – – – – 25 26 – – – – 31 [W] 32 33 34 35 [SE]
[S]
Definition at line 2537 of file mapimg.cpp.
Referenced by img_new().
|
static |
[N] 0 1 2 3 3 5 6 -- -- -- -- 11
[W] 12 – – – – 17 [E] 18 – – – – 23 24 – – – – 29 30 31 32 33 34 35
[S]
Definition at line 2073 of file mapimg.cpp.
Referenced by img_new().
|
static |
-- --
– 3 4 – – 7 8 9 10 – – 13 14 15 16 – – 19 20 21 22 – – 25 26 27 28 – – 31 32 –
Definition at line 2186 of file mapimg.cpp.
Referenced by img_new().
|
static |
-- -- -- --
– 5 6 7 8 – – 11 12 13 14 15 16 – – 19 20 21 22 23 24 – – 27 28 29 30 –
Definition at line 2423 of file mapimg.cpp.
Referenced by img_new().
|
static |
– 7 8 9 10 – – 13 14 15 16 – – 19 20 21 22 – – 25 26 27 28 –
Definition at line 1965 of file mapimg.cpp.
Referenced by img_new().
|
static |
0 --
– 3 – 5 – 7 – 9 – 11 – 13 – 15 – 17 18 – 20 – 22 – 24 – 26 – 28 – 30 – 32 – – 35
Definition at line 2256 of file mapimg.cpp.
Referenced by img_new().
|
static |
0 1 -- -- 4 -- -- 7 8 --
– – 12 13 – – 16 17 18 19 – – 22 23 – – – 27 28 – – 31 – – 34 35
Definition at line 2491 of file mapimg.cpp.
Referenced by img_new().
|
static |
0 – 2 – 4 – – 7 – 9 – 11 12 – 14 – 16 – – 19 – 21 – 23 24 – 26 – 28 – – 31 – 33 – 35
Definition at line 2028 of file mapimg.cpp.
Referenced by img_new().
|
static |
0 1 2 3 4 5
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
Definition at line 2163 of file mapimg.cpp.
Referenced by img_new().
|
static |
0 1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
Definition at line 2401 of file mapimg.cpp.
Referenced by img_new().
|
static |
0 1 2 3 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
Definition at line 1944 of file mapimg.cpp.
Referenced by img_new().
|
static |
-- --
– – 14 15 – – – – 20 21 – –
Definition at line 2229 of file mapimg.cpp.
Referenced by img_new().
|
static |
-- -- -- --
– – – 13 14 – – – – – – 21 22 – – –
Definition at line 2465 of file mapimg.cpp.
Referenced by img_new().
|
static |
Describe the 'show' settings.
Definition at line 432 of file mapimg.cpp.
Referenced by mapimg_help().
|
static |
Definition at line 312 of file mapimg.cpp.
Referenced by mapimg_error(), and mapimg_log().
| bool init |
Definition at line 328 of file mapimg.cpp.
Referenced by audio_select_plugin(), and fc_rand_set_init().
| struct mapdef_list* mapdef |
Definition at line 329 of file mapimg.cpp.
Referenced by img_new(), and mapdef_new().
| struct { ... } mapimg |
|
static |
Definition at line 216 of file mapimg.cpp.
Referenced by mapdef_new(), mapimg_define_arg(), mapimg_help(), and mapimg_show().
| mapimg_plrcolor_count_func mapimg_plrcolor_count |
Definition at line 336 of file mapimg.cpp.
Referenced by mapimg_init().
| mapimg_plrcolor_get_func mapimg_plrcolor_get |
Definition at line 337 of file mapimg.cpp.
Referenced by mapimg_init().
| mapimg_tile_player_func mapimg_tile_city |
Definition at line 334 of file mapimg.cpp.
Referenced by mapimg_init().
| mapimg_tile_known_func mapimg_tile_known |
Definition at line 331 of file mapimg.cpp.
Referenced by mapimg_init().
| mapimg_tile_player_func mapimg_tile_owner |
Definition at line 333 of file mapimg.cpp.
Referenced by mapimg_init().
| mapimg_tile_terrain_func mapimg_tile_terrain |
Definition at line 332 of file mapimg.cpp.
Referenced by mapimg_init().
| mapimg_tile_player_func mapimg_tile_unit |
Definition at line 335 of file mapimg.cpp.
Referenced by mapimg_init().
|
static |
Definition at line 91 of file mapimg.cpp.
Referenced by img_new().
|
static |
Definition at line 121 of file mapimg.cpp.
Referenced by img_new().
|
static |
Definition at line 66 of file mapimg.cpp.
Referenced by img_new().