landscape.c
changeset 909 65cdb609b7a6
parent 889 64d2f7d5f02b
child 925 47d7952c6c14
equal deleted inserted replaced
908:283e87112491 909:65cdb609b7a6
   629 #include "table/genland.h"
   629 #include "table/genland.h"
   630 
   630 
   631 static void CreateDesertOrRainForest()
   631 static void CreateDesertOrRainForest()
   632 {
   632 {
   633 	uint tile;
   633 	uint tile;
   634 	const TileIndexDiff *data;
   634 	const TileIndexDiffC *data;
   635 	byte mt;
   635 	byte mt;
   636 	int i;
   636 	int i;
   637 
   637 
   638 	tile = 0;
   638 	for (tile = 0; tile != MapSize(); ++tile) {
   639 	do {
   639 		for (data = _make_desert_or_rainforest_data;
   640 		data = _make_desert_or_rainforest_data;
   640 				data != endof(_make_desert_or_rainforest_data); ++data) {
   641 		do {
   641 			mt = _map_type_and_height[TILE_MASK(tile + ToTileIndexDiff(*data))];
   642 			if ((i = *data++) == MDORD_LAST) {
   642 			if ((mt & 0xf) >= 4 || (mt >> 4) == MP_WATER) break;
   643 				SetMapExtraBits(tile, 1);
   643 		}
   644 				break;
   644 		if (data == endof(_make_desert_or_rainforest_data))
   645 			}
   645 			SetMapExtraBits(tile, 1);
   646 			mt = _map_type_and_height[TILE_MASK(tile + i)];
   646 	}
   647 		} while ((mt & 0xC) == 0 && (mt >> 4) != MP_WATER);
       
   648 	} while (++tile != MapSize());
       
   649 
   647 
   650 	for(i=0; i!=256; i++)
   648 	for(i=0; i!=256; i++)
   651 		RunTileLoop();
   649 		RunTileLoop();
   652 
   650 
   653 	tile = 0;
   651 	for (tile = 0; tile != MapSize(); ++tile) {
   654 	do {
   652 		for (data = _make_desert_or_rainforest_data;
   655 		data = _make_desert_or_rainforest_data;
   653 				data != endof(_make_desert_or_rainforest_data); ++data) {
   656 		do {
   654 			TileIndex t = TILE_MASK(tile + ToTileIndexDiff(*data));
   657 			if ((i = *data++) == MDORD_LAST) {
   655 			if (IS_TILETYPE(t, MP_CLEAR) && (_map5[t] & 0x1c) == 0x14) break;
   658 				SetMapExtraBits(tile, 2);
   656 		}
   659 				break;
   657 		if (data == endof(_make_desert_or_rainforest_data))
   660 			}
   658 			SetMapExtraBits(tile, 2);
   661 		} while ( !IS_TILETYPE(TILE_MASK(tile+i), MP_CLEAR) || (_map5[TILE_MASK(tile + i)]&0x1C) != 0x14);
   659 	}
   662 	} while (++tile != MapSize());
       
   663 }
   660 }
   664 
   661 
   665 void GenerateLandscape()
   662 void GenerateLandscape()
   666 {
   663 {
   667 	int i,flag;
   664 	int i,flag;