summaryrefslogtreecommitdiff
path: root/src/newgrf_industries.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-07-15 00:19:40 +0000
committerbelugas <belugas@openttd.org>2007-07-15 00:19:40 +0000
commit318f19f5a45773848ec2d9efce33840e5c41d56e (patch)
tree2708f4399b0d84a608adcc1e9af729210767f270 /src/newgrf_industries.cpp
parent6d22aa54cfda4531d918694d873db3e4b8aa5480 (diff)
downloadopenttd-318f19f5a45773848ec2d9efce33840e5c41d56e.tar.xz
(svn r10572) -Codechange: Add function CheckIfCallBackAllowsAvailability for industries
Diffstat (limited to 'src/newgrf_industries.cpp')
-rw-r--r--src/newgrf_industries.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index b9437531d..11b1ad279 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -380,6 +380,19 @@ bool CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uint itspe
return false;
}
+bool CheckIfCallBackAllowsAvailability(IndustryType type, IndustryAvailabilityCallType creation_type)
+{
+ const IndustrySpec *indspec = GetIndustrySpec(type);
+
+ if (HASBIT(indspec->callback_flags, CBM_IND_AVAILABLE)) {
+ uint16 res = GetIndustryCallback(CBID_INDUSTRY_AVAILABLE, 0, creation_type, NULL, type, INVALID_TILE);
+ if (res != CALLBACK_FAILED) {
+ return (res == 0);
+ }
+ }
+ return true;
+}
+
static int32 DerefIndProd(uint field, bool use_register)
{
return use_register ? (int32)GetRegister(field) : field;