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

Function exportGameState

src/OpenLoco/src/S5/S5GameState.cpp:143–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141 }
142
143 std::unique_ptr<S5::GameState> exportGameState(const OpenLoco::GameState& src)
144 {
145 auto dst = std::make_unique<S5::GameState>();
146 dst->general = exportGeneralState(src);
147 for (auto i = 0U; i < std::size(src.companies); i++)
148 {
149 dst->companies[i] = exportCompany(src.companies[i]);
150 }
151 for (auto i = 0U; i < std::size(src.towns); i++)
152 {
153 dst->towns[i] = exportTown(src.towns[i]);
154 }
155 for (auto i = 0U; i < std::size(src.industries); i++)
156 {
157 dst->industries[i] = exportIndustry(src.industries[i]);
158 }
159 for (auto i = 0U; i < std::size(src.stations); i++)
160 {
161 dst->stations[i] = exportStation(src.stations[i]);
162 }
163 for (auto i = 0U; i < std::size(src.entities); i++)
164 {
165 dst->entities[i] = exportEntity(src.entities[i]);
166 }
167 for (auto i = 0U; i < std::size(src.animations); i++)
168 {
169 dst->animations[i] = exportAnimation(src.animations[i]);
170 }
171 for (auto i = 0U; i < std::size(src.waves); i++)
172 {
173 dst->waves[i] = exportWave(src.waves[i]);
174 }
175 for (auto i = 0U; i < Limits::kMaxUserStrings; i++)
176 {
177 std::ranges::copy(src.userStrings[i], dst->userStrings[i]);
178 }
179 for (auto i = 0U; i < Limits::kMaxVehicles; i++)
180 {
181 std::ranges::copy(src.routings[i], dst->routings[i]);
182 }
183 std::ranges::copy(src.orders, dst->orders);
184 return dst;
185 }
186
187 std::unique_ptr<S5::GameState> importGameStateType2(const S5::GameStateType2& src)
188 {

Callers

nothing calls this directly

Calls 8

exportGeneralStateFunction · 0.85
exportCompanyFunction · 0.85
exportTownFunction · 0.85
exportIndustryFunction · 0.85
exportStationFunction · 0.85
exportEntityFunction · 0.85
exportAnimationFunction · 0.85
exportWaveFunction · 0.85

Tested by

no test coverage detected