1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2025-12-23 21:22:46 +01:00

Codechange: change Source into a class with conversion helpers

A Source is either a CompanyID (Headquarters), IndustryID or TownID.
When making those types stronger a lot of casts would be needed, but
with these simple helpers the intent is shown more clearly.
This commit is contained in:
Rubidium
2025-02-08 15:02:13 +01:00
committed by rubidium42
parent 2929411130
commit 155d7de132
14 changed files with 87 additions and 54 deletions

View File

@@ -132,7 +132,7 @@ void CargoPacket::Reduce(uint count)
/* static */ void CargoPacket::InvalidateAllFrom(Source src)
{
for (CargoPacket *cp : CargoPacket::Iterate()) {
if (cp->source == src) cp->source.id = INVALID_SOURCE;
if (cp->source == src) cp->source.MakeInvalid();
}
}