diff options
author | rubidium <rubidium@openttd.org> | 2009-03-12 15:14:22 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-03-12 15:14:22 +0000 |
commit | d5a2dc1d0bf5af3b09965cbe11e8238432af05c1 (patch) | |
tree | 749827fe49c1c25840ad4c242c3dbc62d2922c2a /src/genworld.cpp | |
parent | 9dbf8a163f20e8d77dc97703dbfc180b91359873 (diff) | |
download | openttd-d5a2dc1d0bf5af3b09965cbe11e8238432af05c1.tar.xz |
(svn r15689) -Fix [FS#2720]: do not crash when the generate map doesn't contain a suitable location for a town.
Diffstat (limited to 'src/genworld.cpp')
-rw-r--r-- | src/genworld.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/genworld.cpp b/src/genworld.cpp index f8a865397..dfae4822e 100644 --- a/src/genworld.cpp +++ b/src/genworld.cpp @@ -141,7 +141,10 @@ static void _GenerateWorld(void *arg) /* only generate towns, tree and industries in newgame mode. */ if (_game_mode != GM_EDITOR) { - GenerateTowns(_settings_game.economy.town_layout); + if (!GenerateTowns(_settings_game.economy.town_layout)) { + HandleGeneratingWorldAbortion(); + return; + } GenerateIndustries(); GenerateUnmovables(); GenerateTrees(); @@ -255,7 +258,10 @@ void HandleGeneratingWorldAbortion() CleanupGeneration(); - _gw.thread->Exit(); + if (_gw.thread != NULL) _gw.thread->Exit(); + + extern void SwitchToMode(SwitchMode new_mode); + SwitchToMode(_switch_mode); } /** |