1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 01:12:39 +01:00

Codechange: put SourceType and SourceID into Source struct

This commit is contained in:
Rubidium
2025-02-05 20:15:11 +01:00
committed by rubidium42
parent 95bfd68341
commit 5f41bc0279
20 changed files with 180 additions and 199 deletions

View File

@@ -591,7 +591,7 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags)
if (flags & DC_EXEC) {
c->location_of_HQ = INVALID_TILE; // reset HQ position
SetWindowDirty(WC_COMPANY, c->index);
CargoPacket::InvalidateAllFrom(SourceType::Headquarters, c->index);
CargoPacket::InvalidateAllFrom({c->index, SourceType::Headquarters});
}
/* cost of relocating company is 1% of company value */
@@ -704,13 +704,13 @@ static void TileLoop_Object(TileIndex tile)
/* Scale by cargo scale setting. */
amt = ScaleByCargoScale(amt, true);
MoveGoodsToStation(pass, amt, SourceType::Headquarters, GetTileOwner(tile), stations.GetStations());
MoveGoodsToStation(pass, amt, {GetTileOwner(tile), SourceType::Headquarters}, stations.GetStations());
}
/* Top town building generates 90, HQ can make up to 196. The
* proportion passengers:mail is about the same as in the acceptance
* equations. */
CargoType mail = GetCargoTypeByLabel(CT_MAIL);
CargoType mail = GetCargoTypeByLabel(CT_MAIL);
if (IsValidCargoType(mail) && GB(r, 8, 8) < (196 / 4 / (6 - level))) {
uint amt = GB(r, 8, 8) / 8 / 4 + 1;
@@ -720,7 +720,7 @@ static void TileLoop_Object(TileIndex tile)
/* Scale by cargo scale setting. */
amt = ScaleByCargoScale(amt, true);
MoveGoodsToStation(mail, amt, SourceType::Headquarters, GetTileOwner(tile), stations.GetStations());
MoveGoodsToStation(mail, amt, {GetTileOwner(tile), SourceType::Headquarters}, stations.GetStations());
}
}