Freeciv-3.2
|
#include <stdarg.h>
#include "astring.h"
#include "bitvector.h"
#include "fc_cmdline.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "string_vector.h"
#include "timing.h"
#include "calendar.h"
#include "connection.h"
#include "fc_types.h"
#include "game.h"
#include "map.h"
#include "rgbcolor.h"
#include "terrain.h"
#include "tile.h"
#include "version.h"
#include "player.h"
#include "mapimg.h"
#include "specenum_gen.h"
#include "speclist.h"
Go to the source code of this file.
Data Structures | |
struct | tile_shape |
struct | mapdef |
struct | img |
struct | toolkit |
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) |
typedef bool(* | img_save_func) (const struct img *pimg, const char *mapimgfile) |
Enumerations | |
enum | img_special { IMGCOLOR_ERROR , IMGCOLOR_OCEAN , IMGCOLOR_GROUND , IMGCOLOR_BACKGROUND , IMGCOLOR_TEXT } |
#define GEN_TOOLKIT | ( | _tool, | |
_format_default, | |||
_formats, | |||
_save_func, | |||
_help | |||
) | {_tool, _format_default, _formats, _save_func, _help}, |
#define IMG_BORDER_WIDTH IMG_BORDER_HEIGHT |
#define mapdef_list_iterate | ( | mapdef_list, | |
pmapdef | |||
) | TYPED_LIST_ITERATE(struct mapdef, mapdef_list, pmapdef) |
#define mapdef_list_iterate_end LIST_ITERATE_END |
#define MAPIMG_ASSERT_RET_VAL | ( | cond, | |
expr | |||
) | fc_assert_action(cond, MAPIMG_LOG(_("internal error")); return (expr)) |
#define MAPIMG_DEFAULT_IMGFORMAT IMGFORMAT_PPM |
#define MAPIMG_DEFAULT_IMGTOOL IMGTOOL_PPM |
#define MAPIMG_LOG | ( | format, | |
... | |||
) | mapimg_log(__FILE__, __FUNCTION__, __FC_LINE__, format, ## __VA_ARGS__) |
#define MAX_LEN_MAPARG MAX_LEN_MAPDEF |
#define NUM_MAX_FORMATARGS 2 |
Helper function for mapimg_define().
#define SIZE_X 16 |
#define SIZE_Y 5 |
#define SPECENUM_COUNT MAPDEF_COUNT |
#define SPECENUM_VALUE0 MAPDEF_FORMAT |
#define SPECENUM_VALUE0 IMGFORMAT_GIF |
#define SPECENUM_VALUE0 IMGTOOL_PPM |
#define SPECENUM_VALUE0 MAPIMG_STATUS_UNKNOWN |
#define SPECENUM_VALUE1 MAPDEF_MAP |
#define SPECENUM_VALUE1 IMGFORMAT_PNG |
#define SPECENUM_VALUE1 IMGTOOL_MAGICKWAND |
#define SPECENUM_VALUE1 MAPIMG_STATUS_OK |
#define SPECENUM_VALUE2 MAPDEF_PLRBV |
#define SPECENUM_VALUE2 IMGFORMAT_PPM |
#define SPECENUM_VALUE2 SHOW_HUMAN |
#define SPECENUM_VALUE2 MAPIMG_STATUS_ERROR |
#define SPECENUM_VALUE3 MAPDEF_PLRID |
#define SPECENUM_VALUE3 IMGFORMAT_JPG |
#define SPECENUM_VALUE4 MAPDEF_PLRNAME |
#define SPECENUM_VALUE4 SHOW_PLRNAME |
#define SPECENUM_VALUE4NAME ARG_PLRNAME |
#define SPECENUM_VALUE4NAME ARG_PLRNAME |
#define SPECENUM_VALUE5 MAPDEF_SHOW |
#define SPECENUM_VALUE5 SHOW_PLRID |
#define SPECENUM_VALUE6 MAPDEF_TURNS |
#define SPECENUM_VALUE6 SHOW_PLRBV |
#define SPECENUM_VALUE7 MAPDEF_ZOOM |
BV_DEFINE | ( | bv_mapdef_arg | , |
MAPDEF_COUNT | |||
) |
Return the number of players defined in a map image definition.
Definition at line 3261 of file mapimg.c.
Referenced by img_createmap().
Convert the player bitvector to a string.
Definition at line 3238 of file mapimg.c.
Referenced by mapimg_def2str(), and mapimg_show().
Create the map considering the options (terrain, player(s), cities, units, borders, known, fogofwar, ...).
Definition at line 2416 of file mapimg.c.
Referenced by mapimg_create().
Destroy a image.
Definition at line 1969 of file mapimg.c.
Referenced by mapimg_colortest(), and mapimg_create().
|
static |
Generate the final filename.
Definition at line 2385 of file mapimg.c.
Referenced by img_save_ppm().
Get the index for an (x,y) image coordinate.
Definition at line 1996 of file mapimg.c.
Referenced by get_city_sprite(), img_plot(), and img_save_ppm().
|
static |
Create a new image.
Definition at line 1873 of file mapimg.c.
Referenced by mapimg_colortest(), and mapimg_create().
Return a definition string for the player.
Definition at line 2399 of file mapimg.c.
Referenced by img_save_ppm().
|
static |
Plot one tile at (x,y). Only the pixel of the tile set within 'pixel' are ploted.
Definition at line 2009 of file mapimg.c.
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 2032 of file mapimg.c.
Referenced by img_createmap().
Save an image as ppm file.
Definition at line 2045 of file mapimg.c.
Referenced by mapimg_colortest(), and mapimg_create().
Save an image using magickwand as toolkit. This allows different file formats.
Image structure:
[ 0] border [+IMG_BORDER_HEIGHT] title [+ IMG_TEXT_HEIGHT] space (only if count(displayed players) > 0) [+IMG_SPACER_HEIGHT] player line (only if count(displayed players) > 0) [+ IMG_LINE_HEIGHT] space [+IMG_SPACER_HEIGHT] map [+ map_height] border [+IMG_BORDER_HEIGHT] Save an image as ppm file (toolkit: ppm).
Return the definition of the requested toolkit (or NULL).
Definition at line 1859 of file mapimg.c.
Referenced by img_save(), mapimg_colortest(), mapimg_define_arg(), mapimg_get_format_list(), and mapimg_help().
Return rgbcolor for player.
FIXME: nearly identical with get_player_color() in colors_common.c.
Definition at line 3323 of file mapimg.c.
Referenced by img_createmap(), and img_playerstr().
Return rgbcolor for img_special
Definition at line 3300 of file mapimg.c.
Referenced by img_createmap(), img_save_ppm(), 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 3340 of file mapimg.c.
Referenced by img_createmap(), and mapimg_colortest().
Destroy a map image definition.
Definition at line 1841 of file mapimg.c.
Referenced by mapimg_colortest(), mapimg_define(), mapimg_help(), and mapimg_reset().
Create a new map image definition with default values.
Definition at line 1807 of file mapimg.c.
Referenced by mapimg_colortest(), mapimg_define(), and mapimg_help().
Check the player selection. This needs to be done before each image creation call (see mapimg_create()) to test that the selection is still valid as players can be added or removed during the game.
Definition at line 1639 of file mapimg.c.
Referenced by mapimg_create(), and mapimg_isvalid().
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 1438 of file mapimg.c.
Referenced by mapimg_command().
Return the number of map image definitions.
Definition at line 573 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().
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 1332 of file mapimg.c.
Referenced by mapimg_client_createmap(), mapimg_command(), and srv_running().
Return a mapdef string for the map image definition given by 'pmapdef'.
Definition at line 1579 of file mapimg.c.
Referenced by mapimg_id2str(), and mapimg_show().
Definition at line 769 of file mapimg.c.
Referenced by mapimg_client_define(), mapimg_command(), sg_load_mapimg(), and sg_load_mapimg().
|
static |
Definition at line 892 of file mapimg.c.
Referenced by mapimg_define().
Delete a map image definition.
Definition at line 1204 of file mapimg.c.
Referenced by mapimg_client_define(), mapimg_command(), sg_load_mapimg(), and sg_load_mapimg().
Returns the last error.
Definition at line 759 of file mapimg.c.
Referenced by mapimg_client_save(), mapimg_command(), and srv_running().
Free all memory allocated by the map image subsystem.
Definition at line 558 of file mapimg.c.
Referenced by client_game_free(), and server_quit().
Generate an identifier for a map image.
M[map options]Z[zoom factor]P[players]
[map options] map options [zoom factor] zoom factor [players] 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 1734 of file mapimg.c.
Referenced by mapimg_create(), and mapimg_show().
Return the map image definition 'id' as a mapdef string. This function is a wrapper for mapimg_def2str().
Definition at line 1311 of file mapimg.c.
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 506 of file mapimg.c.
Referenced by client_game_init(), and srv_prepare().
Check if the map image subsustem is initialised.
Definition at line 1555 of file mapimg.c.
Referenced by mapimg_count(), mapimg_define(), mapimg_free(), mapimg_init(), mapimg_reset(), and mapimg_test().
Check if a map image definition is valid. This function is a wrapper for mapimg_checkplayers().
Definition at line 1121 of file mapimg.c.
Referenced by mapimg_client_createmap(), mapimg_client_define(), mapimg_command(), and srv_running().
Reset the map image subsystem.
Definition at line 541 of file mapimg.c.
Referenced by client_game_reset(), mapimg_free(), and srv_main().
Show a map image definition.
Definition at line 1223 of file mapimg.c.
Referenced by mapimg_command(), and show_mapimg().
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 1564 of file mapimg.c.
Referenced by mapimg_delete(), mapimg_id2str(), mapimg_isvalid(), and mapimg_show().
|
static |
|
static |
Definition at line 467 of file mapimg.c.
Referenced by mapimg_error(), and mapimg_log().
|
static |
bool init |
Definition at line 483 of file mapimg.c.
Referenced by audio_select_plugin().
struct { ... } mapimg |
mapimg_plrcolor_count_func mapimg_plrcolor_count |
Definition at line 491 of file mapimg.c.
Referenced by mapimg_init().
mapimg_plrcolor_get_func mapimg_plrcolor_get |
Definition at line 492 of file mapimg.c.
Referenced by mapimg_init().
mapimg_tile_player_func mapimg_tile_city |
Definition at line 489 of file mapimg.c.
Referenced by mapimg_init().
mapimg_tile_known_func mapimg_tile_known |
Definition at line 486 of file mapimg.c.
Referenced by mapimg_init().
mapimg_tile_player_func mapimg_tile_owner |
Definition at line 488 of file mapimg.c.
Referenced by mapimg_init().
mapimg_tile_terrain_func mapimg_tile_terrain |
Definition at line 487 of file mapimg.c.
Referenced by mapimg_init().
mapimg_tile_player_func mapimg_tile_unit |
Definition at line 490 of file mapimg.c.
Referenced by mapimg_init().
|
static |
Definition at line 145 of file mapimg.c.
Referenced by img_new().
|
static |
Definition at line 187 of file mapimg.c.
Referenced by img_new().
|
static |
Definition at line 107 of file mapimg.c.
Referenced by img_new().