1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-24 04:34:16 +01:00

Codechange: Use enum class for NewsType.

This commit is contained in:
Peter Nelson
2025-02-02 17:58:55 +00:00
committed by Peter Nelson
parent 4fd1929bf7
commit ca75a8ce19
19 changed files with 111 additions and 110 deletions

View File

@@ -293,7 +293,7 @@
* \li GSEngine::IsValidEngine and GSEngine::IsBuildable when outside GSCompanyMode scope
* \li GSEventExclusiveTransportRights
* \li GSEventRoadReconstruction
* \li GSNews::NT_ACCIDENT, GSNews::NT_COMPANY_INFO, GSNews::NT_ADVICE, GSNews::NT_ACCEPTANCE
* \li GSNews::NewsType::Accident, GSNews::NewsType::CompanyInfo, GSNews::NewsType::Advice, GSNews::NewsType::Acceptance
* \li GSIndustryType::IsProcessingIndustry
* \li GSStation::IsAirportClosed
* \li GSStation::OpenCloseAirport

View File

@@ -24,13 +24,13 @@ public:
*/
enum NewsType {
/* Arbitrary selection of NewsTypes which might make sense for scripts */
NT_ACCIDENT = ::NT_ACCIDENT, ///< Category accidents.
NT_COMPANY_INFO = ::NT_COMPANY_INFO, ///< Category company info.
NT_ECONOMY = ::NT_ECONOMY, ///< Category economy.
NT_ADVICE = ::NT_ADVICE, ///< Category vehicle advice.
NT_ACCEPTANCE = ::NT_ACCEPTANCE, ///< Category acceptance changes.
NT_SUBSIDIES = ::NT_SUBSIDIES, ///< Category subsidies.
NT_GENERAL = ::NT_GENERAL, ///< Category general.
NT_ACCIDENT = to_underlying(::NewsType::Accident), ///< Category accidents.
NT_COMPANY_INFO = to_underlying(::NewsType::CompanyInfo), ///< Category company info.
NT_ECONOMY = to_underlying(::NewsType::Economy), ///< Category economy.
NT_ADVICE = to_underlying(::NewsType::Advice), ///< Category vehicle advice.
NT_ACCEPTANCE = to_underlying(::NewsType::Acceptance), ///< Category acceptance changes.
NT_SUBSIDIES = to_underlying(::NewsType::Subsidies), ///< Category subsidies.
NT_GENERAL = to_underlying(::NewsType::General), ///< Category general.
};
/**
@@ -58,7 +58,7 @@ public:
* - For #NR_INDUSTRY this parameter should be a valid industryID (ScriptIndustry::IsValidIndustry).
* - For #NR_TOWN this parameter should be a valid townID (ScriptTown::IsValidTown).
* @return True if the action succeeded.
* @pre type must be #NT_ECONOMY, #NT_SUBSIDIES, or #NT_GENERAL.
* @pre type must be #NewsType::Economy, #NewsType::Subsidies, or #NewsType::General.
* @pre text != null.
* @pre company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.
* @pre The \a reference condition must be fulfilled.