Changeset - r15130:14678fa8b7ef
[Not reviewed]
master
0 3 0
frosch - 14 years ago 2010-05-08 14:43:59
frosch@openttd.org
(svn r19769) -Fix [FS#3820]: MV_VOID tiles shall have no tropic zone.
3 files changed with 12 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/landscape.cpp
Show inline comments
 
@@ -822,42 +822,46 @@ static void GenerateTerrain(int type, ui
 

	
 

	
 
#include "table/genland.h"
 

	
 
static void CreateDesertOrRainForest()
 
{
 
	TileIndex update_freq = MapSize() / 4;
 
	const TileIndexDiffC *data;
 

	
 
	for (TileIndex tile = 0; tile != MapSize(); ++tile) {
 
		if ((tile % update_freq) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
 

	
 
		if (!IsValidTile(tile)) continue;
 

	
 
		for (data = _make_desert_or_rainforest_data;
 
				data != endof(_make_desert_or_rainforest_data); ++data) {
 
			TileIndex t = AddTileIndexDiffCWrap(tile, *data);
 
			if (t != INVALID_TILE && (TileHeight(t) >= 4 || IsTileType(t, MP_WATER))) break;
 
		}
 
		if (data == endof(_make_desert_or_rainforest_data))
 
			SetTropicZone(tile, TROPICZONE_DESERT);
 
	}
 

	
 
	for (uint i = 0; i != 256; i++) {
 
		if ((i % 64) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
 

	
 
		RunTileLoop();
 
	}
 

	
 
	for (TileIndex tile = 0; tile != MapSize(); ++tile) {
 
		if ((tile % update_freq) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
 

	
 
		if (!IsValidTile(tile)) continue;
 

	
 
		for (data = _make_desert_or_rainforest_data;
 
				data != endof(_make_desert_or_rainforest_data); ++data) {
 
			TileIndex t = AddTileIndexDiffCWrap(tile, *data);
 
			if (t != INVALID_TILE && IsTileType(t, MP_CLEAR) && IsClearGround(t, CLEAR_DESERT)) break;
 
		}
 
		if (data == endof(_make_desert_or_rainforest_data))
 
			SetTropicZone(tile, TROPICZONE_RAINFOREST);
 
	}
 
}
 

	
 
void GenerateLandscape(byte mode)
 
{
src/saveload/afterload.cpp
Show inline comments
 
@@ -2092,24 +2092,31 @@ bool AfterLoadGame()
 
	}
 

	
 
	if (CheckSavegameVersion(140)) {
 
		Station *st;
 
		FOR_ALL_STATIONS(st) {
 
			if (st->airport.tile != INVALID_TILE) {
 
				st->airport.w = st->airport.GetSpec()->size_x;
 
				st->airport.h = st->airport.GetSpec()->size_y;
 
			}
 
		}
 
	}
 

	
 
	if (CheckSavegameVersion(141)) {
 
		for (TileIndex t = 0; t < map_size; t++) {
 
			/* Reset tropic zone for VOID tiles, they shall not have any. */
 
			if (IsTileType(t, MP_VOID)) SetTropicZone(t, TROPICZONE_NORMAL);
 
		}
 
	}
 

	
 
	/* Road stops is 'only' updating some caches */
 
	AfterLoadRoadStops();
 
	AfterLoadLabelMaps();
 

	
 
	GamelogPrintDebug(1);
 

	
 
	InitializeWindowsAndCaches();
 
	/* Restore the signals */
 
	ResetSignalHandlers();
 
	return true;
 
}
 

	
src/tile_map.h
Show inline comments
 
@@ -177,24 +177,25 @@ static inline bool IsTileOwner(TileIndex
 
	return GetTileOwner(tile) == owner;
 
}
 

	
 
/**
 
 * Set the tropic zone
 
 * @param tile the tile to set the zone of
 
 * @param type the new type
 
 * @pre tile < MapSize()
 
 */
 
static inline void SetTropicZone(TileIndex tile, TropicZone type)
 
{
 
	assert(tile < MapSize());
 
	assert(!IsTileType(tile, MP_VOID) || type == TROPICZONE_NORMAL);
 
	SB(_m[tile].m6, 0, 2, type);
 
}
 

	
 
/**
 
 * Get the tropic zone
 
 * @param tile the tile to get the zone of
 
 * @pre tile < MapSize()
 
 * @return the zone type
 
 */
 
static inline TropicZone GetTropicZone(TileIndex tile)
 
{
 
	assert(tile < MapSize());
0 comments (0 inline, 0 general)