Codechange: Disentangle news window style from news flags. (#13482)

This avoids NewsFlags being used as both bitmask and bitstuffed data.
This commit is contained in:
Peter Nelson 2025-02-07 13:10:39 +00:00 committed by GitHub
parent ccd3d3a547
commit eaa765d615
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 42 additions and 40 deletions

View File

@ -433,7 +433,7 @@ set_name:;
SetDParam(1, STR_NEWS_COMPANY_LAUNCH_DESCRIPTION); SetDParam(1, STR_NEWS_COMPANY_LAUNCH_DESCRIPTION);
SetDParamStr(2, cni->company_name); SetDParamStr(2, cni->company_name);
SetDParam(3, t->index); SetDParam(3, t->index);
AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NT_COMPANY_INFO, NF_COMPANY, NR_TILE, c->last_build_coordinate.base(), NR_NONE, UINT32_MAX, std::move(cni)); AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NT_COMPANY_INFO, NewsStyle::Company, {}, NR_TILE, c->last_build_coordinate.base(), NR_NONE, UINT32_MAX, std::move(cni));
} }
return; return;
} }

View File

@ -148,7 +148,7 @@ static IntervalTimer<TimerGameCalendar> _check_switch_to_euro({TimerGameCalendar
_currency_specs[_settings_game.locale.currency].to_euro != CF_ISEURO && _currency_specs[_settings_game.locale.currency].to_euro != CF_ISEURO &&
TimerGameCalendar::year >= _currency_specs[_settings_game.locale.currency].to_euro) { TimerGameCalendar::year >= _currency_specs[_settings_game.locale.currency].to_euro) {
_settings_game.locale.currency = 2; // this is the index of euro above. _settings_game.locale.currency = 2; // this is the index of euro above.
AddNewsItem(STR_NEWS_EURO_INTRODUCTION, NT_ECONOMY, NF_NORMAL); AddNewsItem(STR_NEWS_EURO_INTRODUCTION, NT_ECONOMY, NewsStyle::Normal, {});
} }
}); });

View File

@ -873,10 +873,10 @@ static void HandleEconomyFluctuations()
if (_economy.fluct == 0) { if (_economy.fluct == 0) {
_economy.fluct = -(int)GB(Random(), 0, 2); _economy.fluct = -(int)GB(Random(), 0, 2);
AddNewsItem(STR_NEWS_BEGIN_OF_RECESSION, NT_ECONOMY, NF_NORMAL); AddNewsItem(STR_NEWS_BEGIN_OF_RECESSION, NT_ECONOMY, NewsStyle::Normal, {});
} else if (_economy.fluct == -12) { } else if (_economy.fluct == -12) {
_economy.fluct = GB(Random(), 0, 8) + 312; _economy.fluct = GB(Random(), 0, 8) + 312;
AddNewsItem(STR_NEWS_END_OF_RECESSION, NT_ECONOMY, NF_NORMAL); AddNewsItem(STR_NEWS_END_OF_RECESSION, NT_ECONOMY, NewsStyle::Normal, {});
} }
} }

View File

@ -1131,7 +1131,7 @@ static void NewVehicleAvailable(Engine *e)
if (!IsVehicleTypeDisabled(e->type, false) && !e->info.extra_flags.Test(ExtraEngineFlag::NoNews)) { if (!IsVehicleTypeDisabled(e->type, false) && !e->info.extra_flags.Test(ExtraEngineFlag::NoNews)) {
SetDParam(0, GetEngineCategoryName(index)); SetDParam(0, GetEngineCategoryName(index));
SetDParam(1, PackEngineNameDParam(index, EngineNameContext::PreviewNews)); SetDParam(1, PackEngineNameDParam(index, EngineNameContext::PreviewNews));
AddNewsItem(STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE, NT_NEW_VEHICLES, NF_VEHICLE, NR_ENGINE, index); AddNewsItem(STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE, NT_NEW_VEHICLES, NewsStyle::Vehicle, {}, NR_ENGINE, index);
} }
/* Update the toolbar. */ /* Update the toolbar. */

View File

@ -15,11 +15,11 @@
#include "station_type.h" #include "station_type.h"
#include "industry_type.h" #include "industry_type.h"
void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceType reftype1 = NR_NONE, uint32_t ref1 = UINT32_MAX, NewsReferenceType reftype2 = NR_NONE, uint32_t ref2 = UINT32_MAX, std::unique_ptr<NewsAllocatedData> &&data = nullptr, AdviceType advice_type = AdviceType::Invalid); void AddNewsItem(StringID string, NewsType type, NewsStyle style, NewsFlag flags, NewsReferenceType reftype1 = NR_NONE, uint32_t ref1 = UINT32_MAX, NewsReferenceType reftype2 = NR_NONE, uint32_t ref2 = UINT32_MAX, std::unique_ptr<NewsAllocatedData> &&data = nullptr, AdviceType advice_type = AdviceType::Invalid);
inline void AddCompanyNewsItem(StringID string, std::unique_ptr<CompanyNewsInformation> cni) inline void AddCompanyNewsItem(StringID string, std::unique_ptr<CompanyNewsInformation> cni)
{ {
AddNewsItem(string, NT_COMPANY_INFO, NF_COMPANY, NR_NONE, UINT32_MAX, NR_NONE, UINT32_MAX, std::move(cni)); AddNewsItem(string, NT_COMPANY_INFO, NewsStyle::Company, {}, NR_NONE, UINT32_MAX, NR_NONE, UINT32_MAX, std::move(cni));
} }
/** /**
@ -29,7 +29,7 @@ inline void AddCompanyNewsItem(StringID string, std::unique_ptr<CompanyNewsInfor
*/ */
inline void AddVehicleNewsItem(StringID string, NewsType type, VehicleID vehicle, StationID station = INVALID_STATION) inline void AddVehicleNewsItem(StringID string, NewsType type, VehicleID vehicle, StationID station = INVALID_STATION)
{ {
AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_VEHICLE, vehicle, station == INVALID_STATION ? NR_NONE : NR_STATION, station); AddNewsItem(string, type, NewsStyle::Thin, NF_NO_TRANSPARENT | NF_SHADE, NR_VEHICLE, vehicle, station == INVALID_STATION ? NR_NONE : NR_STATION, station);
} }
/** /**
@ -39,17 +39,17 @@ inline void AddVehicleNewsItem(StringID string, NewsType type, VehicleID vehicle
*/ */
inline void AddVehicleAdviceNewsItem(AdviceType advice_type, StringID string, VehicleID vehicle) inline void AddVehicleAdviceNewsItem(AdviceType advice_type, StringID string, VehicleID vehicle)
{ {
AddNewsItem(string, NT_ADVICE, NF_INCOLOUR | NF_SMALL | NF_VEHICLE_PARAM0, NR_VEHICLE, vehicle, NR_NONE, {}, nullptr, advice_type); AddNewsItem(string, NT_ADVICE, NewsStyle::Small, NF_INCOLOUR | NF_VEHICLE_PARAM0, NR_VEHICLE, vehicle, NR_NONE, {}, nullptr, advice_type);
} }
inline void AddTileNewsItem(StringID string, NewsType type, TileIndex tile, std::unique_ptr<NewsAllocatedData> &&data = nullptr, StationID station = INVALID_STATION) inline void AddTileNewsItem(StringID string, NewsType type, TileIndex tile, std::unique_ptr<NewsAllocatedData> &&data = nullptr, StationID station = INVALID_STATION)
{ {
AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_TILE, tile.base(), station == INVALID_STATION ? NR_NONE : NR_STATION, station, std::move(data)); AddNewsItem(string, type, NewsStyle::Thin, NF_NO_TRANSPARENT | NF_SHADE, NR_TILE, tile.base(), station == INVALID_STATION ? NR_NONE : NR_STATION, station, std::move(data));
} }
inline void AddIndustryNewsItem(StringID string, NewsType type, IndustryID industry, std::unique_ptr<NewsAllocatedData> &&data = nullptr) inline void AddIndustryNewsItem(StringID string, NewsType type, IndustryID industry, std::unique_ptr<NewsAllocatedData> &&data = nullptr)
{ {
AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_INDUSTRY, industry, NR_NONE, UINT32_MAX, std::move(data)); AddNewsItem(string, type, NewsStyle::Thin, NF_NO_TRANSPARENT | NF_SHADE, NR_INDUSTRY, industry, NR_NONE, UINT32_MAX, std::move(data));
} }
void NewsLoop(); void NewsLoop();

View File

@ -294,16 +294,16 @@ static WindowDesc _small_news_desc(
* Window layouts for news items. * Window layouts for news items.
*/ */
static WindowDesc *_news_window_layout[] = { static WindowDesc *_news_window_layout[] = {
&_thin_news_desc, ///< NF_THIN &_thin_news_desc, // NewsStyle::Thin
&_small_news_desc, ///< NF_SMALL &_small_news_desc, // NewsStyle::Small
&_normal_news_desc, ///< NF_NORMAL &_normal_news_desc, // NewsStyle::Normal
&_vehicle_news_desc, ///< NF_VEHICLE &_vehicle_news_desc, // NewsStyle::Vehicle
&_company_news_desc, ///< NF_COMPANY &_company_news_desc, // NewsStyle::Company
}; };
WindowDesc &GetNewsWindowLayout(NewsFlag flags) static WindowDesc &GetNewsWindowLayout(NewsStyle style)
{ {
uint layout = GB(flags, NFB_WINDOW_LAYOUT, NFB_WINDOW_LAYOUT_COUNT); uint layout = to_underlying(style);
assert(layout < lengthof(_news_window_layout)); assert(layout < lengthof(_news_window_layout));
return *_news_window_layout[layout]; return *_news_window_layout[layout];
} }
@ -703,7 +703,7 @@ static void ShowNewspaper(const NewsItem *ni)
SoundFx sound = _news_type_data[ni->type].sound; SoundFx sound = _news_type_data[ni->type].sound;
if (sound != 0 && _settings_client.sound.news_full) SndPlayFx(sound); if (sound != 0 && _settings_client.sound.news_full) SndPlayFx(sound);
new NewsWindow(GetNewsWindowLayout(ni->flags), ni); new NewsWindow(GetNewsWindowLayout(ni->style), ni);
} }
/** Show news item in the ticker */ /** Show news item in the ticker */
@ -874,8 +874,8 @@ static std::list<NewsItem>::iterator DeleteNewsItem(std::list<NewsItem>::iterato
* *
* @see NewsSubtype * @see NewsSubtype
*/ */
NewsItem::NewsItem(StringID string_id, NewsType type, NewsFlag flags, NewsReferenceType reftype1, uint32_t ref1, NewsReferenceType reftype2, uint32_t ref2, std::unique_ptr<NewsAllocatedData> &&data, AdviceType advice_type) : NewsItem::NewsItem(StringID string_id, NewsType type, NewsStyle style, NewsFlag flags, NewsReferenceType reftype1, uint32_t ref1, NewsReferenceType reftype2, uint32_t ref2, std::unique_ptr<NewsAllocatedData> &&data, AdviceType advice_type) :
string_id(string_id), date(TimerGameCalendar::date), economy_date(TimerGameEconomy::date), type(type), advice_type(advice_type), flags(flags), reftype1(reftype1), reftype2(reftype2), ref1(ref1), ref2(ref2), data(std::move(data)) string_id(string_id), date(TimerGameCalendar::date), economy_date(TimerGameEconomy::date), type(type), advice_type(advice_type), style(style), flags(flags), reftype1(reftype1), reftype2(reftype2), ref1(ref1), ref2(ref2), data(std::move(data))
{ {
/* show this news message in colour? */ /* show this news message in colour? */
if (TimerGameCalendar::year >= _settings_client.gui.coloured_news_year) this->flags |= NF_INCOLOUR; if (TimerGameCalendar::year >= _settings_client.gui.coloured_news_year) this->flags |= NF_INCOLOUR;
@ -896,12 +896,12 @@ NewsItem::NewsItem(StringID string_id, NewsType type, NewsFlag flags, NewsRefere
* *
* @see NewsSubtype * @see NewsSubtype
*/ */
void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceType reftype1, uint32_t ref1, NewsReferenceType reftype2, uint32_t ref2, std::unique_ptr<NewsAllocatedData> &&data, AdviceType advice_type) void AddNewsItem(StringID string, NewsType type, NewsStyle style, NewsFlag flags, NewsReferenceType reftype1, uint32_t ref1, NewsReferenceType reftype2, uint32_t ref2, std::unique_ptr<NewsAllocatedData> &&data, AdviceType advice_type)
{ {
if (_game_mode == GM_MENU) return; if (_game_mode == GM_MENU) return;
/* Create new news item node */ /* Create new news item node */
_news.emplace_front(string, type, flags, reftype1, ref1, reftype2, ref2, std::move(data), advice_type); _news.emplace_front(string, type, style, flags, reftype1, ref1, reftype2, ref2, std::move(data), advice_type);
/* Keep the number of stored news items to a managable number */ /* Keep the number of stored news items to a managable number */
if (std::size(_news) > MAX_NEWS_AMOUNT) { if (std::size(_news) > MAX_NEWS_AMOUNT) {
@ -962,7 +962,7 @@ CommandCost CmdCustomNewsItem(DoCommandFlag flags, NewsType type, NewsReferenceT
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
SetDParamStr(0, text); SetDParamStr(0, text);
AddNewsItem(STR_NEWS_CUSTOM_ITEM, type, NF_NORMAL, reftype1, reference, NR_NONE, UINT32_MAX); AddNewsItem(STR_NEWS_CUSTOM_ITEM, type, NewsStyle::Normal, {}, reftype1, reference, NR_NONE, UINT32_MAX);
} }
return CommandCost(); return CommandCost();

View File

@ -74,6 +74,15 @@ enum NewsReferenceType : uint8_t {
NR_ENGINE, ///< Reference engine. NR_ENGINE, ///< Reference engine.
}; };
/** News Window Styles. */
enum class NewsStyle : uint8_t {
Thin, ///< Thin news item. (Newspaper with headline and viewport)
Small, ///< Small news item. (Information window with text and viewport)
Normal, ///< Normal news item. (Newspaper with text only)
Vehicle, ///< Vehicle news item. (new engine available)
Company, ///< Company news item. (Newspaper with face)
};
/** /**
* Various OR-able news-item flags. * Various OR-able news-item flags.
* @note #NF_INCOLOUR is set automatically if needed. * @note #NF_INCOLOUR is set automatically if needed.
@ -82,20 +91,12 @@ enum NewsFlag : uint8_t {
NFB_INCOLOUR = 0, ///< News item is shown in colour (otherwise it is shown in black & white). NFB_INCOLOUR = 0, ///< News item is shown in colour (otherwise it is shown in black & white).
NFB_NO_TRANSPARENT = 1, ///< News item disables transparency in the viewport. NFB_NO_TRANSPARENT = 1, ///< News item disables transparency in the viewport.
NFB_SHADE = 2, ///< News item uses shaded colours. NFB_SHADE = 2, ///< News item uses shaded colours.
NFB_WINDOW_LAYOUT = 3, ///< First bit for window layout.
NFB_WINDOW_LAYOUT_COUNT = 3, ///< Number of bits for window layout.
NFB_VEHICLE_PARAM0 = 6, ///< String param 0 contains a vehicle ID. (special autoreplace behaviour) NFB_VEHICLE_PARAM0 = 6, ///< String param 0 contains a vehicle ID. (special autoreplace behaviour)
NF_INCOLOUR = 1 << NFB_INCOLOUR, ///< Bit value for coloured news. NF_INCOLOUR = 1 << NFB_INCOLOUR, ///< Bit value for coloured news.
NF_NO_TRANSPARENT = 1 << NFB_NO_TRANSPARENT, ///< Bit value for disabling transparency. NF_NO_TRANSPARENT = 1 << NFB_NO_TRANSPARENT, ///< Bit value for disabling transparency.
NF_SHADE = 1 << NFB_SHADE, ///< Bit value for enabling shading. NF_SHADE = 1 << NFB_SHADE, ///< Bit value for enabling shading.
NF_VEHICLE_PARAM0 = 1 << NFB_VEHICLE_PARAM0, ///< Bit value for specifying that string param 0 contains a vehicle ID. (special autoreplace behaviour) NF_VEHICLE_PARAM0 = 1 << NFB_VEHICLE_PARAM0, ///< Bit value for specifying that string param 0 contains a vehicle ID. (special autoreplace behaviour)
NF_THIN = 0 << NFB_WINDOW_LAYOUT, ///< Thin news item. (Newspaper with headline and viewport)
NF_SMALL = 1 << NFB_WINDOW_LAYOUT, ///< Small news item. (Information window with text and viewport)
NF_NORMAL = 2 << NFB_WINDOW_LAYOUT, ///< Normal news item. (Newspaper with text only)
NF_VEHICLE = 3 << NFB_WINDOW_LAYOUT, ///< Vehicle news item. (new engine available)
NF_COMPANY = 4 << NFB_WINDOW_LAYOUT, ///< Company news item. (Newspaper with face)
}; };
DECLARE_ENUM_AS_BIT_SET(NewsFlag) DECLARE_ENUM_AS_BIT_SET(NewsFlag)
@ -146,6 +147,7 @@ struct NewsItem {
TimerGameEconomy::Date economy_date; ///< Economy date of the news item, never shown but used to calculate age TimerGameEconomy::Date economy_date; ///< Economy date of the news item, never shown but used to calculate age
NewsType type; ///< Type of the news NewsType type; ///< Type of the news
AdviceType advice_type; ///< The type of advice, to be able to remove specific advices later on. AdviceType advice_type; ///< The type of advice, to be able to remove specific advices later on.
NewsStyle style; /// Window style for the news.
NewsFlag flags; ///< NewsFlags bits @see NewsFlag NewsFlag flags; ///< NewsFlags bits @see NewsFlag
NewsReferenceType reftype1; ///< Type of ref1 NewsReferenceType reftype1; ///< Type of ref1
@ -157,7 +159,7 @@ struct NewsItem {
std::vector<StringParameterData> params; ///< Parameters for string resolving. std::vector<StringParameterData> params; ///< Parameters for string resolving.
NewsItem(StringID string_id, NewsType type, NewsFlag flags, NewsReferenceType reftype1, uint32_t ref1, NewsReferenceType reftype2, uint32_t ref2, std::unique_ptr<NewsAllocatedData> &&data, AdviceType advice_type); NewsItem(StringID string_id, NewsType type, NewsStyle style, NewsFlag flags, NewsReferenceType reftype1, uint32_t ref1, NewsReferenceType reftype2, uint32_t ref2, std::unique_ptr<NewsAllocatedData> &&data, AdviceType advice_type);
}; };
/** /**

View File

@ -534,7 +534,7 @@ static void ShowRejectOrAcceptNews(const Station *st, CargoTypes cargoes, bool r
SetDParam(0, st->index); SetDParam(0, st->index);
SetDParam(1, cargoes); SetDParam(1, cargoes);
StringID msg = reject ? STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_LIST : STR_NEWS_STATION_NOW_ACCEPTS_CARGO_LIST; StringID msg = reject ? STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_LIST : STR_NEWS_STATION_NOW_ACCEPTS_CARGO_LIST;
AddNewsItem(msg, NT_ACCEPTANCE, NF_INCOLOUR | NF_SMALL, NR_STATION, st->index); AddNewsItem(msg, NT_ACCEPTANCE, NewsStyle::Small, NF_INCOLOUR, NR_STATION, st->index);
} }
/** /**

View File

@ -56,7 +56,7 @@ void Subsidy::AwardTo(CompanyID company)
SetDParamStr(0, company_name); SetDParamStr(0, company_name);
AddNewsItem( AddNewsItem(
STR_NEWS_SERVICE_SUBSIDY_AWARDED_HALF + _settings_game.difficulty.subsidy_multiplier, STR_NEWS_SERVICE_SUBSIDY_AWARDED_HALF + _settings_game.difficulty.subsidy_multiplier,
NT_SUBSIDIES, NF_NORMAL, NT_SUBSIDIES, NewsStyle::Normal, {},
reftype.first, this->src, reftype.second, this->dst reftype.first, this->src, reftype.second, this->dst
); );
AI::BroadcastNewEvent(new ScriptEventSubsidyAwarded(this->index)); AI::BroadcastNewEvent(new ScriptEventSubsidyAwarded(this->index));
@ -222,7 +222,7 @@ void CreateSubsidy(CargoType cargo_type, SourceType src_type, SourceID src, Sour
s->awarded = INVALID_COMPANY; s->awarded = INVALID_COMPANY;
std::pair<NewsReferenceType, NewsReferenceType> reftype = SetupSubsidyDecodeParam(s, SubsidyDecodeParamType::NewsOffered); std::pair<NewsReferenceType, NewsReferenceType> reftype = SetupSubsidyDecodeParam(s, SubsidyDecodeParamType::NewsOffered);
AddNewsItem(STR_NEWS_SERVICE_SUBSIDY_OFFERED, NT_SUBSIDIES, NF_NORMAL, reftype.first, s->src, reftype.second, s->dst); AddNewsItem(STR_NEWS_SERVICE_SUBSIDY_OFFERED, NT_SUBSIDIES, NewsStyle::Normal, {}, reftype.first, s->src, reftype.second, s->dst);
SetPartOfSubsidyFlag(s->src_type, s->src, POS_SRC); SetPartOfSubsidyFlag(s->src_type, s->src, POS_SRC);
SetPartOfSubsidyFlag(s->dst_type, s->dst, POS_DST); SetPartOfSubsidyFlag(s->dst_type, s->dst, POS_DST);
AI::BroadcastNewEvent(new ScriptEventSubsidyOffer(s->index)); AI::BroadcastNewEvent(new ScriptEventSubsidyOffer(s->index));
@ -488,13 +488,13 @@ static IntervalTimer<TimerGameEconomy> _economy_subsidies_monthly({TimerGameEcon
if (--s->remaining == 0) { if (--s->remaining == 0) {
if (!s->IsAwarded()) { if (!s->IsAwarded()) {
std::pair<NewsReferenceType, NewsReferenceType> reftype = SetupSubsidyDecodeParam(s, SubsidyDecodeParamType::NewsWithdrawn); std::pair<NewsReferenceType, NewsReferenceType> reftype = SetupSubsidyDecodeParam(s, SubsidyDecodeParamType::NewsWithdrawn);
AddNewsItem(STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED, NT_SUBSIDIES, NF_NORMAL, reftype.first, s->src, reftype.second, s->dst); AddNewsItem(STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED, NT_SUBSIDIES, NewsStyle::Normal, {}, reftype.first, s->src, reftype.second, s->dst);
AI::BroadcastNewEvent(new ScriptEventSubsidyOfferExpired(s->index)); AI::BroadcastNewEvent(new ScriptEventSubsidyOfferExpired(s->index));
Game::NewEvent(new ScriptEventSubsidyOfferExpired(s->index)); Game::NewEvent(new ScriptEventSubsidyOfferExpired(s->index));
} else { } else {
if (s->awarded == _local_company) { if (s->awarded == _local_company) {
std::pair<NewsReferenceType, NewsReferenceType> reftype = SetupSubsidyDecodeParam(s, SubsidyDecodeParamType::NewsWithdrawn); std::pair<NewsReferenceType, NewsReferenceType> reftype = SetupSubsidyDecodeParam(s, SubsidyDecodeParamType::NewsWithdrawn);
AddNewsItem(STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE, NT_SUBSIDIES, NF_NORMAL, reftype.first, s->src, reftype.second, s->dst); AddNewsItem(STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE, NT_SUBSIDIES, NewsStyle::Normal, {}, reftype.first, s->src, reftype.second, s->dst);
} }
AI::BroadcastNewEvent(new ScriptEventSubsidyExpired(s->index)); AI::BroadcastNewEvent(new ScriptEventSubsidyExpired(s->index));
Game::NewEvent(new ScriptEventSubsidyExpired(s->index)); Game::NewEvent(new ScriptEventSubsidyExpired(s->index));

View File

@ -3389,7 +3389,7 @@ static CommandCost TownActionRoadRebuild(Town *t, DoCommandFlag flags)
AddNewsItem( AddNewsItem(
TimerGameEconomy::UsingWallclockUnits() ? STR_NEWS_ROAD_REBUILDING_MINUTES : STR_NEWS_ROAD_REBUILDING_MONTHS, TimerGameEconomy::UsingWallclockUnits() ? STR_NEWS_ROAD_REBUILDING_MINUTES : STR_NEWS_ROAD_REBUILDING_MONTHS,
NT_GENERAL, NF_NORMAL, NR_TOWN, t->index, NR_NONE, UINT32_MAX); NT_GENERAL, NewsStyle::Normal, {}, NR_TOWN, t->index, NR_NONE, UINT32_MAX);
AI::BroadcastNewEvent(new ScriptEventRoadReconstruction((ScriptCompany::CompanyID)(Owner)_current_company, t->index)); AI::BroadcastNewEvent(new ScriptEventRoadReconstruction((ScriptCompany::CompanyID)(Owner)_current_company, t->index));
Game::NewEvent(new ScriptEventRoadReconstruction((ScriptCompany::CompanyID)(Owner)_current_company, t->index)); Game::NewEvent(new ScriptEventRoadReconstruction((ScriptCompany::CompanyID)(Owner)_current_company, t->index));
} }
@ -3544,7 +3544,7 @@ static CommandCost TownActionBuyRights(Town *t, DoCommandFlag flags)
SetDParam(1, TimerGameEconomy::UsingWallclockUnits() ? STR_NEWS_EXCLUSIVE_RIGHTS_DESCRIPTION_MINUTES : STR_NEWS_EXCLUSIVE_RIGHTS_DESCRIPTION_MONTHS); SetDParam(1, TimerGameEconomy::UsingWallclockUnits() ? STR_NEWS_EXCLUSIVE_RIGHTS_DESCRIPTION_MINUTES : STR_NEWS_EXCLUSIVE_RIGHTS_DESCRIPTION_MONTHS);
SetDParam(2, t->index); SetDParam(2, t->index);
SetDParamStr(3, cni->company_name); SetDParamStr(3, cni->company_name);
AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NT_GENERAL, NF_COMPANY, NR_TOWN, t->index, NR_NONE, UINT32_MAX, std::move(cni)); AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NT_GENERAL, NewsStyle::Company, {}, NR_TOWN, t->index, NR_NONE, UINT32_MAX, std::move(cni));
AI::BroadcastNewEvent(new ScriptEventExclusiveTransportRights((ScriptCompany::CompanyID)(Owner)_current_company, t->index)); AI::BroadcastNewEvent(new ScriptEventExclusiveTransportRights((ScriptCompany::CompanyID)(Owner)_current_company, t->index));
Game::NewEvent(new ScriptEventExclusiveTransportRights((ScriptCompany::CompanyID)(Owner)_current_company, t->index)); Game::NewEvent(new ScriptEventExclusiveTransportRights((ScriptCompany::CompanyID)(Owner)_current_company, t->index));
} }