src/heightmap.cpp
branchnoai
changeset 10776 07203fc29812
parent 10715 6bdf79ffb022
equal deleted inserted replaced
10774:2c882f0468f2 10776:07203fc29812
   295 	uint img_scale;
   295 	uint img_scale;
   296 	uint img_row, img_col;
   296 	uint img_row, img_col;
   297 	TileIndex tile;
   297 	TileIndex tile;
   298 
   298 
   299 	/* Get map size and calculate scale and padding values */
   299 	/* Get map size and calculate scale and padding values */
   300 	switch (_settings.game_creation.heightmap_rotation) {
   300 	switch (_settings_game.game_creation.heightmap_rotation) {
   301 		default: NOT_REACHED();
   301 		default: NOT_REACHED();
   302 		case HM_COUNTER_CLOCKWISE:
   302 		case HM_COUNTER_CLOCKWISE:
   303 			width   = MapSizeX();
   303 			width   = MapSizeX();
   304 			height  = MapSizeY();
   304 			height  = MapSizeY();
   305 			break;
   305 			break;
   320 	}
   320 	}
   321 
   321 
   322 	/* Form the landscape */
   322 	/* Form the landscape */
   323 	for (row = 0; row < height - 1; row++) {
   323 	for (row = 0; row < height - 1; row++) {
   324 		for (col = 0; col < width - 1; col++) {
   324 		for (col = 0; col < width - 1; col++) {
   325 			switch (_settings.game_creation.heightmap_rotation) {
   325 			switch (_settings_game.game_creation.heightmap_rotation) {
   326 				default: NOT_REACHED();
   326 				default: NOT_REACHED();
   327 				case HM_COUNTER_CLOCKWISE: tile = TileXY(col, row); break;
   327 				case HM_COUNTER_CLOCKWISE: tile = TileXY(col, row); break;
   328 				case HM_CLOCKWISE:         tile = TileXY(row, col); break;
   328 				case HM_CLOCKWISE:         tile = TileXY(row, col); break;
   329 			}
   329 			}
   330 
   330 
   335 				SetTileHeight(tile, 0);
   335 				SetTileHeight(tile, 0);
   336 			} else {
   336 			} else {
   337 				/* Use nearest neighbor resizing to scale map data.
   337 				/* Use nearest neighbor resizing to scale map data.
   338 				 *  We rotate the map 45 degrees (counter)clockwise */
   338 				 *  We rotate the map 45 degrees (counter)clockwise */
   339 				img_row = (((row - row_pad) * num_div) / img_scale);
   339 				img_row = (((row - row_pad) * num_div) / img_scale);
   340 				switch (_settings.game_creation.heightmap_rotation) {
   340 				switch (_settings_game.game_creation.heightmap_rotation) {
   341 					default: NOT_REACHED();
   341 					default: NOT_REACHED();
   342 					case HM_COUNTER_CLOCKWISE:
   342 					case HM_COUNTER_CLOCKWISE:
   343 						img_col = (((width - 1 - col - col_pad) * num_div) / img_scale);
   343 						img_col = (((width - 1 - col - col_pad) * num_div) / img_scale);
   344 						break;
   344 						break;
   345 					case HM_CLOCKWISE:
   345 					case HM_CLOCKWISE: