| 10 | { |
| 11 | |
| 12 | void InitialGameStateExtractor::extractFacilities(GameState &state) const |
| 13 | { |
| 14 | auto &data = this->ufo2p; |
| 15 | LogInfo("Number of facility strings: %u", (unsigned)data.facility_names->count()); |
| 16 | LogInfo("Number of facility data chunks: %u", (unsigned)data.facility_data->count()); |
| 17 | |
| 18 | // Start at 2, as 'earth' and 'corridor' are handled specially, this aren't really 'facilities' |
| 19 | // in openapoc terms |
| 20 | for (unsigned i = 2; i < data.facility_names->count(); i++) |
| 21 | { |
| 22 | UString id = data.getFacilityId(i); |
| 23 | auto f = data.facility_data->get(i); |
| 24 | |
| 25 | LogInfo( |
| 26 | "Facility %d: %s cost %d image_offset %d size %d build_time %d maint %d capacity %d", i, |
| 27 | id, (int)f.cost, (int)f.image_offset, (int)f.size, (int)f.build_time, |
| 28 | (int)f.maintainance_cost, (int)f.capacity); |
| 29 | LogInfo("u1 0x%04x u2 0x%04x", (unsigned)f.unknown1, (unsigned)f.unknown2); |
| 30 | |
| 31 | auto facilityType = mksp<FacilityType>(); |
| 32 | facilityType->name = data.facility_names->get(i); |
| 33 | facilityType->buildCost = f.cost; |
| 34 | facilityType->buildTime = f.build_time; |
| 35 | facilityType->weeklyCost = f.maintainance_cost; |
| 36 | // 12 constitution points repair for vehicles |
| 37 | facilityType->capacityAmount = f.capacity == 1 ? 12 : f.capacity; |
| 38 | facilityType->size = f.size; |
| 39 | facilityType->sector = i - 2 + 16 + 15; |
| 40 | facilityType->sprite = fw().data->loadImage( |
| 41 | format("PCK:xcom3/ufodata/base.pck:xcom3/ufodata/base.tab:%d:xcom3/ufodata/base.pcx", |
| 42 | (int)f.image_offset)); |
| 43 | |
| 44 | state.facility_types[id] = facilityType; |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | } // namespace OpenApoc |
no test coverage detected