|
@@ -669,51 +669,51 @@ void RunTileLoop()
|
|
|
_tile_type_procs[GetTileType(tile)]->tile_loop_proc(tile);
|
|
|
|
|
|
if (TileX(tile) < MapSizeX() - TILELOOP_SIZE) {
|
|
|
tile += TILELOOP_SIZE; // no overflow
|
|
|
} else {
|
|
|
tile = TILE_MASK(tile - TILELOOP_SIZE * (MapSizeX() / TILELOOP_SIZE - 1) + TileDiffXY(0, TILELOOP_SIZE)); /* x would overflow, also increase y */
|
|
|
}
|
|
|
} while (--count != 0);
|
|
|
assert((tile & ~TILELOOP_ASSERTMASK) == 0);
|
|
|
|
|
|
tile += 9;
|
|
|
if (tile & TILELOOP_CHKMASK) {
|
|
|
tile = (tile + MapSizeX()) & TILELOOP_ASSERTMASK;
|
|
|
}
|
|
|
_cur_tileloop_tile = tile;
|
|
|
}
|
|
|
|
|
|
void InitializeLandscape()
|
|
|
{
|
|
|
uint maxx = MapMaxX();
|
|
|
uint maxy = MapMaxY();
|
|
|
uint sizex = MapSizeX();
|
|
|
|
|
|
uint y;
|
|
|
for (y = 0; y < maxy; y++) {
|
|
|
for (y = _settings_game.construction.freeform_edges ? 1 : 0; y < maxy; y++) {
|
|
|
uint x;
|
|
|
for (x = 0; x < maxx; x++) {
|
|
|
for (x = _settings_game.construction.freeform_edges ? 1 : 0; x < maxx; x++) {
|
|
|
MakeClear(sizex * y + x, CLEAR_GRASS, 3);
|
|
|
SetTileHeight(sizex * y + x, 0);
|
|
|
SetTropicZone(sizex * y + x, TROPICZONE_NORMAL);
|
|
|
ClearBridgeMiddle(sizex * y + x);
|
|
|
}
|
|
|
MakeVoid(sizex * y + x);
|
|
|
}
|
|
|
for (uint x = 0; x < sizex; x++) MakeVoid(sizex * y + x);
|
|
|
}
|
|
|
|
|
|
static const byte _genterrain_tbl_1[5] = { 10, 22, 33, 37, 4 };
|
|
|
static const byte _genterrain_tbl_2[5] = { 0, 0, 0, 0, 33 };
|
|
|
|
|
|
static void GenerateTerrain(int type, uint flag)
|
|
|
{
|
|
|
uint32 r = Random();
|
|
|
|
|
|
const Sprite *templ = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + 4845, ST_MAPGEN);
|
|
|
|
|
|
uint x = r & MapMaxX();
|
|
|
uint y = (r >> MapLogX()) & MapMaxY();
|
|
|
|
|
|
if (x < 2 || y < 2) return;
|
|
|
|