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
|
@ -63,6 +63,19 @@ const char *terraindata[MAXTERRAINS] = {
|
|||
|
||||
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)
|
||||
{
|
||||
return registered_terrains;
|
||||
|
|
|
@ -67,7 +67,7 @@ extern "C" {
|
|||
struct terrain_production *production;
|
||||
const struct item_type **herbs; /* zero-terminated array of herbs */
|
||||
const char *(*name) (const struct region * r);
|
||||
const struct terrain_type *next;
|
||||
struct terrain_type *next;
|
||||
} terrain_type;
|
||||
|
||||
extern const terrain_type *terrains(void);
|
||||
|
@ -77,6 +77,10 @@ extern "C" {
|
|||
|
||||
extern void init_terrains(void);
|
||||
|
||||
#ifndef DISABLE_TESTS
|
||||
void test_clear_terrains(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue