1 /**********************************************************************
2 Freeciv - Copyright (C) 2010 - The Freeciv Team
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
14 /****************************************************************************
19 mapimg_init() Initialise the map images.
20 mapimg_reset() Reset the map images.
21 mapimg_free() Free all memory needed for map images.
22 mapimg_count() Return the number of map image definitions.
23 mapimg_error() Return the last error message.
24 mapimg_help() Return a help text.
28 mapimg_define() Define a new map image.
29 mapimg_delete() Delete a map image definition.
30 mapimg_show() Show the map image definition.
31 mapimg_id2str() Convert the map image definition to a string. Usefull
32 to save the definitions.
34 mapimg_colortest() ...
36 These functions return TRUE on success and FALSE on error. In the later
37 case the error message is available with mapimg_error().
41 mapimg_isvalid() Check if the map image is valid. This is only
42 possible after the game is started or a savegame was
43 loaded. For a valid map image definition the
44 definition is returned. The struct is freed by
45 mapimg_reset() or mapimg_free().
47 mapimg_get_format_list() ...
48 mapimg_get_format_default() ...
50 ****************************************************************************/
57 #endif /* __cplusplus */
65 #define MAX_LEN_MAPDEF 256
67 /* map image layers */
68 #define SPECENUM_NAME mapimg_layer
69 #define SPECENUM_VALUE0 MAPIMG_LAYER_AREA
70 #define SPECENUM_VALUE0NAME "a"
71 #define SPECENUM_VALUE1 MAPIMG_LAYER_BORDERS
72 #define SPECENUM_VALUE1NAME "b"
73 #define SPECENUM_VALUE2 MAPIMG_LAYER_CITIES
74 #define SPECENUM_VALUE2NAME "c"
75 #define SPECENUM_VALUE3 MAPIMG_LAYER_FOGOFWAR
76 #define SPECENUM_VALUE3NAME "f"
77 #define SPECENUM_VALUE4 MAPIMG_LAYER_KNOWLEDGE
78 #define SPECENUM_VALUE4NAME "k"
79 #define SPECENUM_VALUE5 MAPIMG_LAYER_TERRAIN
80 #define SPECENUM_VALUE5NAME "t"
81 #define SPECENUM_VALUE6 MAPIMG_LAYER_UNITS
82 #define SPECENUM_VALUE6NAME "u"
83 /* used a possible dummy value */
84 #define SPECENUM_COUNT MAPIMG_LAYER_COUNT
85 #define SPECENUM_COUNTNAME "-"
86 #include "specenum_gen.h"
87 /* If you change this enum, the default values for the client have to be
88 * adapted (see options.c). */
90 typedef enum known_type
91 (*mapimg_tile_known_func
)(const struct tile
*ptile
,
92 const struct player
*pplayer
,
94 typedef struct terrain
95 *(*mapimg_tile_terrain_func
)(const struct tile
*ptile
,
96 const struct player
*pplayer
,
99 *(*mapimg_tile_player_func
)(const struct tile
*ptile
,
100 const struct player
*pplayer
,
103 typedef int (*mapimg_plrcolor_count_func
)(void);
104 typedef struct rgbcolor
*(*mapimg_plrcolor_get_func
)(int);
109 void mapimg_init(mapimg_tile_known_func mapimg_tile_known
,
110 mapimg_tile_terrain_func mapimg_tile_terrain
,
111 mapimg_tile_player_func mapimg_tile_owner
,
112 mapimg_tile_player_func mapimg_tile_city
,
113 mapimg_tile_player_func mapimg_tile_unit
,
114 mapimg_plrcolor_count_func mapimg_plrcolor_count
,
115 mapimg_plrcolor_get_func mapimg_plrcolor_get
);
116 void mapimg_reset(void);
117 void mapimg_free(void);
118 int mapimg_count(void);
119 char *mapimg_help(void);
120 const char *mapimg_error(void);
122 bool mapimg_define(const char *maparg
, bool check
);
123 bool mapimg_delete(int id
);
124 bool mapimg_show(int id
, char *str
, size_t str_len
, bool detail
);
125 bool mapimg_id2str(int id
, char *str
, size_t str_len
);
126 bool mapimg_create(struct mapdef
*pmapdef
, bool force
, const char *savename
,
128 bool mapimg_colortest(const char *savename
, const char *path
);
130 struct mapdef
*mapimg_isvalid(int id
);
132 const struct strvec
*mapimg_get_format_list(void);
133 const char *mapimg_get_format_default(void);
137 #endif /* __cplusplus */
139 #endif /* FC__MAPIMG_H */