1
0
Fork 0

(svn r19136) -Doc: Added Doxygen comments for industry checking procedures.

release/1.0
alberth 2010-02-15 09:49:10 +00:00
parent ef59270375
commit bb5261a075
2 changed files with 65 additions and 21 deletions

View File

@ -1136,11 +1136,19 @@ void OnTick_Industry()
} }
} }
/** Check the conditions of #CHECK_NOTHING.
* @param tile %Tile to perform the checking.
* @return \c true if industry may be build, \c false otherwise.
*/
static bool CheckNewIndustry_NULL(TileIndex tile) static bool CheckNewIndustry_NULL(TileIndex tile)
{ {
return true; return true;
} }
/** Check the conditions of #CHECK_FOREST (Industry should be build above snow-line in arctic climate).
* @param tile %Tile to perform the checking.
* @return \c true if industry may be build, \c false otherwise.
*/
static bool CheckNewIndustry_Forest(TileIndex tile) static bool CheckNewIndustry_Forest(TileIndex tile)
{ {
if (_settings_game.game_creation.landscape == LT_ARCTIC) { if (_settings_game.game_creation.landscape == LT_ARCTIC) {
@ -1152,6 +1160,10 @@ static bool CheckNewIndustry_Forest(TileIndex tile)
return true; return true;
} }
/** Check the conditions of #CHECK_REFINERY (Industry should be positioned near edge of the map).
* @param tile %Tile to perform the checking.
* @return \c true if industry may be build, \c false otherwise.
*/
static bool CheckNewIndustry_OilRefinery(TileIndex tile) static bool CheckNewIndustry_OilRefinery(TileIndex tile)
{ {
if (_game_mode == GM_EDITOR) return true; if (_game_mode == GM_EDITOR) return true;
@ -1163,6 +1175,10 @@ static bool CheckNewIndustry_OilRefinery(TileIndex tile)
extern bool _ignore_restrictions; extern bool _ignore_restrictions;
/** Check the conditions of #CHECK_OIL_RIG (Industries at sea should be positioned near edge of the map).
* @param tile %Tile to perform the checking.
* @return \c true if industry may be build, \c false otherwise.
*/
static bool CheckNewIndustry_OilRig(TileIndex tile) static bool CheckNewIndustry_OilRig(TileIndex tile)
{ {
if (_game_mode == GM_EDITOR && _ignore_restrictions) return true; if (_game_mode == GM_EDITOR && _ignore_restrictions) return true;
@ -1173,6 +1189,10 @@ static bool CheckNewIndustry_OilRig(TileIndex tile)
return false; return false;
} }
/** Check the conditions of #CHECK_FARM (Industry should be below snow-line in arctic).
* @param tile %Tile to perform the checking.
* @return \c true if industry may be build, \c false otherwise.
*/
static bool CheckNewIndustry_Farm(TileIndex tile) static bool CheckNewIndustry_Farm(TileIndex tile)
{ {
if (_settings_game.game_creation.landscape == LT_ARCTIC) { if (_settings_game.game_creation.landscape == LT_ARCTIC) {
@ -1184,6 +1204,10 @@ static bool CheckNewIndustry_Farm(TileIndex tile)
return true; return true;
} }
/** Check the conditions of #CHECK_PLANTATION (Industry should NOT be in the desert).
* @param tile %Tile to perform the checking.
* @return \c true if industry may be build, \c false otherwise.
*/
static bool CheckNewIndustry_Plantation(TileIndex tile) static bool CheckNewIndustry_Plantation(TileIndex tile)
{ {
if (GetTropicZone(tile) == TROPICZONE_DESERT) { if (GetTropicZone(tile) == TROPICZONE_DESERT) {
@ -1194,6 +1218,10 @@ static bool CheckNewIndustry_Plantation(TileIndex tile)
return true; return true;
} }
/** Check the conditions of #CHECK_WATER (Industry should be in the desert).
* @param tile %Tile to perform the checking.
* @return \c true if industry may be build, \c false otherwise.
*/
static bool CheckNewIndustry_Water(TileIndex tile) static bool CheckNewIndustry_Water(TileIndex tile)
{ {
if (GetTropicZone(tile) != TROPICZONE_DESERT) { if (GetTropicZone(tile) != TROPICZONE_DESERT) {
@ -1204,6 +1232,10 @@ static bool CheckNewIndustry_Water(TileIndex tile)
return true; return true;
} }
/** Check the conditions of #CHECK_LUMBERMILL (Industry should be in the rain forest).
* @param tile %Tile to perform the checking.
* @return \c true if industry may be build, \c false otherwise.
*/
static bool CheckNewIndustry_Lumbermill(TileIndex tile) static bool CheckNewIndustry_Lumbermill(TileIndex tile)
{ {
if (GetTropicZone(tile) != TROPICZONE_RAINFOREST) { if (GetTropicZone(tile) != TROPICZONE_RAINFOREST) {
@ -1213,22 +1245,32 @@ static bool CheckNewIndustry_Lumbermill(TileIndex tile)
return true; return true;
} }
/** Check the conditions of #CHECK_BUBBLEGEN (Industry should be in low land).
* @param tile %Tile to perform the checking.
* @return \c true if industry may be build, \c false otherwise.
*/
static bool CheckNewIndustry_BubbleGen(TileIndex tile) static bool CheckNewIndustry_BubbleGen(TileIndex tile)
{ {
return GetTileZ(tile) <= TILE_HEIGHT * 4; return GetTileZ(tile) <= TILE_HEIGHT * 4;
} }
/** Industrytype check function signature.
* @param tile %Tile to check.
* @return \c true if industry may be build, \c false otherwise.
*/
typedef bool CheckNewIndustryProc(TileIndex tile); typedef bool CheckNewIndustryProc(TileIndex tile);
/** Check functions for different types of industry. */
static CheckNewIndustryProc * const _check_new_industry_procs[CHECK_END] = { static CheckNewIndustryProc * const _check_new_industry_procs[CHECK_END] = {
CheckNewIndustry_NULL, CheckNewIndustry_NULL, ///< CHECK_NOTHING
CheckNewIndustry_Forest, CheckNewIndustry_Forest, ///< CHECK_FOREST
CheckNewIndustry_OilRefinery, CheckNewIndustry_OilRefinery, ///< CHECK_REFINERY
CheckNewIndustry_Farm, CheckNewIndustry_Farm, ///< CHECK_FARM
CheckNewIndustry_Plantation, CheckNewIndustry_Plantation, ///< CHECK_PLANTATION
CheckNewIndustry_Water, CheckNewIndustry_Water, ///< CHECK_WATER
CheckNewIndustry_Lumbermill, CheckNewIndustry_Lumbermill, ///< CHECK_LUMBERMILL
CheckNewIndustry_BubbleGen, CheckNewIndustry_BubbleGen, ///< CHECK_BUBBLEGEN
CheckNewIndustry_OilRig CheckNewIndustry_OilRig, ///< CHECK_OIL_RIG
}; };
static const Town *CheckMultipleIndustryInTown(TileIndex tile, int type) static const Town *CheckMultipleIndustryInTown(TileIndex tile, int type)

View File

@ -25,6 +25,7 @@ enum {
CLEAN_TILELAYOUT, ///< Free the dynamically allocated tile layout structure CLEAN_TILELAYOUT, ///< Free the dynamically allocated tile layout structure
}; };
/** Available types of industry lifetimes. */
enum IndustryLifeType { enum IndustryLifeType {
INDUSTRYLIFE_BLACK_HOLE = 0, ///< Like power plants and banks INDUSTRYLIFE_BLACK_HOLE = 0, ///< Like power plants and banks
INDUSTRYLIFE_EXTRACTIVE = 1 << 0, ///< Like mines INDUSTRYLIFE_EXTRACTIVE = 1 << 0, ///< Like mines
@ -32,19 +33,20 @@ enum IndustryLifeType {
INDUSTRYLIFE_PROCESSING = 1 << 2, ///< Like factories INDUSTRYLIFE_PROCESSING = 1 << 2, ///< Like factories
}; };
/* Procedures that can be run to check whether an industry may /** Available procedures to check whether an industry may build at a given location.
* build at location the given to the procedure */ * @see CheckNewIndustryProc, _check_new_industry_procs[]
*/
enum CheckProc { enum CheckProc {
CHECK_NOTHING, CHECK_NOTHING, ///< Always succeeds.
CHECK_FOREST, CHECK_FOREST, ///< %Industry should be build above snow-line in arctic climate.
CHECK_REFINERY, CHECK_REFINERY, ///< %Industry should be positioned near edge of the map.
CHECK_FARM, CHECK_FARM, ///< %Industry should be below snow-line in arctic.
CHECK_PLANTATION, CHECK_PLANTATION, ///< %Industry should NOT be in the desert.
CHECK_WATER, CHECK_WATER, ///< %Industry should be in the desert.
CHECK_LUMBERMILL, CHECK_LUMBERMILL, ///< %Industry should be in the rain forest.
CHECK_BUBBLEGEN, CHECK_BUBBLEGEN, ///< %Industry should be in low land.
CHECK_OIL_RIG, CHECK_OIL_RIG, ///< Industries at sea should be positioned near edge of the map.
CHECK_END, CHECK_END, ///< End marker of the industry check procedures.
}; };
/** How was the industry created */ /** How was the industry created */