Feature: Configurable subsidy duration

pull/332/head
Tyler Trahan 3 years ago committed by Michael Lutz
parent c2db408d5d
commit d09210e1c6

@ -28,6 +28,7 @@ typedef uint8 Day; ///< Type for the day of the month, note: 1 based, first d
static const int DAY_TICKS = 74; ///< ticks per day static const int DAY_TICKS = 74; ///< ticks per day
static const int DAYS_IN_YEAR = 365; ///< days per year static const int DAYS_IN_YEAR = 365; ///< days per year
static const int DAYS_IN_LEAP_YEAR = 366; ///< sometimes, you need one day more... static const int DAYS_IN_LEAP_YEAR = 366; ///< sometimes, you need one day more...
static const int MONTHS_IN_YEAR = 12; ///< months per year
static const int STATION_RATING_TICKS = 185; ///< cycle duration for updating station rating static const int STATION_RATING_TICKS = 185; ///< cycle duration for updating station rating
static const int STATION_ACCEPTANCE_TICKS = 250; ///< cycle duration for updating station acceptance static const int STATION_ACCEPTANCE_TICKS = 250; ///< cycle duration for updating station acceptance

@ -883,11 +883,11 @@ STR_NEWS_STATION_NOW_ACCEPTS_CARGO_AND_CARGO :{WHITE}{STATION
STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}Offer of subsidy expired:{}{}{STRING} from {STRING2} to {STRING2} will now not attract a subsidy STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}Offer of subsidy expired:{}{}{STRING} from {STRING2} to {STRING2} will now not attract a subsidy
STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE :{BIG_FONT}{BLACK}Subsidy withdrawn:{}{}{STRING} service from {STRING2} to {STRING2} is no longer subsidised STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE :{BIG_FONT}{BLACK}Subsidy withdrawn:{}{}{STRING} service from {STRING2} to {STRING2} is no longer subsidised
STR_NEWS_SERVICE_SUBSIDY_OFFERED :{BIG_FONT}{BLACK}Service subsidy offered:{}{}First {STRING} service from {STRING2} to {STRING2} will attract a year's subsidy from the local authority! STR_NEWS_SERVICE_SUBSIDY_OFFERED :{BIG_FONT}{BLACK}Service subsidy offered:{}{}First {STRING} service from {STRING2} to {STRING2} will attract a {NUM} year subsidy from the local authority!
STR_NEWS_SERVICE_SUBSIDY_AWARDED_HALF :{BIG_FONT}{BLACK}Service subsidy awarded to {RAW_STRING}!{}{}{STRING} service from {STRING2} to {STRING2} will pay 50% extra for the next year! STR_NEWS_SERVICE_SUBSIDY_AWARDED_HALF :{BIG_FONT}{BLACK}Service subsidy awarded to {RAW_STRING}!{}{}{STRING} service from {STRING2} to {STRING2} will pay 50% extra for the next {NUM} year{P "" s}!
STR_NEWS_SERVICE_SUBSIDY_AWARDED_DOUBLE :{BIG_FONT}{BLACK}Service subsidy awarded to {RAW_STRING}!{}{}{STRING} service from {STRING2} to {STRING2} will pay double rates for the next year! STR_NEWS_SERVICE_SUBSIDY_AWARDED_DOUBLE :{BIG_FONT}{BLACK}Service subsidy awarded to {RAW_STRING}!{}{}{STRING} service from {STRING2} to {STRING2} will pay double rates for the next {NUM} year{P "" s}!
STR_NEWS_SERVICE_SUBSIDY_AWARDED_TRIPLE :{BIG_FONT}{BLACK}Service subsidy awarded to {RAW_STRING}!{}{}{STRING} service from {STRING2} to {STRING2} will pay triple rates for the next year! STR_NEWS_SERVICE_SUBSIDY_AWARDED_TRIPLE :{BIG_FONT}{BLACK}Service subsidy awarded to {RAW_STRING}!{}{}{STRING} service from {STRING2} to {STRING2} will pay triple rates for the next {NUM} year{P "" s}!
STR_NEWS_SERVICE_SUBSIDY_AWARDED_QUADRUPLE :{BIG_FONT}{BLACK}Service subsidy awarded to {RAW_STRING}!{}{}{STRING} service from {STRING2} to {STRING2} will pay quadruple rates for the next year! STR_NEWS_SERVICE_SUBSIDY_AWARDED_QUADRUPLE :{BIG_FONT}{BLACK}Service subsidy awarded to {RAW_STRING}!{}{}{STRING} service from {STRING2} to {STRING2} will pay quadruple rates for the next {NUM} year{P "" s}!
STR_NEWS_ROAD_REBUILDING :{BIG_FONT}{BLACK}Traffic chaos in {TOWN}!{}{}Road rebuilding programme funded by {RAW_STRING} brings 6 months of misery to motorists! STR_NEWS_ROAD_REBUILDING :{BIG_FONT}{BLACK}Traffic chaos in {TOWN}!{}{}Road rebuilding programme funded by {RAW_STRING} brings 6 months of misery to motorists!
STR_NEWS_EXCLUSIVE_RIGHTS_TITLE :{BIG_FONT}{BLACK}Transport monopoly! STR_NEWS_EXCLUSIVE_RIGHTS_TITLE :{BIG_FONT}{BLACK}Transport monopoly!
@ -1203,6 +1203,10 @@ STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS :Vehicle breakdo
STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS_HELPTEXT :Control how often inadequately serviced vehicles may break down STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS_HELPTEXT :Control how often inadequately serviced vehicles may break down
STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER :Subsidy multiplier: {STRING2} STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER :Subsidy multiplier: {STRING2}
STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER_HELPTEXT :Set how much is paid for subsidised connections STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER_HELPTEXT :Set how much is paid for subsidised connections
STR_CONFIG_SETTING_SUBSIDY_DURATION :Subsidy duration: {STRING2}
STR_CONFIG_SETTING_SUBSIDY_DURATION_HELPTEXT :Set the number of years for which a subsidy is awarded
STR_CONFIG_SETTING_SUBSIDY_DURATION_VALUE :{NUM} year{P "" s}
STR_CONFIG_SETTING_SUBSIDY_DURATION_DISABLED :No subsidies
STR_CONFIG_SETTING_CONSTRUCTION_COSTS :Construction costs: {STRING2} STR_CONFIG_SETTING_CONSTRUCTION_COSTS :Construction costs: {STRING2}
STR_CONFIG_SETTING_CONSTRUCTION_COSTS_HELPTEXT :Set level of construction and purchase costs STR_CONFIG_SETTING_CONSTRUCTION_COSTS_HELPTEXT :Set level of construction and purchase costs
STR_CONFIG_SETTING_RECESSIONS :Recessions: {STRING2} STR_CONFIG_SETTING_RECESSIONS :Recessions: {STRING2}

@ -328,6 +328,7 @@ enum SaveLoadVersion : uint16 {
SLV_INDUSTRY_TEXT, ///< 289 PR#8576 v1.11.0-RC1 Additional GS text for industries. SLV_INDUSTRY_TEXT, ///< 289 PR#8576 v1.11.0-RC1 Additional GS text for industries.
SLV_MAPGEN_SETTINGS_REVAMP, ///< 290 PR#8891 v1.11 Revamp of some mapgen settings (snow coverage, desert coverage, heightmap height, custom terrain type). SLV_MAPGEN_SETTINGS_REVAMP, ///< 290 PR#8891 v1.11 Revamp of some mapgen settings (snow coverage, desert coverage, heightmap height, custom terrain type).
SLV_GROUP_REPLACE_WAGON_REMOVAL, ///< 291 PR#7441 Per-group wagon removal flag. SLV_GROUP_REPLACE_WAGON_REMOVAL, ///< 291 PR#7441 Per-group wagon removal flag.
SLV_CUSTOM_SUBSIDY_DURATION, ///< 292 PR#9081 Configurable subsidy duration.
SL_MAX_VERSION, ///< Highest possible saveload version SL_MAX_VERSION, ///< Highest possible saveload version
}; };

@ -16,14 +16,15 @@
static const SaveLoad _subsidies_desc[] = { static const SaveLoad _subsidies_desc[] = {
SLE_VAR(Subsidy, cargo_type, SLE_UINT8), SLE_VAR(Subsidy, cargo_type, SLE_UINT8),
SLE_VAR(Subsidy, remaining, SLE_UINT8), SLE_CONDVAR(Subsidy, remaining, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_CUSTOM_SUBSIDY_DURATION),
SLE_CONDVAR(Subsidy, awarded, SLE_UINT8, SLV_125, SL_MAX_VERSION), SLE_CONDVAR(Subsidy, remaining, SLE_UINT16, SLV_CUSTOM_SUBSIDY_DURATION, SL_MAX_VERSION),
SLE_CONDVAR(Subsidy, src_type, SLE_UINT8, SLV_125, SL_MAX_VERSION), SLE_CONDVAR(Subsidy, awarded, SLE_UINT8, SLV_125, SL_MAX_VERSION),
SLE_CONDVAR(Subsidy, dst_type, SLE_UINT8, SLV_125, SL_MAX_VERSION), SLE_CONDVAR(Subsidy, src_type, SLE_UINT8, SLV_125, SL_MAX_VERSION),
SLE_CONDVAR(Subsidy, src, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_5), SLE_CONDVAR(Subsidy, dst_type, SLE_UINT8, SLV_125, SL_MAX_VERSION),
SLE_CONDVAR(Subsidy, src, SLE_UINT16, SLV_5, SL_MAX_VERSION), SLE_CONDVAR(Subsidy, src, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_5),
SLE_CONDVAR(Subsidy, dst, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_5), SLE_CONDVAR(Subsidy, src, SLE_UINT16, SLV_5, SL_MAX_VERSION),
SLE_CONDVAR(Subsidy, dst, SLE_UINT16, SLV_5, SL_MAX_VERSION), SLE_CONDVAR(Subsidy, dst, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_5),
SLE_CONDVAR(Subsidy, dst, SLE_UINT16, SLV_5, SL_MAX_VERSION),
}; };
static void Save_SUBS() static void Save_SUBS()

@ -1691,6 +1691,7 @@ static SettingsContainer &GetSettingsTree()
accounting->Add(new SettingEntry("difficulty.initial_interest")); accounting->Add(new SettingEntry("difficulty.initial_interest"));
accounting->Add(new SettingEntry("difficulty.max_loan")); accounting->Add(new SettingEntry("difficulty.max_loan"));
accounting->Add(new SettingEntry("difficulty.subsidy_multiplier")); accounting->Add(new SettingEntry("difficulty.subsidy_multiplier"));
accounting->Add(new SettingEntry("difficulty.subsidy_duration"));
accounting->Add(new SettingEntry("economy.feeder_payment_share")); accounting->Add(new SettingEntry("economy.feeder_payment_share"));
accounting->Add(new SettingEntry("economy.infrastructure_maintenance")); accounting->Add(new SettingEntry("economy.infrastructure_maintenance"));
accounting->Add(new SettingEntry("difficulty.vehicle_costs")); accounting->Add(new SettingEntry("difficulty.vehicle_costs"));

@ -72,7 +72,8 @@ struct DifficultySettings {
byte vehicle_costs; ///< amount of money spent on vehicle running cost byte vehicle_costs; ///< amount of money spent on vehicle running cost
byte competitor_speed; ///< the speed at which the AI builds byte competitor_speed; ///< the speed at which the AI builds
byte vehicle_breakdowns; ///< likelihood of vehicles breaking down byte vehicle_breakdowns; ///< likelihood of vehicles breaking down
byte subsidy_multiplier; ///< amount of subsidy byte subsidy_multiplier; ///< payment multiplier for subsidized deliveries
uint16 subsidy_duration; ///< duration of subsidies
byte construction_cost; ///< how expensive is building byte construction_cost; ///< how expensive is building
byte terrain_type; ///< the mountainousness of the landscape byte terrain_type; ///< the mountainousness of the landscape
byte quantity_sea_lakes; ///< the amount of seas/lakes byte quantity_sea_lakes; ///< the amount of seas/lakes

@ -41,7 +41,7 @@ void Subsidy::AwardTo(CompanyID company)
assert(!this->IsAwarded()); assert(!this->IsAwarded());
this->awarded = company; this->awarded = company;
this->remaining = SUBSIDY_CONTRACT_MONTHS; this->remaining = _settings_game.difficulty.subsidy_duration * MONTHS_IN_YEAR;
char company_name[MAX_LENGTH_COMPANY_NAME_CHARS * MAX_CHAR_LENGTH]; char company_name[MAX_LENGTH_COMPANY_NAME_CHARS * MAX_CHAR_LENGTH];
SetDParam(0, company); SetDParam(0, company);
@ -50,7 +50,7 @@ void Subsidy::AwardTo(CompanyID company)
char *cn = stredup(company_name); char *cn = stredup(company_name);
/* Add a news item */ /* Add a news item */
std::pair<NewsReferenceType, NewsReferenceType> reftype = SetupSubsidyDecodeParam(this, false); std::pair<NewsReferenceType, NewsReferenceType> reftype = SetupSubsidyDecodeParam(this, SubsidyDecodeParamType::NewsAwarded);
InjectDParam(1); InjectDParam(1);
SetDParamStr(0, cn); SetDParamStr(0, cn);
@ -69,17 +69,21 @@ void Subsidy::AwardTo(CompanyID company)
/** /**
* Setup the string parameters for printing the subsidy at the screen, and compute the news reference for the subsidy. * Setup the string parameters for printing the subsidy at the screen, and compute the news reference for the subsidy.
* @param s %Subsidy being printed. * @param s %Subsidy being printed.
* @param mode Unit of cargo used, \c true means general name, \c false means singular form. * @param mode Type of subsidy news message to decide on parameter format.
* @return Reference of the subsidy in the news system. * @return Reference of the subsidy in the news system.
*/ */
std::pair<NewsReferenceType, NewsReferenceType> SetupSubsidyDecodeParam(const Subsidy *s, bool mode) std::pair<NewsReferenceType, NewsReferenceType> SetupSubsidyDecodeParam(const Subsidy *s, SubsidyDecodeParamType mode)
{ {
NewsReferenceType reftype1 = NR_NONE; NewsReferenceType reftype1 = NR_NONE;
NewsReferenceType reftype2 = NR_NONE; NewsReferenceType reftype2 = NR_NONE;
/* if mode is false, use the singular form */ /* Choose whether to use the singular or plural form of the cargo name based on how we're printing the subsidy */
const CargoSpec *cs = CargoSpec::Get(s->cargo_type); const CargoSpec *cs = CargoSpec::Get(s->cargo_type);
SetDParam(0, mode ? cs->name : cs->name_single); if (mode == SubsidyDecodeParamType::Gui || mode == SubsidyDecodeParamType::NewsWithdrawn) {
SetDParam(0, cs->name);
} else {
SetDParam(0, cs->name_single);
}
switch (s->src_type) { switch (s->src_type) {
case ST_INDUSTRY: case ST_INDUSTRY:
@ -107,6 +111,11 @@ std::pair<NewsReferenceType, NewsReferenceType> SetupSubsidyDecodeParam(const Su
} }
SetDParam(5, s->dst); SetDParam(5, s->dst);
/* If the subsidy is being offered or awarded, the news item mentions the subsidy duration. */
if (mode == SubsidyDecodeParamType::NewsOffered || mode == SubsidyDecodeParamType::NewsAwarded) {
SetDParam(7, _settings_game.difficulty.subsidy_duration);
}
return std::pair<NewsReferenceType, NewsReferenceType>(reftype1, reftype2); return std::pair<NewsReferenceType, NewsReferenceType>(reftype1, reftype2);
} }
@ -216,7 +225,7 @@ void CreateSubsidy(CargoID cid, SourceType src_type, SourceID src, SourceType ds
s->remaining = SUBSIDY_OFFER_MONTHS; s->remaining = SUBSIDY_OFFER_MONTHS;
s->awarded = INVALID_COMPANY; s->awarded = INVALID_COMPANY;
std::pair<NewsReferenceType, NewsReferenceType> reftype = SetupSubsidyDecodeParam(s, false); 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, NF_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);
@ -491,13 +500,13 @@ void SubsidyMonthlyLoop()
for (Subsidy *s : Subsidy::Iterate()) { for (Subsidy *s : Subsidy::Iterate()) {
if (--s->remaining == 0) { if (--s->remaining == 0) {
if (!s->IsAwarded()) { if (!s->IsAwarded()) {
std::pair<NewsReferenceType, NewsReferenceType> reftype = SetupSubsidyDecodeParam(s, true); 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, NF_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, true); 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, NF_NORMAL, reftype.first, s->src, reftype.second, s->dst);
} }
AI::BroadcastNewEvent(new ScriptEventSubsidyExpired(s->index)); AI::BroadcastNewEvent(new ScriptEventSubsidyExpired(s->index));
@ -510,6 +519,9 @@ void SubsidyMonthlyLoop()
if (modified) { if (modified) {
RebuildSubsidisedSourceAndDestinationCache(); RebuildSubsidisedSourceAndDestinationCache();
} else if (_settings_game.difficulty.subsidy_duration == 0) {
/* If subsidy duration is set to 0, subsidies are disabled, so bail out. */
return;
} else if (_settings_game.linkgraph.distribution_pax != DT_MANUAL && } else if (_settings_game.linkgraph.distribution_pax != DT_MANUAL &&
_settings_game.linkgraph.distribution_mail != DT_MANUAL && _settings_game.linkgraph.distribution_mail != DT_MANUAL &&
_settings_game.linkgraph.distribution_armoured != DT_MANUAL && _settings_game.linkgraph.distribution_armoured != DT_MANUAL &&

@ -21,7 +21,7 @@ extern SubsidyPool _subsidy_pool;
/** Struct about subsidies, offered and awarded */ /** Struct about subsidies, offered and awarded */
struct Subsidy : SubsidyPool::PoolItem<&_subsidy_pool> { struct Subsidy : SubsidyPool::PoolItem<&_subsidy_pool> {
CargoID cargo_type; ///< Cargo type involved in this subsidy, CT_INVALID for invalid subsidy CargoID cargo_type; ///< Cargo type involved in this subsidy, CT_INVALID for invalid subsidy
byte remaining; ///< Remaining months when this subsidy is valid uint16 remaining; ///< Remaining months when this subsidy is valid
CompanyID awarded; ///< Subsidy is awarded to this company; INVALID_COMPANY if it's not awarded to anyone CompanyID awarded; ///< Subsidy is awarded to this company; INVALID_COMPANY if it's not awarded to anyone
SourceType src_type; ///< Source of subsidised path (ST_INDUSTRY or ST_TOWN) SourceType src_type; ///< Source of subsidised path (ST_INDUSTRY or ST_TOWN)
SourceType dst_type; ///< Destination of subsidised path (ST_INDUSTRY or ST_TOWN) SourceType dst_type; ///< Destination of subsidised path (ST_INDUSTRY or ST_TOWN)
@ -52,11 +52,18 @@ struct Subsidy : SubsidyPool::PoolItem<&_subsidy_pool> {
/** Constants related to subsidies */ /** Constants related to subsidies */
static const uint SUBSIDY_OFFER_MONTHS = 12; ///< Duration of subsidy offer static const uint SUBSIDY_OFFER_MONTHS = 12; ///< Duration of subsidy offer
static const uint SUBSIDY_CONTRACT_MONTHS = 12; ///< Duration of subsidy after awarding
static const uint SUBSIDY_PAX_MIN_POPULATION = 400; ///< Min. population of towns for subsidised pax route static const uint SUBSIDY_PAX_MIN_POPULATION = 400; ///< Min. population of towns for subsidised pax route
static const uint SUBSIDY_CARGO_MIN_POPULATION = 900; ///< Min. population of destination town for cargo route static const uint SUBSIDY_CARGO_MIN_POPULATION = 900; ///< Min. population of destination town for cargo route
static const uint SUBSIDY_MAX_PCT_TRANSPORTED = 42; ///< Subsidy will be created only for towns/industries with less % transported static const uint SUBSIDY_MAX_PCT_TRANSPORTED = 42; ///< Subsidy will be created only for towns/industries with less % transported
static const uint SUBSIDY_MAX_DISTANCE = 70; ///< Max. length of subsidised route (DistanceManhattan) static const uint SUBSIDY_MAX_DISTANCE = 70; ///< Max. length of subsidised route (DistanceManhattan)
static const uint SUBSIDY_TOWN_CARGO_RADIUS = 6; ///< Extent of a tile area around town center when scanning for town cargo acceptance and production (6 ~= min catchmement + min station / 2) static const uint SUBSIDY_TOWN_CARGO_RADIUS = 6; ///< Extent of a tile area around town center when scanning for town cargo acceptance and production (6 ~= min catchmement + min station / 2)
/** Types of subsidy news messages, which determine how the date is printed and whether to use singular or plural cargo names */
enum class SubsidyDecodeParamType {
NewsOffered = 0, ///< News item for an offered subsidy
NewsAwarded = 1, ///< News item for an awarded subsidy
NewsWithdrawn = 2, ///< News item for a subsidy offer withdrawn, or expired subsidy
Gui = 3, ///< Subsidies listed in the Subsidy GUI
};
#endif /* SUBSIDY_BASE_H */ #endif /* SUBSIDY_BASE_H */

@ -15,8 +15,9 @@
#include "company_type.h" #include "company_type.h"
#include "cargo_type.h" #include "cargo_type.h"
#include "news_type.h" #include "news_type.h"
#include "subsidy_base.h"
std::pair<NewsReferenceType, NewsReferenceType> SetupSubsidyDecodeParam(const struct Subsidy *s, bool mode); std::pair<NewsReferenceType, NewsReferenceType> SetupSubsidyDecodeParam(const struct Subsidy *s, SubsidyDecodeParamType mode);
void DeleteSubsidyWith(SourceType type, SourceID index); void DeleteSubsidyWith(SourceType type, SourceID index);
bool CheckSubsidised(CargoID cargo_type, CompanyID company, SourceType src_type, SourceID src, const Station *st); bool CheckSubsidised(CargoID cargo_type, CompanyID company, SourceType src_type, SourceID src, const Station *st);
void RebuildSubsidisedSourceAndDestinationCache(); void RebuildSubsidisedSourceAndDestinationCache();

@ -161,7 +161,7 @@ struct SubsidyListWindow : Window {
if (!s->IsAwarded()) { if (!s->IsAwarded()) {
if (IsInsideMM(pos, 0, cap)) { if (IsInsideMM(pos, 0, cap)) {
/* Displays the two offered towns */ /* Displays the two offered towns */
SetupSubsidyDecodeParam(s, true); SetupSubsidyDecodeParam(s, SubsidyDecodeParamType::Gui);
SetDParam(7, _date - ymd.day + s->remaining * 32); SetDParam(7, _date - ymd.day + s->remaining * 32);
DrawString(x, right, y + pos * FONT_HEIGHT_NORMAL, STR_SUBSIDIES_OFFERED_FROM_TO); DrawString(x, right, y + pos * FONT_HEIGHT_NORMAL, STR_SUBSIDIES_OFFERED_FROM_TO);
} }
@ -184,7 +184,7 @@ struct SubsidyListWindow : Window {
for (const Subsidy *s : Subsidy::Iterate()) { for (const Subsidy *s : Subsidy::Iterate()) {
if (s->IsAwarded()) { if (s->IsAwarded()) {
if (IsInsideMM(pos, 0, cap)) { if (IsInsideMM(pos, 0, cap)) {
SetupSubsidyDecodeParam(s, true); SetupSubsidyDecodeParam(s, SubsidyDecodeParamType::Gui);
SetDParam(7, s->awarded); SetDParam(7, s->awarded);
SetDParam(8, _date - ymd.day + s->remaining * 32); SetDParam(8, _date - ymd.day + s->remaining * 32);

@ -231,6 +231,19 @@ str = STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER
strhelp = STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER_HELPTEXT strhelp = STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER_HELPTEXT
strval = STR_SUBSIDY_X1_5 strval = STR_SUBSIDY_X1_5
[SDT_VAR]
var = difficulty.subsidy_duration
type = SLE_UINT16
from = SLV_CUSTOM_SUBSIDY_DURATION
flags = SF_GUI_0_IS_SPECIAL
def = 1
min = 0
max = 5000
interval = 1
str = STR_CONFIG_SETTING_SUBSIDY_DURATION
strhelp = STR_CONFIG_SETTING_SUBSIDY_DURATION_HELPTEXT
strval = STR_CONFIG_SETTING_SUBSIDY_DURATION_VALUE
[SDT_VAR] [SDT_VAR]
var = difficulty.construction_cost var = difficulty.construction_cost
type = SLE_UINT8 type = SLE_UINT8

Loading…
Cancel
Save