Changeset - r13072:40bbf04b49b4
[Not reviewed]
master
0 3 0
alberth - 15 years ago 2009-09-20 10:08:10
alberth@openttd.org
(svn r17582) -Codechange: Move TownActions and _town_action_costs[] to a header file to allow sharing.
3 files changed with 29 insertions and 23 deletions:
0 comments (0 inline, 0 general)
src/town.h
Show inline comments
 
@@ -215,6 +215,31 @@ uint GetMaskOfTownActions(int *nump, Com
 
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
 
 *
src/town_cmd.cpp
Show inline comments
 
@@ -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_acti
 
	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
src/town_gui.cpp
Show inline comments
 
@@ -76,8 +76,6 @@ static const NWidgetPart _nested_town_au
 
	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;
0 comments (0 inline, 0 general)