-
Notifications
You must be signed in to change notification settings - Fork 4
/
region.h
73 lines (60 loc) · 1.78 KB
/
region.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* Atlantis v1.0 13 September 1993
* Copyright 1993 by Russell Wallace
*
* This program may be freely used, modified and distributed. It may not be
* sold or used commercially without prior written permission from the author.
*/
#ifndef ATL_REGION_H
#define ATL_REGION_H
#include "settings.h"
#include "bool.h"
struct building;
struct ship;
struct unit;
typedef struct terrain {
char * name;
int foodproductivity; /* work */
int maxfoodoutput; /* food */
int maxoutput[4]; /* output */
} terrain;
typedef enum {
T_OCEAN,
T_PLAIN,
T_MOUNTAIN,
T_FOREST,
T_SWAMP,
} terrain_t;
#define NUMTERRAINS 5
extern const char *terrainnames[];
typedef struct region {
unsigned int uid;
int x, y;
char * name_;
struct region *connect[MAXDIRECTIONS];
const struct terrain * terrain;
int peasants;
int money;
struct quicklist *buildings;
struct quicklist *ships;
struct unit *units;
int immigrants;
struct region *nexthash_;
} region;
extern struct quicklist *regions;
struct region * create_region(unsigned int uid, int x, int y, const struct terrain *t);
void free_region(struct region *r);
struct region * findregion(int x, int y);
struct region * get_region(unsigned int uid);
void free_regions(void);
const char * region_getname(const struct region *r);
void region_setname(struct region *r, const char *name);
void region_addunit(struct region *r, struct unit *u, struct unit **hint);
bool region_rmunit(struct region *r, struct unit *u, struct unit **hint);
bool region_isocean(const struct region *r);
void free_terrain(terrain *t);
struct terrain *create_terrain(const char * name);
struct terrain *get_terrain(terrain_t t);
struct terrain *get_terrain_by_name(const char *name);
void free_terrains(void);
#endif