home · contact · privacy
45ddeaf3da448fb9ddbbd934c6d3b9474e8454d3
[plomrogue] / src / server / map.h
1 /* src/server/map.h
2  *
3  * Struct for the game map and routines to create and scroll on it.
4  */
5
6 #ifndef MAP_H
7 #define MAP_H
8
9 #include <stdint.h> /* uint8_t */
10 #include "../common/yx_uint8.h" /* yx_uint8 struct */
11 #include "../common/yx_uint16.h" /* yx_uint16 struct */
12
13
14
15 struct Map
16 {
17     struct yx_uint16 size; /* Map's height/width (use max. 256x256)! */
18     char * cells; /* Sequence of bytes encoding map cells. */
19 };
20
21
22
23 /* Initialize island map "~" cells representing water and "." cells representing
24  * land. The island shape is built randomly by starting with a sea of one land
25  * cell in the middle, then going into a cycle of repeatedly selecting a random
26  * seal cell and transforming it into land if it is neighbor to land; the cycle
27  * ends when a land cell is due to be created right at the border of the map.
28  * Lots of 'X' cells representing trees are put on the island, too.
29  */
30 extern void init_map();
31
32 /* Check if coordinate "pos" on (or beyond) world.map is accessible to map
33  * object movement.
34  */
35 extern uint8_t is_passable(struct yx_uint8 pos);
36
37
38
39 #endif