MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / importGeneralState

Function importGeneralState

src/OpenLoco/src/S5/S5GameState.cpp:227–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225 }
226
227 static void importGeneralState(OpenLoco::GameState& dst, const S5::GeneralState& src)
228 {
229 dst.rng = Core::Prng(src.rng[0], src.rng[1]);
230 dst.unkRng = Core::Prng(src.unkRng[0], src.unkRng[1]);
231 dst.flags = static_cast<GameStateFlags>(src.flags);
232 dst.currentDay = src.currentDay;
233 dst.dayCounter = src.dayCounter;
234 dst.currentYear = src.currentYear;
235 dst.currentMonth = src.currentMonth;
236 dst.currentDayOfMonth = src.currentDayOfMonth;
237 dst.savedViewX = src.savedViewX;
238 dst.savedViewY = src.savedViewY;
239 dst.savedViewZoom = src.savedViewZoom;
240 dst.savedViewRotation = src.savedViewRotation;
241 for (auto i = 0U; i < std::size(dst.playerCompanies); ++i)
242 {
243 dst.playerCompanies[i] = static_cast<CompanyId>(src.playerCompanies[i]);
244 }
245 for (auto i = 0U; i < std::size(src.entityListHeads); ++i)
246 {
247 dst.entityListHeads[i] = static_cast<EntityId>(src.entityListHeads[i]);
248 }
249 std::ranges::copy(src.entityListCounts, dst.entityListCounts);
250 std::ranges::copy(src.currencyMultiplicationFactor, dst.currencyMultiplicationFactor);
251 std::ranges::copy(src.unusedCurrencyMultiplicationFactor, dst.unusedCurrencyMultiplicationFactor);
252 dst.scenarioTicks = src.scenarioTicks;
253 dst.var_014A = src.var_014A;
254 dst.scenarioTicks2 = src.scenarioTicks2;
255 dst.magicNumber = src.magicNumber;
256 dst.numMapAnimations = src.numMapAnimations;
257 dst.tileUpdateStartLocation = src.tileUpdateStartLocation;
258 dst.scenarioConstruction = importConstruction(src.scenarioConstruction);
259 dst.lastRailroadOption = src.lastRailroadOption;
260 dst.lastRoadOption = src.lastRoadOption;
261 dst.lastAirport = src.lastAirport;
262 dst.lastShipPort = src.lastShipPort;
263 dst.trafficHandedness = src.trafficHandedness;
264 dst.lastVehicleType = static_cast<VehicleType>(src.lastVehicleType);
265 dst.pickupDirection = src.pickupDirection;
266 dst.lastTreeOption = src.lastTreeOption;
267 dst.seaLevel = src.seaLevel;
268 dst.currentSnowLine = src.currentSnowLine;
269 dst.currentSeason = static_cast<Scenario::Season>(src.currentSeason);
270 dst.lastLandOption = src.lastLandOption;
271 dst.maxCompetingCompanies = src.maxCompetingCompanies;
272 dst.orderTableLength = src.orderTableLength;
273 dst.roadObjectIdIsAnyRoadTypeCompatible = src.roadObjectIdIsAnyRoadTypeCompatible;
274 dst.roadObjectIdIsUsableByAllCompanies = src.roadObjectIdIsUsableByAllCompanies;
275 dst.currentDefaultLevelCrossingType = src.currentDefaultLevelCrossingType;
276 dst.lastTrackTypeOption = src.lastTrackTypeOption;
277 dst.loanInterestRate = src.loanInterestRate;
278 dst.lastIndustryOption = src.lastIndustryOption;
279 dst.lastBuildingOption = src.lastBuildingOption;
280 dst.lastMiscBuildingOption = src.lastMiscBuildingOption;
281 dst.lastWallOption = src.lastWallOption;
282 dst.produceAICompanyTimeout = src.produceAICompanyTimeout;
283 dst.tickStartPrngState = Core::Prng(src.tickStartPrngState[0], src.tickStartPrngState[1]);
284 std::ranges::copy(src.scenarioFileName, dst.scenarioFileName);

Callers 1

importGameStateFunction · 0.85

Calls 4

PrngClass · 0.85
importConstructionFunction · 0.85
importRecordsFunction · 0.85
importMessageFunction · 0.85

Tested by

no test coverage detected