| 6 | namespace OpenLoco::S5 |
| 7 | { |
| 8 | S5::Company exportCompany(const OpenLoco::Company& src) |
| 9 | { |
| 10 | S5::Company dst{}; |
| 11 | dst.name = src.name; |
| 12 | dst.ownerName = src.ownerName; |
| 13 | dst.challengeFlags = enumValue(src.challengeFlags); |
| 14 | dst.cash = src.cash; |
| 15 | dst.currentLoan = src.currentLoan; |
| 16 | dst.updateCounter = src.updateCounter; |
| 17 | dst.performanceIndex = src.performanceIndex; |
| 18 | dst.competitorId = src.competitorId; |
| 19 | dst.ownerEmotion = enumValue(src.ownerEmotion); |
| 20 | dst.mainColours[0] = enumValue(src.mainColours.primary); |
| 21 | dst.mainColours[1] = enumValue(src.mainColours.secondary); |
| 22 | for (auto i = 0U; i < std::size(src.vehicleColours); ++i) |
| 23 | { |
| 24 | dst.vehicleColours[i][0] = enumValue(src.vehicleColours[i].primary); |
| 25 | dst.vehicleColours[i][1] = enumValue(src.vehicleColours[i].secondary); |
| 26 | } |
| 27 | dst.customVehicleColoursSet = src.customVehicleColoursSet; |
| 28 | for (auto i = 0U; i < 224; ++i) |
| 29 | { |
| 30 | dst.unlockedVehicles[i / 32] |= src.unlockedVehicles[i] << static_cast<uint32_t>((i % 32)); |
| 31 | } |
| 32 | dst.availableVehicles = src.availableVehicles; |
| 33 | dst.aiPlaystyleFlags = enumValue(src.aiPlaystyleFlags); |
| 34 | dst.aiPlaystyleTownId = src.aiPlaystyleTownId; |
| 35 | dst.numExpenditureYears = src.numExpenditureYears; |
| 36 | std::memcpy(dst.expenditures, src.expenditures, kExpenditureHistoryCapacity * ExpenditureType::Count * sizeof(currency32_t)); |
| 37 | dst.startedDate = src.startedDate; |
| 38 | dst.var_49C = src.var_49C; |
| 39 | dst.var_4A0 = src.var_4A0; |
| 40 | dst.var_4A4 = enumValue(src.var_4A4); |
| 41 | dst.var_4A5 = src.var_4A5; |
| 42 | dst.var_4A6 = enumValue(src.var_4A6); |
| 43 | dst.var_4A7 = src.var_4A7; |
| 44 | |
| 45 | // Copy AI thoughts |
| 46 | for (auto i = 0U; i < kMaxAiThoughts; ++i) |
| 47 | { |
| 48 | auto& srcThought = src.aiThoughts[i]; |
| 49 | auto& dstThought = dst.aiThoughts[i]; |
| 50 | |
| 51 | dstThought.type = enumValue(srcThought.type); |
| 52 | dstThought.destinationA = srcThought.destinationA; |
| 53 | dstThought.destinationB = srcThought.destinationB; |
| 54 | dstThought.numStations = srcThought.numStations; |
| 55 | dstThought.stationLength = srcThought.stationLength; |
| 56 | |
| 57 | for (auto j = 0U; j < std::size(srcThought.stations); ++j) |
| 58 | { |
| 59 | dstThought.stations[j].id = enumValue(srcThought.stations[j].id); |
| 60 | dstThought.stations[j].var_02 = enumValue(srcThought.stations[j].var_02); |
| 61 | dstThought.stations[j].rotation = srcThought.stations[j].rotation; |
| 62 | dstThought.stations[j].pos = srcThought.stations[j].pos; |
| 63 | dstThought.stations[j].baseZ = srcThought.stations[j].baseZ; |
| 64 | dstThought.stations[j].var_9 = srcThought.stations[j].var_9; |
| 65 | dstThought.stations[j].var_A = srcThought.stations[j].var_A; |
no test coverage detected