openttd.c
changeset 2684 8aba54c245cc
parent 2672 ea469d7b34ff
child 2685 00111d5ca47f
equal deleted inserted replaced
2683:6f67fcf73873 2684:8aba54c245cc
   328 	// The last param of the following function means this:
   328 	// The last param of the following function means this:
   329 	//   a letter means: it accepts that param (e.g.: -h)
   329 	//   a letter means: it accepts that param (e.g.: -h)
   330 	//   a ':' behind it means: it need a param (e.g.: -m<driver>)
   330 	//   a ':' behind it means: it need a param (e.g.: -m<driver>)
   331 	//   a '::' behind it means: it can optional have a param (e.g.: -d<debug>)
   331 	//   a '::' behind it means: it can optional have a param (e.g.: -d<debug>)
   332 	#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
   332 	#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
   333 		optformat = "m:s:v:hDfn::l:eit:d::r:g::G:p:c:";
   333 		optformat = "bm:s:v:hDfn::l:eit:d::r:g::G:p:c:";
   334 	#else
   334 	#else
   335 		optformat = "m:s:v:hDn::l:eit:d::r:g::G:p:c:"; // no fork option
   335 		optformat = "bm:s:v:hDn::l:eit:d::r:g::G:p:c:"; // no fork option
   336 	#endif
   336 	#endif
   337 
   337 
   338 	MyGetOptInit(&mgo, argc-1, argv+1, optformat);
   338 	MyGetOptInit(&mgo, argc-1, argv+1, optformat);
   339 	while ((i = MyGetOpt(&mgo)) != -1) {
   339 	while ((i = MyGetOpt(&mgo)) != -1) {
   340 		switch(i) {
   340 		switch(i) {
   356 					// Optional, you can give an IP
   356 					// Optional, you can give an IP
   357 					network_conn = mgo.opt;
   357 					network_conn = mgo.opt;
   358 				else
   358 				else
   359 					network_conn = NULL;
   359 					network_conn = NULL;
   360 			} break;
   360 			} break;
       
   361 		case 'b': _ai.network_client = true; break;
   361 		case 'r': ParseResolution(resolution, mgo.opt); break;
   362 		case 'r': ParseResolution(resolution, mgo.opt); break;
   362 		case 'l': language = mgo.opt; break;
   363 		case 'l': language = mgo.opt; break;
   363 		case 't': startdate = atoi(mgo.opt); break;
   364 		case 't': startdate = atoi(mgo.opt); break;
   364 		case 'd': {
   365 		case 'd': {
   365 #if defined(WIN32)
   366 #if defined(WIN32)
   393 			showhelp();
   394 			showhelp();
   394 			return 0;
   395 			return 0;
   395 		}
   396 		}
   396 	}
   397 	}
   397 
   398 
       
   399 	if (_ai.network_client && !network) {
       
   400 		_ai.network_client = false;
       
   401 		DEBUG(ai, 0)("[AI] Can't enable network-AI, because '-n' is not used\n");
       
   402 	}
       
   403 
   398 	DeterminePaths();
   404 	DeterminePaths();
   399 	CheckExternalFiles();
   405 	CheckExternalFiles();
   400 
   406 
   401 #ifdef GPMI
   407 #ifdef GPMI
   402 	/* Set the debug proc */
   408 	/* Set the debug proc */
   403 	gpmi_debug_proc    = &gpmi_debug_openttd;
   409 	gpmi_debug_proc = &gpmi_debug_openttd;
   404 
   410 
   405 	/* Initialize GPMI */
   411 	/* Initialize GPMI */
   406 	gpmi_init();
   412 	gpmi_init();
   407 
   413 
   408 	/* Add our paths so we can find our own packages */
   414 	/* Add our paths so we can find our own packages */
   528 	/* uninitialize variables that are allocated dynamic */
   534 	/* uninitialize variables that are allocated dynamic */
   529 	UnInitializeDynamicVariables();
   535 	UnInitializeDynamicVariables();
   530 
   536 
   531 	/* stop the AI */
   537 	/* stop the AI */
   532 	AI_Uninitialize();
   538 	AI_Uninitialize();
       
   539 
       
   540 #ifdef GPMI
       
   541 	/* Uninitialize GPMI */
       
   542 	gpmi_uninit();
       
   543 #endif /* GPMI */
   533 
   544 
   534 	/* Close all and any open filehandles */
   545 	/* Close all and any open filehandles */
   535 	FioCloseAll();
   546 	FioCloseAll();
   536 	UnInitializeGame();
   547 	UnInitializeGame();
   537 
   548