120 void StartupDisasters(void); |
120 void StartupDisasters(void); |
121 void GenerateTrees(void); |
121 void GenerateTrees(void); |
122 |
122 |
123 void ConvertGroundTilesIntoWaterTiles(void); |
123 void ConvertGroundTilesIntoWaterTiles(void); |
124 |
124 |
125 void InitializeGame(uint size_x, uint size_y) |
125 void InitializeGame(int mode, uint size_x, uint size_y) |
126 { |
126 { |
127 AllocateMap(size_x, size_y); |
127 AllocateMap(size_x, size_y); |
128 |
128 |
129 AddTypeToEngines(); // make sure all engines have a type |
129 AddTypeToEngines(); // make sure all engines have a type |
130 |
130 |
187 |
187 |
188 // Make sure everything is done via OWNER_NONE |
188 // Make sure everything is done via OWNER_NONE |
189 _current_player = OWNER_NONE; |
189 _current_player = OWNER_NONE; |
190 |
190 |
191 _generating_world = true; |
191 _generating_world = true; |
192 InitializeGame(size_x, size_y); |
192 InitializeGame(mode == GW_RANDOM ? 0 : IG_DATE_RESET, size_x, size_y); |
193 SetObjectToPlace(SPR_CURSOR_ZZZ, 0, 0, 0); |
193 SetObjectToPlace(SPR_CURSOR_ZZZ, 0, 0, 0); |
194 |
194 |
195 // Must start economy early because of the costs. |
195 // Must start economy early because of the costs. |
196 StartupEconomy(); |
196 StartupEconomy(); |
197 |
197 |
198 // Don't generate landscape items when in the scenario editor. |
198 // Don't generate landscape items when in the scenario editor. |
199 if (mode == 1) { |
199 if (mode == GW_EMPTY) { |
200 // empty world in scenario editor |
200 // empty world in scenario editor |
201 ConvertGroundTilesIntoWaterTiles(); |
201 ConvertGroundTilesIntoWaterTiles(); |
202 } else { |
202 } else { |
203 GenerateLandscape(); |
203 GenerateLandscape(); |
204 GenerateClearTile(); |
204 GenerateClearTile(); |
205 |
205 |
206 // only generate towns, tree and industries in newgame mode. |
206 // only generate towns, tree and industries in newgame mode. |
207 if (mode == 0) { |
207 if (mode == GW_NEWGAME) { |
208 GenerateTowns(); |
208 GenerateTowns(); |
209 GenerateTrees(); |
209 GenerateTrees(); |
210 GenerateIndustries(); |
210 GenerateIndustries(); |
211 GenerateUnmovables(); |
211 GenerateUnmovables(); |
212 } |
212 } |