mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-23 20:24:12 +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:
@@ -82,7 +82,7 @@
|
||||
|
||||
/* static */ SQInteger ScriptSubsidy::GetSourceIndex(SubsidyID subsidy_id)
|
||||
{
|
||||
if (!IsValidSubsidy(subsidy_id)) return INVALID_SOURCE;
|
||||
if (!IsValidSubsidy(subsidy_id)) return Source::Invalid;
|
||||
|
||||
return ::Subsidy::Get(subsidy_id)->src.id;
|
||||
}
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
/* static */ SQInteger ScriptSubsidy::GetDestinationIndex(SubsidyID subsidy_id)
|
||||
{
|
||||
if (!IsValidSubsidy(subsidy_id)) return INVALID_SOURCE;
|
||||
if (!IsValidSubsidy(subsidy_id)) return Source::Invalid;
|
||||
|
||||
return ::Subsidy::Get(subsidy_id)->dst.id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user