src/openttd.cpp
branchcpp_gui
changeset 6308 646711c5feaa
parent 6307 f40e88cff863
equal deleted inserted replaced
6307:f40e88cff863 6308:646711c5feaa
   346 int ttd_main(int argc, char *argv[])
   346 int ttd_main(int argc, char *argv[])
   347 {
   347 {
   348 	int i;
   348 	int i;
   349 	const char *optformat;
   349 	const char *optformat;
   350 	char musicdriver[32], sounddriver[32], videodriver[32];
   350 	char musicdriver[32], sounddriver[32], videodriver[32];
   351 	int resolution[2] = {0,0};
   351 	int resolution[2] = {0, 0};
   352 	Year startyear = INVALID_YEAR;
   352 	Year startyear = INVALID_YEAR;
   353 	uint generation_seed = GENERATE_NEW_SEED;
   353 	uint generation_seed = GENERATE_NEW_SEED;
   354 	bool save_config = true;
   354 	bool save_config = true;
   355 #if defined(ENABLE_NETWORK)
   355 #if defined(ENABLE_NETWORK)
   356 	bool dedicated = false;
   356 	bool dedicated = false;
   377 #if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
   377 #if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
   378 		"f"
   378 		"f"
   379 #endif
   379 #endif
   380 	;
   380 	;
   381 
   381 
   382 	MyGetOptData mgo(argc-1, argv+1, optformat);
   382 	MyGetOptData mgo(argc - 1, argv + 1, optformat);
   383 
   383 
   384 	while ((i = MyGetOpt(&mgo)) != -1) {
   384 	while ((i = MyGetOpt(&mgo)) != -1) {
   385 		switch (i) {
   385 		switch (i) {
   386 		case 'm': ttd_strlcpy(musicdriver, mgo.opt, sizeof(musicdriver)); break;
   386 		case 'm': ttd_strlcpy(musicdriver, mgo.opt, sizeof(musicdriver)); break;
   387 		case 's': ttd_strlcpy(sounddriver, mgo.opt, sizeof(sounddriver)); break;
   387 		case 's': ttd_strlcpy(sounddriver, mgo.opt, sizeof(sounddriver)); break;
  1911 				_m[t].m2 = CalcClosestTownFromTile(t, (uint)-1)->index;
  1911 				_m[t].m2 = CalcClosestTownFromTile(t, (uint)-1)->index;
  1912 			}
  1912 			}
  1913 		}
  1913 		}
  1914 	}
  1914 	}
  1915 
  1915 
       
  1916 	/* A patch option containing the proportion of towns that grow twice as
       
  1917 	 * fast was added in version 54. From version 56 this is now saved in the
       
  1918 	 * town as cities can be built specifically in the scenario editor. */
       
  1919 	if (CheckSavegameVersion(56)) {
       
  1920 		Town *t;
       
  1921 
       
  1922 		FOR_ALL_TOWNS(t) {
       
  1923 			if (_patches.larger_towns != 0 && (t->index % _patches.larger_towns) == 0) {
       
  1924 				t->larger_town = true;
       
  1925 			}
       
  1926 		}
       
  1927 	}
       
  1928 
       
  1929 	if (CheckSavegameVersion(57)) {
       
  1930 		Vehicle *v;
       
  1931 		/* Added a FIFO queue of vehicles loading at stations */
       
  1932 		FOR_ALL_VEHICLES(v) {
       
  1933 			if ((v->type != VEH_TRAIN || IsFrontEngine(v)) &&  // for all locs
       
  1934 					!(v->vehstatus & (VS_STOPPED | VS_CRASHED)) && // not stopped or crashed
       
  1935 					v->current_order.type == OT_LOADING) {         // loading
       
  1936 				GetStation(v->last_station_visited)->loading_vehicles.push_back(v);
       
  1937 			}
       
  1938 		}
       
  1939 	}
       
  1940 
  1916 	return true;
  1941 	return true;
  1917 }
  1942 }
  1918 
  1943 
  1919 /** Reload all NewGRF files during a running game. This is a cut-down
  1944 /** Reload all NewGRF files during a running game. This is a cut-down
  1920  * version of AfterLoadGame().
  1945  * version of AfterLoadGame().