From e27d12d7888c6559d9d9a1434b485f158c561dd3 Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 12 Mar 2009 15:14:22 +0000 Subject: (svn r15689) -Fix [FS#2720]: do not crash when the generate map doesn't contain a suitable location for a town. --- src/genworld.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/genworld.cpp') 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); } /** -- cgit v1.2.3-54-g00ecf