mirror of https://github.com/OpenTTD/OpenTTD
(svn r13383) -Codechange: Put the cost of house removal in a class member
parent
dc22170c99
commit
4f3eb7f3cd
|
@ -16,6 +16,7 @@
|
||||||
#include "settings_type.h"
|
#include "settings_type.h"
|
||||||
#include "strings_type.h"
|
#include "strings_type.h"
|
||||||
#include "viewport_type.h"
|
#include "viewport_type.h"
|
||||||
|
#include "economy_type.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
HOUSE_NO_CLASS = 0,
|
HOUSE_NO_CLASS = 0,
|
||||||
|
@ -242,6 +243,13 @@ struct HouseSpec {
|
||||||
/* grf file related properties*/
|
/* grf file related properties*/
|
||||||
uint8 local_id; ///< id defined by the grf file for this house
|
uint8 local_id; ///< id defined by the grf file for this house
|
||||||
const struct GRFFile *grffile; ///< grf file that introduced 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];
|
extern HouseSpec _house_specs[HOUSE_MAX];
|
||||||
|
|
|
@ -127,6 +127,11 @@ void Town::InitializeLayout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Money HouseSpec::GetRemovalCost() const
|
||||||
|
{
|
||||||
|
return (_price.remove_house * this->removal_cost) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
// Local
|
// Local
|
||||||
static int _grow_town_result;
|
static int _grow_town_result;
|
||||||
|
|
||||||
|
@ -517,7 +522,7 @@ static CommandCost ClearTile_Town(TileIndex tile, byte flags)
|
||||||
const HouseSpec *hs = GetHouseSpecs(GetHouseType(tile));
|
const HouseSpec *hs = GetHouseSpecs(GetHouseType(tile));
|
||||||
|
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||||
cost.AddCost(_price.remove_house * hs->removal_cost >> 8);
|
cost.AddCost(hs->GetRemovalCost());
|
||||||
|
|
||||||
int rating = hs->remove_rating_decrease;
|
int rating = hs->remove_rating_decrease;
|
||||||
_cleared_town_rating += rating;
|
_cleared_town_rating += rating;
|
||||||
|
|
Loading…
Reference in New Issue