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

Function importGameState

src/OpenLoco/src/S5/S5GameState.cpp:343–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341 }
342
343 std::unique_ptr<OpenLoco::GameState> importGameState(const S5::GameState& src)
344 {
345 auto dst = std::make_unique<OpenLoco::GameState>();
346 importGeneralState(*dst, src.general);
347 for (auto i = 0U; i < std::size(src.companies); i++)
348 {
349 dst->companies[i] = importCompany(src.companies[i]);
350 }
351 for (auto i = 0U; i < std::size(src.towns); i++)
352 {
353 dst->towns[i] = importTown(src.towns[i]);
354 }
355 for (auto i = 0U; i < std::size(src.industries); i++)
356 {
357 dst->industries[i] = importIndustry(src.industries[i]);
358 }
359 for (auto i = 0U; i < std::size(src.stations); i++)
360 {
361 dst->stations[i] = importStation(src.stations[i]);
362 }
363 for (auto i = 0U; i < std::size(src.entities); i++)
364 {
365 dst->entities[i] = importEntity(src.entities[i]);
366 }
367 for (auto i = 0U; i < std::size(src.animations); i++)
368 {
369 dst->animations[i] = importAnimation(src.animations[i]);
370 }
371 for (auto i = 0U; i < std::size(src.waves); i++)
372 {
373 dst->waves[i] = importWave(src.waves[i]);
374 }
375 for (auto i = 0U; i < Limits::kMaxUserStrings; i++)
376 {
377 std::ranges::copy(src.userStrings[i], dst->userStrings[i]);
378 }
379 for (auto i = 0U; i < Limits::kMaxVehicles; i++)
380 {
381 std::ranges::copy(src.routings[i], dst->routings[i]);
382 }
383 std::ranges::copy(src.orders, dst->orders);
384 return dst;
385 }
386}

Callers 1

importSaveToGameStateFunction · 0.85

Calls 8

importGeneralStateFunction · 0.85
importCompanyFunction · 0.85
importTownFunction · 0.85
importIndustryFunction · 0.85
importStationFunction · 0.85
importEntityFunction · 0.85
importAnimationFunction · 0.85
importWaveFunction · 0.85

Tested by

no test coverage detected