@@ -924,10 +924,8 @@ STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE_WITH_
STR_NEWS_SHOW_VEHICLE_GROUP_TOOLTIP :{BLACK}Open the group window focused on the vehicle's group
STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO :{WHITE}{STATION} no longer accepts {STRING}
STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_OR_CARGO :{WHITE}{STATION} no longer accepts {STRING} or {STRING}
STR_NEWS_STATION_NOW_ACCEPTS_CARGO :{WHITE}{STATION} now accepts {STRING}
STR_NEWS_STATION_NOW_ACCEPTS_CARGO_AND_CARGO :{WHITE}{STATION} now accepts {STRING} and {STRING}
STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_LIST :{WHITE}{STATION} no longer accepts: {CARGO_LIST}
STR_NEWS_STATION_NOW_ACCEPTS_CARGO_LIST :{WHITE}{STATION} now accepts: {CARGO_LIST}
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
@@ -518,16 +518,16 @@ CargoTypes GetEmptyMask(const Station *s
}
/**
* Items contains the two cargo names that are to be accepted or rejected.
* msg is the string id of the message to display.
* Add news item for when a station changes which cargoes it accepts.
* @param st Station of cargo change.
* @param cargoes Bit mask of cargo types to list.
* @param reject True iff the station rejects the cargo types.
*/
static void ShowRejectOrAcceptNews(const Station *st, uint num_items, CargoID *cargo, StringID msg)
static void ShowRejectOrAcceptNews(const Station *st, CargoTypes cargoes, bool reject)
{
for (uint i = 0; i < num_items; i++) {
SetDParam(i + 1, CargoSpec::Get(cargo[i])->name);
SetDParam(0, st->index);
SetDParam(1, cargoes);
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);
@@ -651,41 +651,13 @@ void UpdateStationAcceptance(Station *st
/* show a message to report that the acceptance was changed? */
if (show_msg && st->owner == _local_company && st->IsInUse()) {
/* List of accept and reject strings for different number of
* cargo types */
static const StringID accept_msg[] = {
STR_NEWS_STATION_NOW_ACCEPTS_CARGO,
STR_NEWS_STATION_NOW_ACCEPTS_CARGO_AND_CARGO,
};
static const StringID reject_msg[] = {
STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO,
STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_OR_CARGO,
/* Array of accepted and rejected cargo types */
CargoID accepts[2] = { CT_INVALID, CT_INVALID };
CargoID rejects[2] = { CT_INVALID, CT_INVALID };
uint num_acc = 0;
uint num_rej = 0;
/* Test each cargo type to see if its acceptance has changed */
for (CargoID i = 0; i < NUM_CARGO; i++) {
if (HasBit(new_acc, i)) {
if (!HasBit(old_acc, i) && num_acc < lengthof(accepts)) {
/* New cargo is accepted */
accepts[num_acc++] = i;
} else {
if (HasBit(old_acc, i) && num_rej < lengthof(rejects)) {
/* Old cargo is no longer accepted */
rejects[num_rej++] = i;
/* Combine old and new masks to get changes */
CargoTypes accepts = new_acc & ~old_acc;
CargoTypes rejects = ~new_acc & old_acc;
/* Show news message if there are any changes */
if (num_acc > 0) ShowRejectOrAcceptNews(st, num_acc, accepts, accept_msg[num_acc - 1]);
if (num_rej > 0) ShowRejectOrAcceptNews(st, num_rej, rejects, reject_msg[num_rej - 1]);
if (accepts != 0) ShowRejectOrAcceptNews(st, accepts, false);
if (rejects != 0) ShowRejectOrAcceptNews(st, rejects, true);
/* redraw the station view since acceptance changed */
Status change: