(svn r11534) -Feature(newgrf): Implement property 23h for Industries.

This will add a cost to the removal of an industry using the cheat magic bulldozer.
Note that the removal of regular or newgrf industries without specified removal cost will have no cost applied to.
This is a difference from original spec, where a default base cost is added.
pull/155/head
belugas 17 years ago
parent e07925a5cb
commit b98847e489

@ -161,7 +161,8 @@ struct GRFFileProps {
struct IndustrySpec {
const IndustryTileTable *const *table;///< List of the tiles composing the industry
byte num_table; ///< Number of elements in the table
uint8 cost_multiplier; ///< Base cost multiplier.
uint8 cost_multiplier; ///< Base construction cost multiplier.
uint32 removal_cost_multiplier; ///< Base removal cost multiplier.
uint16 raw_industry_cost_multiplier; ///< Multiplier for the raw industries cost
uint32 prospecting_chance; ///< Chance prospecting succeeds
IndustryType conflicting[3]; ///< Industries this industry cannot be close to
@ -202,6 +203,14 @@ struct IndustrySpec {
* @return the cost (inflation corrected etc)
*/
Money GetConstructionCost() const;
/**
* Get the cost for removing this industry
* Take note that the cost will always be zero for non-grf industries.
* Only if the grf author did specified a cost will it be applicable.
* @return the cost (inflation corrected etc)
*/
Money GetRemovalCost() const;
};
/**

@ -401,7 +401,7 @@ static CommandCost ClearTile_Industry(TileIndex tile, byte flags)
}
if (flags & DC_EXEC) delete i;
return CommandCost();
return CommandCost(indspec->GetRemovalCost());
}
static void TransportIndustryGoods(TileIndex tile)
@ -2227,6 +2227,11 @@ Money IndustrySpec::GetConstructionCost() const
)) >> 8;
}
Money IndustrySpec::GetRemovalCost() const
{
return (_price.remove_house * this->removal_cost_multiplier) >> 8;
}
static CommandCost TerraformTile_Industry(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
{
if (AutoslopeEnabled()) {

@ -2066,6 +2066,10 @@ static bool IndustriesChangeInfo(uint indid, int numinfo, int prop, byte **bufp,
SB(indsp->callback_flags, (prop - 0x21) * 8, 8, aflag);
} break;
case 0x23: // removal cost multiplier
indsp->removal_cost_multiplier = grf_load_dword(&buf);
break;
default:
ret = true;
break;

@ -1175,7 +1175,7 @@ enum {
#define MI(tbl, sndc, snd, d, pc, ai1, ai2, ai3, ai4, ag1, ag2, ag3, ag4, col, \
c1, c2, c3, proc, p1, r1, p2, r2, m, a1, im1, a2, im2, a3, im3, pr, clim, bev, in, intx, s1, s2, s3) \
{tbl, lengthof(tbl), min(255, d), d, pc, {c1, c2, c3}, proc, {p1, p2}, {r1, r2}, m, \
{tbl, lengthof(tbl), min(255, d), 0, d, pc, {c1, c2, c3}, proc, {p1, p2}, {r1, r2}, m, \
{a1, a2, a3}, {{im1, 0}, {im2, 0}, {im3, 0}}, pr, clim, bev, col, in, intx, s1, s2, s3, {ai1, ai2, ai3, ai4}, {ag1, ag2, ag3, ag4}, \
sndc, snd, 0, 0, true, {INVALID_INDUSTRYTYPE, 0, NULL, NULL, INVALID_INDUSTRYTYPE}}
/* Format:

Loading…
Cancel
Save