Changeset - r7260:348163217738
[Not reviewed]
master
0 2 0
belugas - 17 years ago 2007-07-15 00:19:40
belugas@openttd.org
(svn r10572) -Codechange: Add function CheckIfCallBackAllowsAvailability for industries
2 files changed with 14 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/newgrf_industries.cpp
Show inline comments
 
@@ -377,12 +377,25 @@ bool CheckIfCallBackAllowsCreation(TileI
 
		default: _error_message = GetGRFStringID(indspec->grf_prop.grffile->grfid, 0xD000 + group->g.callback.result); break;
 
	}
 

	
 
	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;
 
}
 

	
 
/**
src/newgrf_industries.h
Show inline comments
 
@@ -11,12 +11,13 @@
 
/* in newgrf_industry.cpp */
 
uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available);
 
uint16 GetIndustryCallback(uint16 callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile);
 
uint32 GetIndustryIDAtOffset(TileIndex new_tile, TileIndex old_tile, const Industry *i);
 
void IndustryProductionCallback(Industry *ind, int reason);
 
bool CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uint itspec_index);
 
bool CheckIfCallBackAllowsAvailability(IndustryType type, IndustryAvailabilityCallType creation_type);
 

	
 
IndustryType MapNewGRFIndustryType(IndustryType grf_type, uint32 grf_id);
 

	
 
/* in newgrf_industrytiles.cpp*/
 
uint32 IndustryTileGetRandomBits(const ResolverObject *object);
 
uint32 IndustryTileGetTriggers(const ResolverObject *object);
0 comments (0 inline, 0 general)