src/landscape.cpp
changeset 9413 7042a8ec3fa8
parent 9358 2e1e4d2f71dd
child 9509 f6d513c5c7e4
equal deleted inserted replaced
9412:163c465bf250 9413:7042a8ec3fa8
   524  * Get the current snow line, either variable or static.
   524  * Get the current snow line, either variable or static.
   525  * @return the snow line height.
   525  * @return the snow line height.
   526  */
   526  */
   527 byte GetSnowLine(void)
   527 byte GetSnowLine(void)
   528 {
   528 {
   529 	if (_snow_line == NULL) return _settings.game_creation.snow_line;
   529 	if (_snow_line == NULL) return _settings_game.game_creation.snow_line;
   530 
   530 
   531 	YearMonthDay ymd;
   531 	YearMonthDay ymd;
   532 	ConvertDateToYMD(_date, &ymd);
   532 	ConvertDateToYMD(_date, &ymd);
   533 	return _snow_line->table[ymd.month][ymd.day];
   533 	return _snow_line->table[ymd.month][ymd.day];
   534 }
   534 }
   537  * Get the highest possible snow line height, either variable or static.
   537  * Get the highest possible snow line height, either variable or static.
   538  * @return the highest snow line height.
   538  * @return the highest snow line height.
   539  */
   539  */
   540 byte HighestSnowLine(void)
   540 byte HighestSnowLine(void)
   541 {
   541 {
   542 	return _snow_line == NULL ? _settings.game_creation.snow_line : _snow_line->highest_value;
   542 	return _snow_line == NULL ? _settings_game.game_creation.snow_line : _snow_line->highest_value;
   543 }
   543 }
   544 
   544 
   545 /**
   545 /**
   546  * Clear the variable snow line table and free the memory.
   546  * Clear the variable snow line table and free the memory.
   547  */
   547  */
   816 void GenerateLandscape(byte mode)
   816 void GenerateLandscape(byte mode)
   817 {
   817 {
   818 	static const int gwp_desert_amount = 4 + 8;
   818 	static const int gwp_desert_amount = 4 + 8;
   819 
   819 
   820 	if (mode == GW_HEIGHTMAP) {
   820 	if (mode == GW_HEIGHTMAP) {
   821 		SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings.game_creation.landscape == LT_TROPIC) ? 1 + gwp_desert_amount : 1);
   821 		SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings_game.game_creation.landscape == LT_TROPIC) ? 1 + gwp_desert_amount : 1);
   822 		LoadHeightmap(_file_to_saveload.name);
   822 		LoadHeightmap(_file_to_saveload.name);
   823 		IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
   823 		IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
   824 	} else if (_settings.game_creation.land_generator == LG_TERRAGENESIS) {
   824 	} else if (_settings_game.game_creation.land_generator == LG_TERRAGENESIS) {
   825 		SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings.game_creation.landscape == LT_TROPIC) ? 3 + gwp_desert_amount : 3);
   825 		SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings_game.game_creation.landscape == LT_TROPIC) ? 3 + gwp_desert_amount : 3);
   826 		GenerateTerrainPerlin();
   826 		GenerateTerrainPerlin();
   827 	} else {
   827 	} else {
   828 		switch (_settings.game_creation.landscape) {
   828 		switch (_settings_game.game_creation.landscape) {
   829 			case LT_ARCTIC: {
   829 			case LT_ARCTIC: {
   830 				SetGeneratingWorldProgress(GWP_LANDSCAPE, 2);
   830 				SetGeneratingWorldProgress(GWP_LANDSCAPE, 2);
   831 
   831 
   832 				uint32 r = Random();
   832 				uint32 r = Random();
   833 
   833 
   870 			default: {
   870 			default: {
   871 				SetGeneratingWorldProgress(GWP_LANDSCAPE, 1);
   871 				SetGeneratingWorldProgress(GWP_LANDSCAPE, 1);
   872 
   872 
   873 				uint32 r = Random();
   873 				uint32 r = Random();
   874 
   874 
   875 				uint i = ScaleByMapSize(GB(r, 0, 7) + (3 - _settings.difficulty.quantity_sea_lakes) * 256 + 100);
   875 				uint i = ScaleByMapSize(GB(r, 0, 7) + (3 - _settings_game.difficulty.quantity_sea_lakes) * 256 + 100);
   876 				for (; i != 0; --i) {
   876 				for (; i != 0; --i) {
   877 					GenerateTerrain(_settings.difficulty.terrain_type, 0);
   877 					GenerateTerrain(_settings_game.difficulty.terrain_type, 0);
   878 				}
   878 				}
   879 				IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
   879 				IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
   880 			} break;
   880 			} break;
   881 		}
   881 		}
   882 	}
   882 	}
   883 
   883 
   884 	ConvertGroundTilesIntoWaterTiles();
   884 	ConvertGroundTilesIntoWaterTiles();
   885 
   885 
   886 	if (_settings.game_creation.landscape == LT_TROPIC) CreateDesertOrRainForest();
   886 	if (_settings_game.game_creation.landscape == LT_TROPIC) CreateDesertOrRainForest();
   887 }
   887 }
   888 
   888 
   889 void OnTick_Town();
   889 void OnTick_Town();
   890 void OnTick_Trees();
   890 void OnTick_Trees();
   891 void OnTick_Station();
   891 void OnTick_Station();