summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/town.h25
-rw-r--r--src/town_cmd.cpp25
-rw-r--r--src/town_gui.cpp2
3 files changed, 29 insertions, 23 deletions
diff --git a/src/town.h b/src/town.h
index 5e4c0eaed..c524f971d 100644
--- a/src/town.h
+++ b/src/town.h
@@ -215,6 +215,31 @@ uint GetMaskOfTownActions(int *nump, CompanyID cid, const Town *t);
bool GenerateTowns(TownLayout layout);
bool GenerateTownName(uint32 *townnameparts);
+
+/** Town actions of a company. */
+enum TownActions {
+ TACT_NONE = 0x00, ///< Empty action set.
+
+ TACT_ADVERTISE_SMALL = 0x01, ///< Small advertising campaign.
+ TACT_ADVERTISE_MEDIUM = 0x02, ///< Medium advertising campaign.
+ TACT_ADVERTISE_LARGE = 0x04, ///< Large advertising campaign.
+ TACT_ROAD_REBUILD = 0x08, ///< Rebuild the roads.
+ TACT_BUILD_STATUE = 0x10, ///< Build a statue.
+ TACT_FOUND_BUILDINGS = 0x20, ///< Found new buildings.
+ TACT_BUY_RIGHTS = 0x40, ///< Buy exclusive transport rights.
+ TACT_BRIBE = 0x80, ///< Try to bribe the counsil.
+
+ TACT_COUNT = 8, ///< Number of available town actions.
+
+ TACT_ADVERTISE = TACT_ADVERTISE_SMALL | TACT_ADVERTISE_MEDIUM | TACT_ADVERTISE_LARGE, ///< All possible advertising actions.
+ TACT_CONSTRUCTION = TACT_ROAD_REBUILD | TACT_BUILD_STATUE | TACT_FOUND_BUILDINGS, ///< All possible construction actions.
+ TACT_FUNDS = TACT_BUY_RIGHTS | TACT_BRIBE, ///< All possible funding actions.
+ TACT_ALL = TACT_ADVERTISE | TACT_CONSTRUCTION | TACT_FUNDS, ///< All possible actions.
+};
+DECLARE_ENUM_AS_BIT_SET(TownActions);
+
+extern const byte _town_action_costs[TACT_COUNT];
+
/**
* Calculate a hash value from a tile position
*
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index aa935d2da..6642541ba 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -2359,7 +2359,10 @@ void ExpandTown(Town *t)
UpdateTownMaxPass(t);
}
-extern const byte _town_action_costs[8] = {
+/** Factor in the cost of each town action.
+ * @see TownActions
+ */
+const byte _town_action_costs[TACT_COUNT] = {
2, 4, 9, 35, 48, 53, 117, 175
};
@@ -2509,26 +2512,6 @@ static TownActionProc * const _town_action_proc[] = {
TownActionBribe
};
-enum TownActions {
- TACT_NONE = 0x00,
-
- TACT_ADVERTISE_SMALL = 0x01,
- TACT_ADVERTISE_MEDIUM = 0x02,
- TACT_ADVERTISE_LARGE = 0x04,
- TACT_ROAD_REBUILD = 0x08,
- TACT_BUILD_STATUE = 0x10,
- TACT_FOUND_BUILDINGS = 0x20,
- TACT_BUY_RIGHTS = 0x40,
- TACT_BRIBE = 0x80,
-
- TACT_ADVERTISE = TACT_ADVERTISE_SMALL | TACT_ADVERTISE_MEDIUM | TACT_ADVERTISE_LARGE,
- TACT_CONSTRUCTION = TACT_ROAD_REBUILD | TACT_BUILD_STATUE | TACT_FOUND_BUILDINGS,
- TACT_FUNDS = TACT_BUY_RIGHTS | TACT_BRIBE,
- TACT_ALL = TACT_ADVERTISE | TACT_CONSTRUCTION | TACT_FUNDS,
-};
-
-DECLARE_ENUM_AS_BIT_SET(TownActions);
-
/** Get a list of available actions to do at a town.
* @param nump if not NULL add put the number of available actions in it
* @param cid the company that is querying the town
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 47374fc03..a6f811791 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -76,8 +76,6 @@ static const NWidgetPart _nested_town_authority_widgets[] = {
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TWA_EXECUTE), SetMinimalSize(317, 12), SetDataTip(STR_LOCAL_AUTHORITY_DO_IT_BUTTON, STR_LOCAL_AUTHORITY_DO_IT_TOOLTIP),
};
-extern const byte _town_action_costs[8];
-
struct TownAuthorityWindow : Window {
private:
Town *town;