landscape.c
changeset 1093 4fdc46eaf423
parent 1059 fe97d81a1b4f
child 1095 b59632d9df1b
equal deleted inserted replaced
1092:e3b4a131db7c 1093:4fdc46eaf423
   455 #define TILELOOP_BITS 4
   455 #define TILELOOP_BITS 4
   456 #define TILELOOP_SIZE (1 << TILELOOP_BITS)
   456 #define TILELOOP_SIZE (1 << TILELOOP_BITS)
   457 #define TILELOOP_ASSERTMASK ((TILELOOP_SIZE-1) + ((TILELOOP_SIZE-1) << MapLogX()))
   457 #define TILELOOP_ASSERTMASK ((TILELOOP_SIZE-1) + ((TILELOOP_SIZE-1) << MapLogX()))
   458 #define TILELOOP_CHKMASK (((1 << (MapLogX() - TILELOOP_BITS))-1) << TILELOOP_BITS)
   458 #define TILELOOP_CHKMASK (((1 << (MapLogX() - TILELOOP_BITS))-1) << TILELOOP_BITS)
   459 
   459 
   460 void RunTileLoop()
   460 void RunTileLoop(void)
   461 {
   461 {
   462 	uint tile;
   462 	uint tile;
   463 	uint count;
   463 	uint count;
   464 
   464 
   465 	tile = _cur_tileloop_tile;
   465 	tile = _cur_tileloop_tile;
   481 	if (tile & TILELOOP_CHKMASK)
   481 	if (tile & TILELOOP_CHKMASK)
   482 		tile = (tile + MapSizeX()) & TILELOOP_ASSERTMASK;
   482 		tile = (tile + MapSizeX()) & TILELOOP_ASSERTMASK;
   483 	_cur_tileloop_tile = tile;
   483 	_cur_tileloop_tile = tile;
   484 }
   484 }
   485 
   485 
   486 void InitializeLandscape()
   486 void InitializeLandscape(void)
   487 {
   487 {
   488 	uint map_size = MapSize();
   488 	uint map_size = MapSize();
   489 	uint i;
   489 	uint i;
   490 
   490 
   491 	memset(_map_owner, OWNER_NONE, map_size);
   491 	memset(_map_owner, OWNER_NONE, map_size);
   501 	memset(_map_type_and_height + MapMaxY() * MapSizeX(), MP_VOID << 4, MapSizeX());
   501 	memset(_map_type_and_height + MapMaxY() * MapSizeX(), MP_VOID << 4, MapSizeX());
   502 
   502 
   503 	memset(_map5, 3, map_size);
   503 	memset(_map5, 3, map_size);
   504 }
   504 }
   505 
   505 
   506 void ConvertGroundTilesIntoWaterTiles()
   506 void ConvertGroundTilesIntoWaterTiles(void)
   507 {
   507 {
   508 	uint tile = 0;
   508 	uint tile = 0;
   509 	int h;
   509 	int h;
   510 
   510 
   511 	while(true) {
   511 	while(true) {
   628 }
   628 }
   629 
   629 
   630 
   630 
   631 #include "table/genland.h"
   631 #include "table/genland.h"
   632 
   632 
   633 static void CreateDesertOrRainForest()
   633 static void CreateDesertOrRainForest(void)
   634 {
   634 {
   635 	uint tile;
   635 	uint tile;
   636 	const TileIndexDiffC *data;
   636 	const TileIndexDiffC *data;
   637 	int i;
   637 	int i;
   638 
   638 
   658 		if (data == endof(_make_desert_or_rainforest_data))
   658 		if (data == endof(_make_desert_or_rainforest_data))
   659 			SetMapExtraBits(tile, 2);
   659 			SetMapExtraBits(tile, 2);
   660 	}
   660 	}
   661 }
   661 }
   662 
   662 
   663 void GenerateLandscape()
   663 void GenerateLandscape(void)
   664 {
   664 {
   665 	int i,flag;
   665 	int i,flag;
   666 	uint32 r;
   666 	uint32 r;
   667 
   667 
   668 	if (_opt.landscape == LT_HILLY) {
   668 	if (_opt.landscape == LT_HILLY) {
   707 
   707 
   708 	if (_opt.landscape == LT_DESERT)
   708 	if (_opt.landscape == LT_DESERT)
   709 		CreateDesertOrRainForest();
   709 		CreateDesertOrRainForest();
   710 }
   710 }
   711 
   711 
   712 void OnTick_Town();
   712 void OnTick_Town(void);
   713 void OnTick_Trees();
   713 void OnTick_Trees(void);
   714 void OnTick_Station();
   714 void OnTick_Station(void);
   715 void OnTick_Industry();
   715 void OnTick_Industry(void);
   716 
   716 
   717 void OnTick_Players();
   717 void OnTick_Players(void);
   718 void OnTick_Train();
   718 void OnTick_Train(void);
   719 
   719 
   720 void CallLandscapeTick()
   720 void CallLandscapeTick(void)
   721 {
   721 {
   722 	OnTick_Town();
   722 	OnTick_Town();
   723 	OnTick_Trees();
   723 	OnTick_Trees();
   724 	OnTick_Station();
   724 	OnTick_Station();
   725 	OnTick_Industry();
   725 	OnTick_Industry();