Beispiel #1
0
building_type * test_create_buildingtype(const char * name)
{
  building_type * btype = (building_type*)calloc(sizeof(building_type), 1);
  btype->flags = BTF_NAMECHANGE;
  btype->_name = _strdup(name);
  locale_setstring(default_locale, name, name);
  bt_register(btype);
  return btype;
}
building_type *bt_get_or_create(const char *name)
{
    if (name != NULL) {
        building_type *btype = bt_find_i(name);
        if (btype == NULL) {
            btype = calloc(sizeof(building_type), 1);
            btype->_name = _strdup(name);
            btype->auraregen = 1.0;
            btype->maxsize = -1;
            btype->capacity = 1;
            btype->maxcapacity = -1;
            bt_register(btype);
        }
        return btype;
    }
    return NULL;
}