# HG changeset patch # User belugas # Date 1212630183 0 # Node ID 55d2502fc17fae572a1b0f2127b662fc68820772 # Parent 6f77385d473bb6da4984258402cc71d7a06eafe1 (svn r13383) -Codechange: Put the cost of house removal in a class member diff -r 6f77385d473b -r 55d2502fc17f src/town.h --- a/src/town.h Wed Jun 04 22:30:44 2008 +0000 +++ b/src/town.h Thu Jun 05 01:43:03 2008 +0000 @@ -16,6 +16,7 @@ #include "settings_type.h" #include "strings_type.h" #include "viewport_type.h" +#include "economy_type.h" enum { HOUSE_NO_CLASS = 0, @@ -242,6 +243,13 @@ /* grf file related properties*/ uint8 local_id; ///< id defined by the grf file for this house const struct GRFFile *grffile; ///< grf file that introduced this house + + /** + * Get the cost for removing this house + * @return the cost (inflation corrected etc) + */ + Money GetRemovalCost() const; + }; extern HouseSpec _house_specs[HOUSE_MAX]; diff -r 6f77385d473b -r 55d2502fc17f src/town_cmd.cpp --- a/src/town_cmd.cpp Wed Jun 04 22:30:44 2008 +0000 +++ b/src/town_cmd.cpp Thu Jun 05 01:43:03 2008 +0000 @@ -127,6 +127,11 @@ } } +Money HouseSpec::GetRemovalCost() const +{ + return (_price.remove_house * this->removal_cost) >> 8; +} + // Local static int _grow_town_result; @@ -517,7 +522,7 @@ const HouseSpec *hs = GetHouseSpecs(GetHouseType(tile)); CommandCost cost(EXPENSES_CONSTRUCTION); - cost.AddCost(_price.remove_house * hs->removal_cost >> 8); + cost.AddCost(hs->GetRemovalCost()); int rating = hs->remove_rating_decrease; _cleared_town_rating += rating;