|
@@ -345,25 +345,25 @@ static Foundation GetFoundation_Industry
|
|
|
* draw the wall of the foundation in this case.
|
|
|
*/
|
|
|
if (gfx >= NEW_INDUSTRYTILEOFFSET) {
|
|
|
const IndustryTileSpec *indts = GetIndustryTileSpec(gfx);
|
|
|
if (indts->grf_prop.spritegroup != NULL && HasBit(indts->callback_flags, CBM_INDT_DRAW_FOUNDATIONS)) {
|
|
|
uint32 callback_res = GetIndustryTileCallback(CBID_INDUSTRY_DRAW_FOUNDATIONS, 0, 0, gfx, GetIndustryByTile(tile), tile);
|
|
|
if (callback_res == 0) return FOUNDATION_NONE;
|
|
|
}
|
|
|
}
|
|
|
return FlatteningFoundation(tileh);
|
|
|
}
|
|
|
|
|
|
static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac)
|
|
|
static void AddAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac)
|
|
|
{
|
|
|
IndustryGfx gfx = GetIndustryGfx(tile);
|
|
|
const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
|
|
|
|
|
|
/* When we have to use a callback, we put our data in the next two variables */
|
|
|
CargoID raw_accepts_cargo[lengthof(itspec->accepts_cargo)];
|
|
|
uint8 raw_acceptance[lengthof(itspec->acceptance)];
|
|
|
|
|
|
/* And then these will always point to a same sized array with the required data */
|
|
|
const CargoID *accepts_cargo = itspec->accepts_cargo;
|
|
|
const uint8 *acceptance = itspec->acceptance;
|
|
|
|
|
@@ -376,26 +376,25 @@ static void GetAcceptedCargo_Industry(Ti
|
|
|
}
|
|
|
|
|
|
if (HasBit(itspec->callback_flags, CBM_INDT_CARGO_ACCEPTANCE)) {
|
|
|
uint16 res = GetIndustryTileCallback(CBID_INDTILE_CARGO_ACCEPTANCE, 0, 0, gfx, GetIndustryByTile(tile), tile);
|
|
|
if (res != CALLBACK_FAILED) {
|
|
|
acceptance = raw_acceptance;
|
|
|
for (uint i = 0; i < lengthof(itspec->accepts_cargo); i++) raw_acceptance[i] = GB(res, i * 4, 4);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (byte i = 0; i < lengthof(itspec->accepts_cargo); i++) {
|
|
|
CargoID a = accepts_cargo[i];
|
|
|
/* Only set the value once. */
|
|
|
if (a != CT_INVALID && ac[a] == 0) ac[a] = acceptance[i];
|
|
|
if (a != CT_INVALID) ac[a] += acceptance[i];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)
|
|
|
{
|
|
|
const Industry *i = GetIndustryByTile(tile);
|
|
|
const IndustrySpec *is = GetIndustrySpec(i->type);
|
|
|
|
|
|
td->owner[0] = i->owner;
|
|
|
td->str = is->name;
|
|
|
if (!IsIndustryCompleted(tile)) {
|
|
|
SetDParamX(td->dparam, 0, td->str);
|
|
@@ -2376,24 +2375,24 @@ static CommandCost TerraformTile_Industr
|
|
|
/* allow autoslope */
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
|
|
}
|
|
|
|
|
|
extern const TileTypeProcs _tile_type_industry_procs = {
|
|
|
DrawTile_Industry, // draw_tile_proc
|
|
|
GetSlopeZ_Industry, // get_slope_z_proc
|
|
|
ClearTile_Industry, // clear_tile_proc
|
|
|
GetAcceptedCargo_Industry, // get_accepted_cargo_proc
|
|
|
AddAcceptedCargo_Industry, // add_accepted_cargo_proc
|
|
|
GetTileDesc_Industry, // get_tile_desc_proc
|
|
|
GetTileTrackStatus_Industry, // get_tile_track_status_proc
|
|
|
ClickTile_Industry, // click_tile_proc
|
|
|
AnimateTile_Industry, // animate_tile_proc
|
|
|
TileLoop_Industry, // tile_loop_proc
|
|
|
ChangeTileOwner_Industry, // change_tile_owner_proc
|
|
|
GetProducedCargo_Industry, // get_produced_cargo_proc
|
|
|
NULL, // vehicle_enter_tile_proc
|
|
|
GetFoundation_Industry, // get_foundation_proc
|
|
|
TerraformTile_Industry, // terraform_tile_proc
|
|
|
};
|