4
4
5
5
#include " MainMenuState.h"
6
6
#include " MainReportsUiState.h"
7
+ #include " GameState.h"
7
8
#include " Route.h"
8
9
9
10
#include " ../Constants/Strings.h"
@@ -178,16 +179,17 @@ const std::map<Difficulty, int> MapViewState::ColonyShipDeorbitMoraleLossMultipl
178
179
};
179
180
180
181
181
- MapViewState::MapViewState (MainReportsUiState& mainReportsState , const std::string& savegame) :
182
+ MapViewState::MapViewState (GameState& gameState , const std::string& savegame) :
182
183
mCrimeRateUpdate{mDifficulty },
183
184
mCrimeExecution {mDifficulty , {this , &MapViewState::onCrimeEvent}},
184
185
mTechnologyReader {" tech0-1.xml" },
185
186
mLoadingExisting {true },
186
187
mExistingToLoad {savegame},
187
- mMainReportsState {mainReportsState},
188
+ mMainReportsState {gameState. mainReportsState () },
188
189
mStructures {" ui/structures.png" , constants::StructureIconSize, constants::MarginTight},
189
190
mRobots {" ui/robots.png" , constants::RobotIconSize, constants::MarginTight},
190
191
mConnections {" ui/structures.png" , constants::StructureIconSize, constants::MarginTight},
192
+ mFileIoDialog {gameState.fileIoDialog ()},
191
193
mPopulationPanel {mPopulation , mPopulationPool , mMorale },
192
194
mResourceInfoBar {mResourcesCount , mPopulation , mMorale , mFood },
193
195
mRobotDeploymentSummary {mRobotPool }
@@ -197,18 +199,19 @@ MapViewState::MapViewState(MainReportsUiState& mainReportsState, const std::stri
197
199
}
198
200
199
201
200
- MapViewState::MapViewState (MainReportsUiState& mainReportsState , const Planet::Attributes& planetAttributes, Difficulty selectedDifficulty) :
202
+ MapViewState::MapViewState (GameState& gameState , const Planet::Attributes& planetAttributes, Difficulty selectedDifficulty) :
201
203
mDifficulty{selectedDifficulty},
202
204
mTileMap {std::make_unique<TileMap>(planetAttributes.mapImagePath , planetAttributes.maxDepth , planetAttributes.maxMines , HostilityMineYields.at (planetAttributes.hostility ))},
203
205
mCrimeRateUpdate {mDifficulty },
204
206
mCrimeExecution {mDifficulty , {this , &MapViewState::onCrimeEvent}},
205
207
mTechnologyReader {" tech0-1.xml" },
206
208
mPlanetAttributes {planetAttributes},
207
- mMainReportsState {mainReportsState},
209
+ mMainReportsState {gameState. mainReportsState () },
208
210
mMapView {std::make_unique<MapView>(*mTileMap )},
209
211
mStructures {" ui/structures.png" , constants::StructureIconSize, constants::MarginTight},
210
212
mRobots {" ui/robots.png" , constants::RobotIconSize, constants::MarginTight},
211
213
mConnections {" ui/structures.png" , constants::StructureIconSize, constants::MarginTight},
214
+ mFileIoDialog {gameState.fileIoDialog ()},
212
215
mPopulationPanel {mPopulation , mPopulationPool , mMorale },
213
216
mPoliceOverlays {static_cast <std::vector<Tile*>::size_type>(mTileMap ->maxDepth () + 1 )},
214
217
mResourceInfoBar {mResourcesCount , mPopulation , mMorale , mFood },
@@ -241,6 +244,7 @@ MapViewState::~MapViewState()
241
244
eventHandler.windowResized ().disconnect ({this , &MapViewState::onWindowResized});
242
245
243
246
NAS2D::Utility<std::map<class MineFacility *, Route>>::get ().clear ();
247
+ mFileIoDialog .fileSaveSignal ().disconnect ({this , &MapViewState::onSaveGame});
244
248
}
245
249
246
250
0 commit comments