src/newgrf_house.cpp
changeset 9750 7114408dd1fa
parent 9659 187142ff9b6c
child 10110 47ebe4990978
equal deleted inserted replaced
9749:ad943e548576 9750:7114408dd1fa
   181 	town_class_count = town->building_counts.class_count[class_id];
   181 	town_class_count = town->building_counts.class_count[class_id];
   182 
   182 
   183 	return map_class_count << 24 | town_class_count << 16 | map_id_count << 8 | town_id_count;
   183 	return map_class_count << 24 | town_class_count << 16 | map_id_count << 8 | town_id_count;
   184 }
   184 }
   185 
   185 
   186 static uint32 GetGRFParameter(HouseID house_id, byte parameter)
       
   187 {
       
   188 	const HouseSpec *hs = GetHouseSpecs(house_id);
       
   189 	const GRFFile *file = hs->grffile;
       
   190 
       
   191 	if (parameter >= file->param_end) return 0;
       
   192 	return file->param[parameter];
       
   193 }
       
   194 
       
   195 uint32 GetNearbyTileInformation(byte parameter, TileIndex tile)
   186 uint32 GetNearbyTileInformation(byte parameter, TileIndex tile)
   196 {
   187 {
   197 	tile = GetNearbyTile(parameter, tile);
   188 	tile = GetNearbyTile(parameter, tile);
   198 	return GetNearbyTileInformation(tile);
   189 	return GetNearbyTileInformation(tile);
   199 }
   190 }
   367 		/* Cargo acceptance history of nearby stations */
   358 		/* Cargo acceptance history of nearby stations */
   368 		/*case 0x64: not implemented yet */
   359 		/*case 0x64: not implemented yet */
   369 
   360 
   370 		/* Distance test for some house types */
   361 		/* Distance test for some house types */
   371 		case 0x65: return GetDistanceFromNearbyHouse(parameter, tile, object->u.house.house_id);
   362 		case 0x65: return GetDistanceFromNearbyHouse(parameter, tile, object->u.house.house_id);
   372 
       
   373 		/* Read GRF parameter */
       
   374 		case 0x7F: return GetGRFParameter(object->u.house.house_id, parameter);
       
   375 	}
   363 	}
   376 
   364 
   377 	DEBUG(grf, 1, "Unhandled house property 0x%X", variable);
   365 	DEBUG(grf, 1, "Unhandled house property 0x%X", variable);
   378 
   366 
   379 	*available = false;
   367 	*available = false;
   408 	res->callback_param2 = 0;
   396 	res->callback_param2 = 0;
   409 	res->last_value      = 0;
   397 	res->last_value      = 0;
   410 	res->trigger         = 0;
   398 	res->trigger         = 0;
   411 	res->reseed          = 0;
   399 	res->reseed          = 0;
   412 	res->count           = 0;
   400 	res->count           = 0;
       
   401 
       
   402 	const HouseSpec *hs = GetHouseSpecs(house_id);
       
   403 	res->grffile         = (hs != NULL ? hs->grffile : NULL);
   413 }
   404 }
   414 
   405 
   415 uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile)
   406 uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile)
   416 {
   407 {
   417 	ResolverObject object;
   408 	ResolverObject object;