forked from github/server
Let tests clean up after/before themselves, so terrains can be created by each.
This commit is contained in:
parent
315066309a
commit
5afb83c193
2 changed files with 18 additions and 1 deletions
|
@ -63,6 +63,19 @@ const char *terraindata[MAXTERRAINS] = {
|
||||||
|
|
||||||
static terrain_type *registered_terrains;
|
static terrain_type *registered_terrains;
|
||||||
|
|
||||||
|
#ifndef DISABLE_TESTS
|
||||||
|
void test_clear_terrains(void)
|
||||||
|
{
|
||||||
|
while (registered_terrains) {
|
||||||
|
terrain_type * t = registered_terrains;
|
||||||
|
registered_terrains = t->next;
|
||||||
|
free(t->_name);
|
||||||
|
free(t->production);
|
||||||
|
free(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const terrain_type *terrains(void)
|
const terrain_type *terrains(void)
|
||||||
{
|
{
|
||||||
return registered_terrains;
|
return registered_terrains;
|
||||||
|
|
|
@ -67,7 +67,7 @@ extern "C" {
|
||||||
struct terrain_production *production;
|
struct terrain_production *production;
|
||||||
const struct item_type **herbs; /* zero-terminated array of herbs */
|
const struct item_type **herbs; /* zero-terminated array of herbs */
|
||||||
const char *(*name) (const struct region * r);
|
const char *(*name) (const struct region * r);
|
||||||
const struct terrain_type *next;
|
struct terrain_type *next;
|
||||||
} terrain_type;
|
} terrain_type;
|
||||||
|
|
||||||
extern const terrain_type *terrains(void);
|
extern const terrain_type *terrains(void);
|
||||||
|
@ -77,6 +77,10 @@ extern "C" {
|
||||||
|
|
||||||
extern void init_terrains(void);
|
extern void init_terrains(void);
|
||||||
|
|
||||||
|
#ifndef DISABLE_TESTS
|
||||||
|
void test_clear_terrains(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue