Freeciv-3.2
Loading...
Searching...
No Matches
mapimg.h
Go to the documentation of this file.
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)
6 any later version.
7
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***********************************************************************/
13
14/****************************************************************************
15 Map images:
16
17 * Basic functions:
18
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.
25
26 * Advanced functions:
27
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. Useful
32 to save the definitions.
33 mapimg_create() ...
34 mapimg_colortest() ...
35
36 These functions return TRUE on success and FALSE on error. In the later
37 case the error message is available with mapimg_error().
38
39 * ...
40
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().
46
47 mapimg_get_format_list() ...
48 mapimg_get_format_default() ...
49
50****************************************************************************/
51
52#ifndef FC__MAPIMG_H
53#define FC__MAPIMG_H
54
55#ifdef __cplusplus
56extern "C" {
57#endif /* __cplusplus */
58
59/* utility */
60#include "support.h"
61
62/* common */
63#include "tile.h"
64
65#define MAX_LEN_MAPDEF 256
66
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). */
89
90typedef enum known_type
91 (*mapimg_tile_known_func)(const struct tile *ptile,
92 const struct player *pplayer,
93 bool knowledge);
94typedef struct terrain
95 *(*mapimg_tile_terrain_func)(const struct tile *ptile,
96 const struct player *pplayer,
97 bool knowledge);
98typedef struct player
99 *(*mapimg_tile_player_func)(const struct tile *ptile,
100 const struct player *pplayer,
101 bool knowledge);
102
104typedef struct rgbcolor *(*mapimg_plrcolor_get_func)(int);
105
106/* map definition */
107struct mapdef;
108
116void mapimg_reset(void);
117void mapimg_free(void);
118bool mapimg_initialised(void);
119int mapimg_count(void);
120char *mapimg_help(const char *cmdname);
121const char *mapimg_error(void);
122
123bool mapimg_define(const char *maparg, bool check);
124bool mapimg_delete(int id);
125bool mapimg_show(int id, char *str, size_t str_len, bool detail);
126bool mapimg_id2str(int id, char *str, size_t str_len);
127bool mapimg_create(struct mapdef *pmapdef, bool force, const char *savename,
128 const char *path);
129bool mapimg_colortest(const char *savename, const char *path);
130
131struct mapdef *mapimg_isvalid(int id);
132
133const struct strvec *mapimg_get_format_list(void);
134const char *mapimg_get_format_default(void);
135
136#ifdef __cplusplus
137}
138#endif /* __cplusplus */
139
140#endif /* FC__MAPIMG_H */
#define str
Definition astring.c:76
char * incite_cost
Definition comments.c:75
mapimg_tile_player_func mapimg_tile_owner
Definition mapimg.c:488
mapimg_tile_terrain_func mapimg_tile_terrain
Definition mapimg.c:487
mapimg_tile_player_func mapimg_tile_city
Definition mapimg.c:489
mapimg_tile_player_func mapimg_tile_unit
Definition mapimg.c:490
mapimg_tile_known_func mapimg_tile_known
Definition mapimg.c:486
mapimg_plrcolor_get_func mapimg_plrcolor_get
Definition mapimg.c:492
mapimg_plrcolor_count_func mapimg_plrcolor_count
Definition mapimg.c:491
bool mapimg_id2str(int id, char *str, size_t str_len)
Definition mapimg.c:1311
void mapimg_free(void)
Definition mapimg.c:558
const char * mapimg_get_format_default(void)
Definition mapimg.c:1190
bool mapimg_initialised(void)
Definition mapimg.c:1555
bool mapimg_colortest(const char *savename, const char *path)
Definition mapimg.c:1438
struct mapdef * mapimg_isvalid(int id)
Definition mapimg.c:1121
struct rgbcolor *(* mapimg_plrcolor_get_func)(int)
Definition mapimg.h:104
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)
Definition mapimg.c:506
const struct strvec * mapimg_get_format_list(void)
Definition mapimg.c:1153
bool mapimg_define(const char *maparg, bool check)
Definition mapimg.c:769
bool mapimg_delete(int id)
Definition mapimg.c:1204
int mapimg_count(void)
Definition mapimg.c:573
int(* mapimg_plrcolor_count_func)(void)
Definition mapimg.h:103
enum known_type(* mapimg_tile_known_func)(const struct tile *ptile, const struct player *pplayer, bool knowledge)
Definition mapimg.h:91
struct terrain *(* mapimg_tile_terrain_func)(const struct tile *ptile, const struct player *pplayer, bool knowledge)
Definition mapimg.h:95
struct player *(* mapimg_tile_player_func)(const struct tile *ptile, const struct player *pplayer, bool knowledge)
Definition mapimg.h:99
bool mapimg_create(struct mapdef *pmapdef, bool force, const char *savename, const char *path)
Definition mapimg.c:1332
const char * mapimg_error(void)
Definition mapimg.c:759
void mapimg_reset(void)
Definition mapimg.c:541
bool mapimg_show(int id, char *str, size_t str_len, bool detail)
Definition mapimg.c:1223
char * mapimg_help(const char *cmdname)
Definition mapimg.c:603
char maparg[MAX_LEN_MAPARG]
Definition mapimg.c:321
Definition tile.h:50
known_type
Definition tile.h:35