author | belugas |
Tue, 27 Nov 2007 17:13:49 +0000 | |
changeset 7978 | c74fc8173339 |
parent 7977 | 4a4e11757be5 |
child 7979 | ca86cb66b8de |
src/industry.h | file | annotate | diff | comparison | revisions | |
src/industry_cmd.cpp | file | annotate | diff | comparison | revisions | |
src/newgrf.cpp | file | annotate | diff | comparison | revisions | |
src/table/build_industry.h | file | annotate | diff | comparison | revisions |
--- a/src/industry.h Tue Nov 27 16:02:13 2007 +0000 +++ b/src/industry.h Tue Nov 27 17:13:49 2007 +0000 @@ -161,7 +161,8 @@ 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 @@ * @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; }; /**
--- a/src/industry_cmd.cpp Tue Nov 27 16:02:13 2007 +0000 +++ b/src/industry_cmd.cpp Tue Nov 27 17:13:49 2007 +0000 @@ -401,7 +401,7 @@ } if (flags & DC_EXEC) delete i; - return CommandCost(); + return CommandCost(indspec->GetRemovalCost()); } static void TransportIndustryGoods(TileIndex tile) @@ -2227,6 +2227,11 @@ )) >> 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()) {
--- a/src/newgrf.cpp Tue Nov 27 16:02:13 2007 +0000 +++ b/src/newgrf.cpp Tue Nov 27 17:13:49 2007 +0000 @@ -2066,6 +2066,10 @@ 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;
--- a/src/table/build_industry.h Tue Nov 27 16:02:13 2007 +0000 +++ b/src/table/build_industry.h Tue Nov 27 17:13:49 2007 +0000 @@ -1175,7 +1175,7 @@ #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: