src/landscape.cpp
changeset 6573 7624f942237f
parent 6527 f584ab6d87f8
child 6303 84c215fc8eb8
child 6669 487ac09b95c4
equal deleted inserted replaced
6572:e35266003390 6573:7624f942237f
   377 #define TILELOOP_BITS 4
   377 #define TILELOOP_BITS 4
   378 #define TILELOOP_SIZE (1 << TILELOOP_BITS)
   378 #define TILELOOP_SIZE (1 << TILELOOP_BITS)
   379 #define TILELOOP_ASSERTMASK ((TILELOOP_SIZE-1) + ((TILELOOP_SIZE-1) << MapLogX()))
   379 #define TILELOOP_ASSERTMASK ((TILELOOP_SIZE-1) + ((TILELOOP_SIZE-1) << MapLogX()))
   380 #define TILELOOP_CHKMASK (((1 << (MapLogX() - TILELOOP_BITS))-1) << TILELOOP_BITS)
   380 #define TILELOOP_CHKMASK (((1 << (MapLogX() - TILELOOP_BITS))-1) << TILELOOP_BITS)
   381 
   381 
   382 void RunTileLoop(void)
   382 void RunTileLoop()
   383 {
   383 {
   384 	TileIndex tile;
   384 	TileIndex tile;
   385 	uint count;
   385 	uint count;
   386 
   386 
   387 	tile = _cur_tileloop_tile;
   387 	tile = _cur_tileloop_tile;
   403 	if (tile & TILELOOP_CHKMASK)
   403 	if (tile & TILELOOP_CHKMASK)
   404 		tile = (tile + MapSizeX()) & TILELOOP_ASSERTMASK;
   404 		tile = (tile + MapSizeX()) & TILELOOP_ASSERTMASK;
   405 	_cur_tileloop_tile = tile;
   405 	_cur_tileloop_tile = tile;
   406 }
   406 }
   407 
   407 
   408 void InitializeLandscape(void)
   408 void InitializeLandscape()
   409 {
   409 {
   410 	uint maxx = MapMaxX();
   410 	uint maxx = MapMaxX();
   411 	uint maxy = MapMaxY();
   411 	uint maxy = MapMaxY();
   412 	uint sizex = MapSizeX();
   412 	uint sizex = MapSizeX();
   413 	uint x;
   413 	uint x;
   423 		MakeVoid(sizex * y + x);
   423 		MakeVoid(sizex * y + x);
   424 	}
   424 	}
   425 	for (x = 0; x < sizex; x++) MakeVoid(sizex * y + x);
   425 	for (x = 0; x < sizex; x++) MakeVoid(sizex * y + x);
   426 }
   426 }
   427 
   427 
   428 void ConvertGroundTilesIntoWaterTiles(void)
   428 void ConvertGroundTilesIntoWaterTiles()
   429 {
   429 {
   430 	TileIndex tile;
   430 	TileIndex tile;
   431 	uint z;
   431 	uint z;
   432 	Slope slope;
   432 	Slope slope;
   433 
   433 
   585 }
   585 }
   586 
   586 
   587 
   587 
   588 #include "table/genland.h"
   588 #include "table/genland.h"
   589 
   589 
   590 static void CreateDesertOrRainForest(void)
   590 static void CreateDesertOrRainForest()
   591 {
   591 {
   592 	TileIndex tile;
   592 	TileIndex tile;
   593 	TileIndex update_freq = MapSize() / 4;
   593 	TileIndex update_freq = MapSize() / 4;
   594 	const TileIndexDiffC *data;
   594 	const TileIndexDiffC *data;
   595 	uint i;
   595 	uint i;
   695 	ConvertGroundTilesIntoWaterTiles();
   695 	ConvertGroundTilesIntoWaterTiles();
   696 
   696 
   697 	if (_opt.landscape == LT_DESERT) CreateDesertOrRainForest();
   697 	if (_opt.landscape == LT_DESERT) CreateDesertOrRainForest();
   698 }
   698 }
   699 
   699 
   700 void OnTick_Town(void);
   700 void OnTick_Town();
   701 void OnTick_Trees(void);
   701 void OnTick_Trees();
   702 void OnTick_Station(void);
   702 void OnTick_Station();
   703 void OnTick_Industry(void);
   703 void OnTick_Industry();
   704 
   704 
   705 void OnTick_Players(void);
   705 void OnTick_Players();
   706 void OnTick_Train(void);
   706 void OnTick_Train();
   707 
   707 
   708 void CallLandscapeTick(void)
   708 void CallLandscapeTick()
   709 {
   709 {
   710 	OnTick_Town();
   710 	OnTick_Town();
   711 	OnTick_Trees();
   711 	OnTick_Trees();
   712 	OnTick_Station();
   712 	OnTick_Station();
   713 	OnTick_Industry();
   713 	OnTick_Industry();