forked from github/server
eliminate leak from duplicate call to test_create_buildingtype
This commit is contained in:
parent
ae3210ec87
commit
8e9e9c9c0f
1 changed files with 13 additions and 9 deletions
22
src/tests.c
22
src/tests.c
|
@ -155,15 +155,19 @@ building_type * test_create_buildingtype(const char * name)
|
|||
building_type *btype = bt_get_or_create(name);
|
||||
btype->flags = BTF_NAMECHANGE;
|
||||
btype->_name = _strdup(name);
|
||||
btype->construction = (construction *)calloc(sizeof(construction), 1);
|
||||
btype->construction->skill = SK_BUILDING;
|
||||
btype->construction->maxsize = -1;
|
||||
btype->construction->minskill = 1;
|
||||
btype->construction->reqsize = 1;
|
||||
btype->construction->materials = (requirement *)calloc(sizeof(requirement), 2);
|
||||
btype->construction->materials[1].number = 0;
|
||||
btype->construction->materials[0].number = 1;
|
||||
btype->construction->materials[0].rtype = get_resourcetype(R_STONE);
|
||||
if (!btype->construction) {
|
||||
btype->construction = (construction *)calloc(sizeof(construction), 1);
|
||||
btype->construction->skill = SK_BUILDING;
|
||||
btype->construction->maxsize = -1;
|
||||
btype->construction->minskill = 1;
|
||||
btype->construction->reqsize = 1;
|
||||
}
|
||||
if (!btype->construction->materials) {
|
||||
btype->construction->materials = (requirement *)calloc(sizeof(requirement), 2);
|
||||
btype->construction->materials[1].number = 0;
|
||||
btype->construction->materials[0].number = 1;
|
||||
btype->construction->materials[0].rtype = get_resourcetype(R_STONE);
|
||||
}
|
||||
if (default_locale) {
|
||||
locale_setstring(default_locale, name, name);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue