mirror of https://github.com/OpenTTD/OpenTTD
(svn r15901) -Add: AIIndustryType::IsBuiltOnWater(), HasHeliport() and HasDock(). Just like AIIndustry.
parent
3bbf0fc87b
commit
f55be81e3c
|
@ -635,6 +635,9 @@ function Regression::IndustryTypeList()
|
||||||
print(" GetName(): " + AIIndustryType.GetName(i));
|
print(" GetName(): " + AIIndustryType.GetName(i));
|
||||||
print(" CanBuildIndustry(): " + AIIndustryType.CanBuildIndustry(i));
|
print(" CanBuildIndustry(): " + AIIndustryType.CanBuildIndustry(i));
|
||||||
print(" CanProspectIndustry(): " + AIIndustryType.CanProspectIndustry(i));
|
print(" CanProspectIndustry(): " + AIIndustryType.CanProspectIndustry(i));
|
||||||
|
print(" IsBuiltOnWater(): " + AIIndustryType.IsBuiltOnWater(i));
|
||||||
|
print(" HasHeliport(): " + AIIndustryType.HasHeliport(i));
|
||||||
|
print(" HasDock(): " + AIIndustryType.HasDock(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6926,6 +6926,9 @@
|
||||||
GetName(): Farm
|
GetName(): Farm
|
||||||
CanBuildIndustry(): false
|
CanBuildIndustry(): false
|
||||||
CanProspectIndustry(): false
|
CanProspectIndustry(): false
|
||||||
|
IsBuiltOnWater(): false
|
||||||
|
HasHeliport(): false
|
||||||
|
HasDock(): false
|
||||||
Id: 5
|
Id: 5
|
||||||
IsRawIndustry(): true
|
IsRawIndustry(): true
|
||||||
ProductionCanIncrease(): true
|
ProductionCanIncrease(): true
|
||||||
|
@ -6933,6 +6936,9 @@
|
||||||
GetName(): Oil Rig
|
GetName(): Oil Rig
|
||||||
CanBuildIndustry(): false
|
CanBuildIndustry(): false
|
||||||
CanProspectIndustry(): false
|
CanProspectIndustry(): false
|
||||||
|
IsBuiltOnWater(): true
|
||||||
|
HasHeliport(): true
|
||||||
|
HasDock(): true
|
||||||
Id: 12
|
Id: 12
|
||||||
IsRawIndustry(): false
|
IsRawIndustry(): false
|
||||||
ProductionCanIncrease(): true
|
ProductionCanIncrease(): true
|
||||||
|
@ -6940,6 +6946,9 @@
|
||||||
GetName(): Bank
|
GetName(): Bank
|
||||||
CanBuildIndustry(): true
|
CanBuildIndustry(): true
|
||||||
CanProspectIndustry(): false
|
CanProspectIndustry(): false
|
||||||
|
IsBuiltOnWater(): false
|
||||||
|
HasHeliport(): false
|
||||||
|
HasDock(): false
|
||||||
Id: 11
|
Id: 11
|
||||||
IsRawIndustry(): true
|
IsRawIndustry(): true
|
||||||
ProductionCanIncrease(): false
|
ProductionCanIncrease(): false
|
||||||
|
@ -6947,6 +6956,9 @@
|
||||||
GetName(): Oil Wells
|
GetName(): Oil Wells
|
||||||
CanBuildIndustry(): false
|
CanBuildIndustry(): false
|
||||||
CanProspectIndustry(): false
|
CanProspectIndustry(): false
|
||||||
|
IsBuiltOnWater(): false
|
||||||
|
HasHeliport(): false
|
||||||
|
HasDock(): false
|
||||||
Id: 1
|
Id: 1
|
||||||
IsRawIndustry(): false
|
IsRawIndustry(): false
|
||||||
ProductionCanIncrease(): true
|
ProductionCanIncrease(): true
|
||||||
|
@ -6954,6 +6966,9 @@
|
||||||
GetName(): Power Station
|
GetName(): Power Station
|
||||||
CanBuildIndustry(): true
|
CanBuildIndustry(): true
|
||||||
CanProspectIndustry(): false
|
CanProspectIndustry(): false
|
||||||
|
IsBuiltOnWater(): false
|
||||||
|
HasHeliport(): false
|
||||||
|
HasDock(): false
|
||||||
Id: 3
|
Id: 3
|
||||||
IsRawIndustry(): true
|
IsRawIndustry(): true
|
||||||
ProductionCanIncrease(): true
|
ProductionCanIncrease(): true
|
||||||
|
@ -6961,6 +6976,9 @@
|
||||||
GetName(): Forest
|
GetName(): Forest
|
||||||
CanBuildIndustry(): false
|
CanBuildIndustry(): false
|
||||||
CanProspectIndustry(): false
|
CanProspectIndustry(): false
|
||||||
|
IsBuiltOnWater(): false
|
||||||
|
HasHeliport(): false
|
||||||
|
HasDock(): false
|
||||||
Id: 2
|
Id: 2
|
||||||
IsRawIndustry(): false
|
IsRawIndustry(): false
|
||||||
ProductionCanIncrease(): true
|
ProductionCanIncrease(): true
|
||||||
|
@ -6968,6 +6986,9 @@
|
||||||
GetName(): Sawmill
|
GetName(): Sawmill
|
||||||
CanBuildIndustry(): true
|
CanBuildIndustry(): true
|
||||||
CanProspectIndustry(): false
|
CanProspectIndustry(): false
|
||||||
|
IsBuiltOnWater(): false
|
||||||
|
HasHeliport(): false
|
||||||
|
HasDock(): false
|
||||||
Id: 18
|
Id: 18
|
||||||
IsRawIndustry(): true
|
IsRawIndustry(): true
|
||||||
ProductionCanIncrease(): true
|
ProductionCanIncrease(): true
|
||||||
|
@ -6975,6 +6996,9 @@
|
||||||
GetName(): Iron Ore Mine
|
GetName(): Iron Ore Mine
|
||||||
CanBuildIndustry(): false
|
CanBuildIndustry(): false
|
||||||
CanProspectIndustry(): false
|
CanProspectIndustry(): false
|
||||||
|
IsBuiltOnWater(): false
|
||||||
|
HasHeliport(): false
|
||||||
|
HasDock(): false
|
||||||
Id: 0
|
Id: 0
|
||||||
IsRawIndustry(): true
|
IsRawIndustry(): true
|
||||||
ProductionCanIncrease(): true
|
ProductionCanIncrease(): true
|
||||||
|
@ -6982,6 +7006,9 @@
|
||||||
GetName(): Coal Mine
|
GetName(): Coal Mine
|
||||||
CanBuildIndustry(): false
|
CanBuildIndustry(): false
|
||||||
CanProspectIndustry(): false
|
CanProspectIndustry(): false
|
||||||
|
IsBuiltOnWater(): false
|
||||||
|
HasHeliport(): false
|
||||||
|
HasDock(): false
|
||||||
Id: 8
|
Id: 8
|
||||||
IsRawIndustry(): false
|
IsRawIndustry(): false
|
||||||
ProductionCanIncrease(): true
|
ProductionCanIncrease(): true
|
||||||
|
@ -6989,6 +7016,9 @@
|
||||||
GetName(): Steel Mill
|
GetName(): Steel Mill
|
||||||
CanBuildIndustry(): true
|
CanBuildIndustry(): true
|
||||||
CanProspectIndustry(): false
|
CanProspectIndustry(): false
|
||||||
|
IsBuiltOnWater(): false
|
||||||
|
HasHeliport(): false
|
||||||
|
HasDock(): false
|
||||||
Id: 4
|
Id: 4
|
||||||
IsRawIndustry(): false
|
IsRawIndustry(): false
|
||||||
ProductionCanIncrease(): true
|
ProductionCanIncrease(): true
|
||||||
|
@ -6996,6 +7026,9 @@
|
||||||
GetName(): Oil Refinery
|
GetName(): Oil Refinery
|
||||||
CanBuildIndustry(): true
|
CanBuildIndustry(): true
|
||||||
CanProspectIndustry(): false
|
CanProspectIndustry(): false
|
||||||
|
IsBuiltOnWater(): false
|
||||||
|
HasHeliport(): false
|
||||||
|
HasDock(): false
|
||||||
Id: 6
|
Id: 6
|
||||||
IsRawIndustry(): false
|
IsRawIndustry(): false
|
||||||
ProductionCanIncrease(): true
|
ProductionCanIncrease(): true
|
||||||
|
@ -7003,6 +7036,9 @@
|
||||||
GetName(): Factory
|
GetName(): Factory
|
||||||
CanBuildIndustry(): true
|
CanBuildIndustry(): true
|
||||||
CanProspectIndustry(): false
|
CanProspectIndustry(): false
|
||||||
|
IsBuiltOnWater(): false
|
||||||
|
HasHeliport(): false
|
||||||
|
HasDock(): false
|
||||||
|
|
||||||
--Map--
|
--Map--
|
||||||
GetMapSize(): 65536
|
GetMapSize(): 65536
|
||||||
|
|
|
@ -111,3 +111,24 @@
|
||||||
uint32 seed = ::InteractiveRandom();
|
uint32 seed = ::InteractiveRandom();
|
||||||
return AIObject::DoCommand(0, industry_type, seed, CMD_BUILD_INDUSTRY);
|
return AIObject::DoCommand(0, industry_type, seed, CMD_BUILD_INDUSTRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */ bool AIIndustryType::IsBuiltOnWater(IndustryType industry_type)
|
||||||
|
{
|
||||||
|
if (!IsValidIndustryType(industry_type)) return false;
|
||||||
|
|
||||||
|
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */ bool AIIndustryType::HasHeliport(IndustryType industry_type)
|
||||||
|
{
|
||||||
|
if (!IsValidIndustryType(industry_type)) return false;
|
||||||
|
|
||||||
|
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */ bool AIIndustryType::HasDock(IndustryType industry_type)
|
||||||
|
{
|
||||||
|
if (!IsValidIndustryType(industry_type)) return false;
|
||||||
|
|
||||||
|
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
|
||||||
|
}
|
||||||
|
|
|
@ -113,6 +113,30 @@ public:
|
||||||
* @note If true is returned the money is paid, whether a new industry was build or not.
|
* @note If true is returned the money is paid, whether a new industry was build or not.
|
||||||
*/
|
*/
|
||||||
static bool ProspectIndustry(IndustryType industry_type);
|
static bool ProspectIndustry(IndustryType industry_type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is this type of industry built on water.
|
||||||
|
* @param industry_type The type of the industry.
|
||||||
|
* @pre IsValidIndustryType(industry_type).
|
||||||
|
* @return True when this type is built on water.
|
||||||
|
*/
|
||||||
|
static bool IsBuiltOnWater(IndustryType industry_type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does this type of industry have a heliport?
|
||||||
|
* @param industry_type The type of the industry.
|
||||||
|
* @pre IsValidIndustryType(industry_type).
|
||||||
|
* @return True when this type has a heliport.
|
||||||
|
*/
|
||||||
|
static bool HasHeliport(IndustryType industry_type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does this type of industry have a dock?
|
||||||
|
* @param industry_type The type of the industry.
|
||||||
|
* @pre IsValidIndustryType(industry_type).
|
||||||
|
* @return True when this type has a dock.
|
||||||
|
*/
|
||||||
|
static bool HasDock(IndustryType industry_type);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* AI_INDUSTRYTYPE_HPP */
|
#endif /* AI_INDUSTRYTYPE_HPP */
|
||||||
|
|
|
@ -28,6 +28,9 @@ void SQAIIndustryType_Register(Squirrel *engine) {
|
||||||
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::CanProspectIndustry, "CanProspectIndustry", 2, ".i");
|
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::CanProspectIndustry, "CanProspectIndustry", 2, ".i");
|
||||||
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::BuildIndustry, "BuildIndustry", 3, ".ii");
|
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::BuildIndustry, "BuildIndustry", 3, ".ii");
|
||||||
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::ProspectIndustry, "ProspectIndustry", 2, ".i");
|
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::ProspectIndustry, "ProspectIndustry", 2, ".i");
|
||||||
|
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::IsBuiltOnWater, "IsBuiltOnWater", 2, ".i");
|
||||||
|
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::HasHeliport, "HasHeliport", 2, ".i");
|
||||||
|
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::HasDock, "HasDock", 2, ".i");
|
||||||
|
|
||||||
SQAIIndustryType.PostRegister(engine);
|
SQAIIndustryType.PostRegister(engine);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue