+ g_term_console.setup(&iface, &kill, admin_nick);
+
+ g_term_console.start();
+
+ server.start();
+ // Run server
+ dedicated_server_loop(server, kill);
+ } catch (const ModError &e) {
+ g_term_console.stopAndWaitforThread();
+ errorstream << "ModError: " << e.what() << std::endl;
+ return false;
+ } catch (const ServerError &e) {
+ g_term_console.stopAndWaitforThread();
+ errorstream << "ServerError: " << e.what() << std::endl;
+ return false;
+ }
+
+ // Tell the console to stop, and wait for it to finish,
+ // only then leave context and free iface
+ g_term_console.stop();
+ g_term_console.wait();
+
+ g_term_console.clearKillStatus();
+ } else {
+#else
+ errorstream << "Cmd arg --terminal passed, but "
+ << "compiled without ncurses. Ignoring." << std::endl;
+ } {
+#endif
+ try {
+ // Create server
+ Server server(game_params.world_path, game_params.game_spec, false,
+ bind_addr, true);
+ server.start();
+
+ // Run server
+ bool &kill = *porting::signal_handler_killstatus();
+ dedicated_server_loop(server, kill);
+
+ } catch (const ModError &e) {
+ errorstream << "ModError: " << e.what() << std::endl;
+ return false;
+ } catch (const ServerError &e) {
+ errorstream << "ServerError: " << e.what() << std::endl;
+ return false;
+ }
+ }