ttd.c
changeset 126 152df0cc4ac2
parent 123 d550772c61e6
child 136 78ac8de2b2b8
equal deleted inserted replaced
125:3716c3a69f4f 126:152df0cc4ac2
    19 #include "fileio.h"
    19 #include "fileio.h"
    20 #include "hal.h"
    20 #include "hal.h"
    21 #include "airport.h"
    21 #include "airport.h"
    22 #include "saveload.h"
    22 #include "saveload.h"
    23 #include "ai.h"
    23 #include "ai.h"
       
    24 #include "console.h"
    24 
    25 
    25 #include <stdarg.h>
    26 #include <stdarg.h>
    26 
    27 
    27 void GameLoop();
    28 void GameLoop();
    28 
    29 
    72 	va_list va;
    73 	va_list va;
    73 	char buf[1024];
    74 	char buf[1024];
    74 	va_start(va, s);
    75 	va_start(va, s);
    75 	vsprintf(buf, s, va);
    76 	vsprintf(buf, s, va);
    76 	va_end(va);
    77 	va_end(va);
    77 
       
    78 	fprintf(stderr, "dbg: %s\n", buf);
    78 	fprintf(stderr, "dbg: %s\n", buf);
       
    79 	IConsoleDebug((byte *) &buf);
    79 }
    80 }
    80 
    81 
    81 void CDECL ShowInfoF(const char *str, ...)
    82 void CDECL ShowInfoF(const char *str, ...)
    82 {
    83 {
    83 	va_list va;
    84 	va_list va;
   595 			} else {
   596 			} else {
   596 			NetworkCoreConnectGame("auto",_network_server_port);
   597 			NetworkCoreConnectGame("auto",_network_server_port);
   597 			}
   598 			}
   598 		}
   599 		}
   599 
   600 
       
   601 	// initialize the ingame console
       
   602 	IConsoleInit();
       
   603 
   600 	while (_video_driver->main_loop() == ML_SWITCHDRIVER) {}
   604 	while (_video_driver->main_loop() == ML_SWITCHDRIVER) {}
       
   605 
       
   606 	IConsoleFree();
   601 
   607 
   602 	if (_network_available) {
   608 	if (_network_available) {
   603 		// shutdown network-core
   609 		// shutdown network-core
   604 		NetworkCoreShutdown();
   610 		NetworkCoreShutdown();
   605 		}
   611 		}
   635 
   641 
   636 	_opt_mod_ptr = &_new_opt;
   642 	_opt_mod_ptr = &_new_opt;
   637 	GfxLoadSprites();
   643 	GfxLoadSprites();
   638 	LoadStringWidthTable();
   644 	LoadStringWidthTable();
   639 	// Setup main window
   645 	// Setup main window
       
   646 	IConsoleClose();
   640 	InitWindowSystem();
   647 	InitWindowSystem();
   641 	SetupColorsAndInitialWindow();
   648 	SetupColorsAndInitialWindow();
   642 
   649 
   643 	// Generate a world.
   650 	// Generate a world.
   644 	sprintf(filename, "%sopntitle.dat",  _path.data_dir);
   651 	sprintf(filename, "%sopntitle.dat",  _path.data_dir);
   664 	memcpy(&_opt, &_new_opt, sizeof(_opt));
   671 	memcpy(&_opt, &_new_opt, sizeof(_opt));
   665 
   672 
   666 	GfxLoadSprites();
   673 	GfxLoadSprites();
   667 
   674 
   668 	// Reinitialize windows
   675 	// Reinitialize windows
       
   676 	IConsoleClose();
   669 	InitWindowSystem();
   677 	InitWindowSystem();
   670 	LoadStringWidthTable();
   678 	LoadStringWidthTable();
   671 
   679 
   672 	SetupColorsAndInitialWindow();
   680 	SetupColorsAndInitialWindow();
   673 
   681 
   691 	memcpy(&_opt, &_new_opt, sizeof(_opt));
   699 	memcpy(&_opt, &_new_opt, sizeof(_opt));
   692 	
   700 	
   693 	GfxLoadSprites();
   701 	GfxLoadSprites();
   694 
   702 
   695 	// Re-init the windowing system
   703 	// Re-init the windowing system
       
   704 	IConsoleClose();
   696 	InitWindowSystem();
   705 	InitWindowSystem();
   697 
   706 
   698 	// Create toolbars
   707 	// Create toolbars
   699 	SetupColorsAndInitialWindow();
   708 	SetupColorsAndInitialWindow();
   700 
   709 
   725 	memcpy(&_opt, &_new_opt, sizeof(_opt));
   734 	memcpy(&_opt, &_new_opt, sizeof(_opt));
   726 
   735 
   727 	GfxLoadSprites();
   736 	GfxLoadSprites();
   728 
   737 
   729 	// Reinitialize windows
   738 	// Reinitialize windows
       
   739 	IConsoleClose();
   730 	InitWindowSystem();
   740 	InitWindowSystem();
   731 	LoadStringWidthTable();
   741 	LoadStringWidthTable();
   732 
   742 
   733 	SetupColorsAndInitialWindow();
   743 	SetupColorsAndInitialWindow();
   734 
   744