diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/industry.h | 11 | ||||
-rw-r--r-- | src/industry_cmd.cpp | 7 | ||||
-rw-r--r-- | src/newgrf.cpp | 4 | ||||
-rw-r--r-- | src/table/build_industry.h | 2 |
4 files changed, 21 insertions, 3 deletions
diff --git a/src/industry.h b/src/industry.h index 8036122a0..e633a4c86 100644 --- a/src/industry.h +++ b/src/industry.h @@ -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; }; /** diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 28ff57720..ca920aabc 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -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()) { diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 1a6ab3b6b..5f8889db5 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -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; diff --git a/src/table/build_industry.h b/src/table/build_industry.h index 9c2f2eb47..604146e2e 100644 --- a/src/table/build_industry.h +++ b/src/table/build_industry.h @@ -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: |