mirror of https://github.com/OpenTTD/OpenTTD
(svn r20316) -Document: some members/structs and functions and rename some slightly to better catch their meaning
parent
9f5e49eaad
commit
00dcb16760
|
@ -17,14 +17,23 @@
|
||||||
|
|
||||||
void UpdateCompanyHQ(Company *c, uint score);
|
void UpdateCompanyHQ(Company *c, uint score);
|
||||||
|
|
||||||
|
/** An (unmovable) object that isn't use for transport, industries or houses. */
|
||||||
struct UnmovableSpec {
|
struct UnmovableSpec {
|
||||||
StringID name;
|
StringID name; ///< The name for this object.
|
||||||
uint8 buy_cost_multiplier;
|
uint8 build_cost_multiplier; ///< Build cost multiplier per tile.
|
||||||
uint8 sell_cost_multiplier;
|
uint8 clear_cost_multiplier; ///< Clear cost multiplier per tile.
|
||||||
|
|
||||||
Money GetRemovalCost() const { return (_price[PR_CLEAR_UNMOVABLE] * this->sell_cost_multiplier); }
|
/**
|
||||||
Money GetBuildingCost() const { return (_price[PR_BUILD_UNMOVABLE] * this->buy_cost_multiplier); }
|
* Get the cost for building a structure of this type.
|
||||||
|
* @return The cost for building.
|
||||||
|
*/
|
||||||
|
Money GetBuildCost() const { return (_price[PR_BUILD_UNMOVABLE] * this->build_cost_multiplier); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cost for clearing a structure of this type.
|
||||||
|
* @return The cost for clearing.
|
||||||
|
*/
|
||||||
|
Money GetClearCost() const { return (_price[PR_CLEAR_UNMOVABLE] * this->clear_cost_multiplier); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ CommandCost CmdPurchaseLandArea(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
cost.AddCost(GetUnmovableSpec(UNMOVABLE_OWNED_LAND)->GetBuildingCost());
|
cost.AddCost(GetUnmovableSpec(UNMOVABLE_OWNED_LAND)->GetBuildCost());
|
||||||
return cost;
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ CommandCost CmdSellLandArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
|
|
||||||
if (flags & DC_EXEC) DoClearSquare(tile);
|
if (flags & DC_EXEC) DoClearSquare(tile);
|
||||||
|
|
||||||
return CommandCost(EXPENSES_CONSTRUCTION, - GetUnmovableSpec(UNMOVABLE_OWNED_LAND)->GetRemovalCost());
|
return CommandCost(EXPENSES_CONSTRUCTION, -GetUnmovableSpec(UNMOVABLE_OWNED_LAND)->GetClearCost());
|
||||||
}
|
}
|
||||||
|
|
||||||
static Foundation GetFoundation_Unmovable(TileIndex tile, Slope tileh);
|
static Foundation GetFoundation_Unmovable(TileIndex tile, Slope tileh);
|
||||||
|
|
Loading…
Reference in New Issue