MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetTownActionCost

Function GetTownActionCost

src/town_cmd.cpp:3391–3404  ·  view source on GitHub ↗

* Get cost factors for a TownAction * @param action TownAction to get cost factor for. * @returns Cost factor. */

Source from the content-addressed store, hash-verified

3389 * @returns Cost factor.
3390 */
3391uint8_t GetTownActionCost(TownAction action)
3392{
3393 /**
3394 * Factor in the cost of each town action.
3395 * @see TownActions
3396 */
3397 static const uint8_t town_action_costs[] = {
3398 2, 4, 9, 35, 48, 53, 117, 175
3399 };
3400 static_assert(std::size(town_action_costs) == to_underlying(TownAction::End));
3401
3402 assert(to_underlying(action) < std::size(town_action_costs));
3403 return town_action_costs[to_underlying(action)];
3404}
3405
3406/**
3407 * Perform the "small advertising campaign" town action.

Callers 4

DrawWidgetMethod · 0.85
UpdateWidgetSizeMethod · 0.85
GetMaskOfTownActionsFunction · 0.85
CmdDoTownActionFunction · 0.85

Calls 2

to_underlyingFunction · 0.85
sizeFunction · 0.50

Tested by

no test coverage detected