43 #define MAZE_SIZE_MEDIUM_ISLANDS 4 |
43 #define MAZE_SIZE_MEDIUM_ISLANDS 4 |
44 #define MAZE_SIZE_LARGE_ISLANDS 5 |
44 #define MAZE_SIZE_LARGE_ISLANDS 5 |
45 |
45 |
46 /** |
46 /** |
47 * Data structure for defining a map. This contains the whole recipe to |
47 * Data structure for defining a map. This contains the whole recipe to |
48 * exactly recreate a particular map. For named maps, you also need the |
48 * exactly recreate a particular map. |
49 * corresponding files. |
|
50 * |
49 * |
51 * The required fields depend on the map generator, see the comments |
50 * The required fields depend on the map generator, see the comments |
52 * at the struct for details. |
51 * at the struct for details. |
53 */ |
52 */ |
54 typedef struct { |
53 typedef struct { |
55 int _referenceCount; |
|
56 int mapgen; // Always one of the MAPGEN_ constants |
54 int mapgen; // Always one of the MAPGEN_ constants |
57 char *name; // The name of the map for MAPGEN_NAMED, otherwise one of "+rnd+", "+maze+" or "+drawn+". |
55 char *name; // The name of the map for MAPGEN_NAMED (e.g. "Cogs"), otherwise one of "+rnd+", "+maze+" or "+drawn+". |
58 char *seed; // Used for all maps |
56 char *seed; // Used for all maps. This is a random seed for all (non-AI) entropy in the round. Typically a random UUID, but can be any string. |
59 char *theme; // Used for all maps |
57 char *theme; // Used for all maps. This is the name of a directory in Data/Themes (e.g. "Beach") |
60 uint8_t *drawData; // Used for MAPGEN_DRAWN |
58 uint8_t *drawData; // Used for MAPGEN_DRAWN |
61 int drawDataSize; // Used for MAPGEN_DRAWN TODO size_t |
59 size_t drawDataSize; // Used for MAPGEN_DRAWN |
62 int templateFilter; // Used for MAPGEN_REGULAR |
60 int templateFilter; // Used for MAPGEN_REGULAR. One of the TEMPLATEFILTER_xxx constants. |
63 int mazeSize; // Used for MAPGEN_MAZE |
61 int mazeSize; // Used for MAPGEN_MAZE. One of the MAZE_SIZE_xxx constants. |
64 } flib_map; |
62 } flib_map; |
65 |
63 |
66 /** |
64 /** |
67 * Create a generated map. theme should be the name of a |
65 * Create a generated map. theme should be the name of a |
68 * directory in "Themes" and templateFilter should be one of the |
66 * directory in "Themes" and templateFilter should be one of the |
106 * Create a deep copy of the map. Returns NULL on failure or if NULL was passed. |
104 * Create a deep copy of the map. Returns NULL on failure or if NULL was passed. |
107 */ |
105 */ |
108 flib_map *flib_map_copy(const flib_map *map); |
106 flib_map *flib_map_copy(const flib_map *map); |
109 |
107 |
110 /** |
108 /** |
111 * Increase the reference count of the object. Call this if you store a pointer to it somewhere. |
|
112 * Returns the parameter. |
|
113 */ |
|
114 flib_map *flib_map_retain(flib_map *map); |
|
115 |
|
116 /** |
|
117 * Decrease the reference count of the object and free it if this was the last reference. |
109 * Decrease the reference count of the object and free it if this was the last reference. |
118 */ |
110 */ |
119 void flib_map_release(flib_map *map); |
111 void flib_map_destroy(flib_map *map); |
120 |
112 |
121 |
113 |
122 #endif |
114 #endif |