ttd.c
changeset 919 544f374ee392
parent 865 882569906899
child 921 d4831de060b6
equal deleted inserted replaced
918:c092add72215 919:544f374ee392
   479 	}
   479 	}
   480 
   480 
   481 	res[0] = strtoul(s, NULL, 0);
   481 	res[0] = strtoul(s, NULL, 0);
   482 	res[1] = strtoul(t + 1, NULL, 0);
   482 	res[1] = strtoul(t + 1, NULL, 0);
   483 }
   483 }
       
   484 
       
   485 static void InitializeDynamicVariables(void)
       
   486 {
       
   487 	/* Dynamic stuff needs to be initialized somewhere... */
       
   488 	_stations_size = lengthof(_stations);
       
   489 	_station_sort = NULL;
       
   490 
       
   491 	_vehicles_size = lengthof(_vehicles);
       
   492 	_vehicle_sort = NULL;
       
   493 
       
   494 	_towns_size = lengthof(_towns);
       
   495 	_town_sort = NULL;
       
   496 
       
   497 	_industries_size = lengthof(_industries);
       
   498 	_industry_sort = NULL;
       
   499 }
       
   500 
       
   501 static void UnInitializeDynamicVariables(void)
       
   502 {
       
   503 	/* Dynamic stuff needs to be free'd somewhere... */
       
   504 	free(_station_sort);
       
   505 
       
   506 	free(_vehicle_sort);
       
   507 
       
   508 	free(_town_sort);
       
   509 
       
   510 	free(_industry_sort);
       
   511 }
       
   512 
   484 
   513 
   485 void LoadIntroGame()
   514 void LoadIntroGame()
   486 {
   515 {
   487 	char filename[256];
   516 	char filename[256];
   488 	_game_mode = GM_MENU;
   517 	_game_mode = GM_MENU;
   638 	InitializeScreenshotFormats();
   667 	InitializeScreenshotFormats();
   639 
   668 
   640 	// initialize airport state machines
   669 	// initialize airport state machines
   641 	InitializeAirports();
   670 	InitializeAirports();
   642 
   671 
       
   672 	/* initialize all variables that are allocated dynamically */
       
   673 	InitializeDynamicVariables();
       
   674 
   643 	// Sample catalogue
   675 	// Sample catalogue
   644 	DEBUG(misc, 1) ("Loading sound effects...");
   676 	DEBUG(misc, 1) ("Loading sound effects...");
   645 	_os_version = GetOSVersion();
   677 	_os_version = GetOSVersion();
   646 	MxInitialize(11025, "sample.cat");
   678 	MxInitialize(11025, "sample.cat");
   647 
   679 
   718 
   750 
   719 	SaveToConfig();
   751 	SaveToConfig();
   720 
   752 
   721 	// uninitialize airport state machines
   753 	// uninitialize airport state machines
   722 	UnInitializeAirports();
   754 	UnInitializeAirports();
       
   755 
       
   756 	/* uninitialize variables that are allocated dynamic */
       
   757 	UnInitializeDynamicVariables();
   723 
   758 
   724 	return 0;
   759 	return 0;
   725 }
   760 }
   726 
   761 
   727 static void ShowScreenshotResult(bool b)
   762 static void ShowScreenshotResult(bool b)