File diff r7581:0085036e989e → r7582:dfefb1216e6f
src/town_cmd.cpp
Show inline comments
 
@@ -32,24 +32,25 @@
 
#include "variables.h"
 
#include "bridge.h"
 
#include "bridge_map.h"
 
#include "date.h"
 
#include "table/town_land.h"
 
#include "genworld.h"
 
#include "newgrf.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_house.h"
 
#include "newgrf_commons.h"
 
#include "newgrf_townname.h"
 
#include "misc/autoptr.hpp"
 
#include "autoslope.h"
 

	
 
/* Initialize the town-pool */
 
DEFINE_OLD_POOL_GENERIC(Town, Town)
 

	
 
Town::Town(TileIndex tile)
 
{
 
	if (tile != 0) _total_towns++;
 
	this->xy = tile;
 
}
 

	
 
Town::~Town()
 
{
 
@@ -2300,24 +2301,33 @@ void InitializeTowns()
 
	memset(_subsidies, 0, sizeof(_subsidies));
 
	for (s=_subsidies; s != endof(_subsidies); s++)
 
		s->cargo_type = CT_INVALID;
 

	
 
	_cur_town_ctr = 0;
 
	_cur_town_iter = 0;
 
	_total_towns = 0;
 
	_town_sort_dirty = true;
 
}
 

	
 
static CommandCost TerraformTile_Town(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
 
{
 
	if (AutoslopeEnabled()) {
 
		HouseID house = GetHouseType(tile);
 
		HouseSpec *hs = GetHouseSpecs(house);
 

	
 
		/* Here we differ from TTDP by checking TILE_NOT_SLOPED */
 
		if (((hs->building_flags & TILE_NOT_SLOPED) == 0) && !IsSteepSlope(tileh_new) &&
 
			(GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new))) return _price.terraform;
 
	}
 

	
 
	return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 
}
 

	
 
extern const TileTypeProcs _tile_type_town_procs = {
 
	DrawTile_Town,           /* draw_tile_proc */
 
	GetSlopeZ_Town,          /* get_slope_z_proc */
 
	ClearTile_Town,          /* clear_tile_proc */
 
	GetAcceptedCargo_Town,   /* get_accepted_cargo_proc */
 
	GetTileDesc_Town,        /* get_tile_desc_proc */
 
	GetTileTrackStatus_Town, /* get_tile_track_status_proc */
 
	ClickTile_Town,          /* click_tile_proc */
 
	AnimateTile_Town,        /* animate_tile_proc */