Changeset - r7658:dc7d1afc14ba
[Not reviewed]
master
0 1 0
rubidium - 17 years ago 2007-09-30 18:53:59
rubidium@openttd.org
(svn r11189) -Fix: if the location check callback results in something invalid (i.e. not a callback result), the industry should be allowed to be build as that's how TTDP does it.
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/newgrf_industries.cpp
Show inline comments
 
@@ -430,25 +430,27 @@ bool CheckIfCallBackAllowsCreation(TileI
 
	ResolverObject object;
 
	const SpriteGroup *group;
 

	
 
	NewIndustryResolver(&object, tile, NULL);
 
	object.GetVariable = IndustryLocationGetVariable;
 
	object.callback = CBID_INDUSTRY_LOCATION;
 
	object.u.industry_location.tile = tile;
 
	object.u.industry_location.spec = indspec;
 
	object.u.industry_location.itspec_index = itspec_index;
 

	
 
	group = Resolve(GetIndustrySpec(type)->grf_prop.spritegroup, &object);
 

	
 
	if (group == NULL || group->type != SGT_CALLBACK) return false;
 
	/* Unlike the "normal" cases, not having a valid result means we allow
 
	 * the building of the industry, as that's how it's done in TTDP. */
 
	if (group == NULL || group->type != SGT_CALLBACK) return true;
 

	
 
	switch (group->g.callback.result) {
 
		case 0x400: return true;
 
		case 0x401: _error_message = STR_0239_SITE_UNSUITABLE; break;
 
		case 0x402: _error_message = STR_0317_CAN_ONLY_BE_BUILT_IN_RAINFOREST; break;
 
		case 0x403: _error_message = STR_0318_CAN_ONLY_BE_BUILT_IN_DESERT; break;
 
		default: _error_message = GetGRFStringID(indspec->grf_prop.grffile->grfid, 0xD000 + group->g.callback.result); break;
 
	}
 

	
 
	return false;
 
}
 

	
0 comments (0 inline, 0 general)