1
0
Fork 0

(svn r13021) -Codechange: free data_b for other uses when it is not used to store a second tile to skip to (in news messages). Patch by cirdan.

release/0.7
rubidium 2008-05-08 22:53:49 +00:00
parent bc514a7f51
commit 2ba05f8987
3 changed files with 8 additions and 7 deletions

View File

@ -1142,14 +1142,14 @@ static void SubsidyMonthlyHandler()
if (s->age == 12-1) { if (s->age == 12-1) {
pair = SetupSubsidyDecodeParam(s, 1); pair = SetupSubsidyDecodeParam(s, 1);
AddNewsItem(STR_202E_OFFER_OF_SUBSIDY_EXPIRED, NM_NORMAL, NF_TILE, NT_SUBSIDIES, DNC_NONE, pair.a, pair.b); AddNewsItem(STR_202E_OFFER_OF_SUBSIDY_EXPIRED, NM_NORMAL, NF_TILE | NF_TILE2, NT_SUBSIDIES, DNC_NONE, pair.a, pair.b);
s->cargo_type = CT_INVALID; s->cargo_type = CT_INVALID;
modified = true; modified = true;
} else if (s->age == 2*12-1) { } else if (s->age == 2*12-1) {
st = GetStation(s->to); st = GetStation(s->to);
if (st->owner == _local_player) { if (st->owner == _local_player) {
pair = SetupSubsidyDecodeParam(s, 1); pair = SetupSubsidyDecodeParam(s, 1);
AddNewsItem(STR_202F_SUBSIDY_WITHDRAWN_SERVICE, NM_NORMAL, NF_TILE, NT_SUBSIDIES, DNC_NONE, pair.a, pair.b); AddNewsItem(STR_202F_SUBSIDY_WITHDRAWN_SERVICE, NM_NORMAL, NF_TILE | NF_TILE2, NT_SUBSIDIES, DNC_NONE, pair.a, pair.b);
} }
s->cargo_type = CT_INVALID; s->cargo_type = CT_INVALID;
modified = true; modified = true;
@ -1188,7 +1188,7 @@ static void SubsidyMonthlyHandler()
if (!CheckSubsidyDuplicate(s)) { if (!CheckSubsidyDuplicate(s)) {
s->age = 0; s->age = 0;
pair = SetupSubsidyDecodeParam(s, 0); pair = SetupSubsidyDecodeParam(s, 0);
AddNewsItem(STR_2030_SERVICE_SUBSIDY_OFFERED, NM_NORMAL, NF_TILE, NT_SUBSIDIES, DNC_NONE, pair.a, pair.b); AddNewsItem(STR_2030_SERVICE_SUBSIDY_OFFERED, NM_NORMAL, NF_TILE | NF_TILE2, NT_SUBSIDIES, DNC_NONE, pair.a, pair.b);
modified = true; modified = true;
break; break;
} }
@ -1405,7 +1405,7 @@ static bool CheckSubsidised(Station *from, Station *to, CargoID cargo_type)
SetDParam(0, _current_player); SetDParam(0, _current_player);
AddNewsItem( AddNewsItem(
STR_2031_SERVICE_SUBSIDY_AWARDED + _opt.diff.subsidy_multiplier, STR_2031_SERVICE_SUBSIDY_AWARDED + _opt.diff.subsidy_multiplier,
NM_NORMAL, NF_TILE, NT_SUBSIDIES, DNC_NONE, NM_NORMAL, NF_TILE | NF_TILE2, NT_SUBSIDIES, DNC_NONE,
pair.a, pair.b pair.a, pair.b
); );

View File

@ -209,11 +209,11 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
} else if (ni->flags & NF_TILE) { } else if (ni->flags & NF_TILE) {
if (_ctrl_pressed) { if (_ctrl_pressed) {
ShowExtraViewPortWindow(ni->data_a); ShowExtraViewPortWindow(ni->data_a);
if (ni->data_b != 0) { if (ni->flags & NF_TILE2) {
ShowExtraViewPortWindow(ni->data_b); ShowExtraViewPortWindow(ni->data_b);
} }
} else { } else {
if (!ScrollMainWindowToTile(ni->data_a) && ni->data_b != 0) { if (!ScrollMainWindowToTile(ni->data_a) && ni->flags & NF_TILE2) {
ScrollMainWindowToTile(ni->data_b); ScrollMainWindowToTile(ni->data_b);
} }
} }

View File

@ -48,10 +48,11 @@ enum NewsMode {
enum NewsFlag { enum NewsFlag {
NF_NONE = 0, ///< No flag is set. NF_NONE = 0, ///< No flag is set.
NF_VIEWPORT = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening) NF_VIEWPORT = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening)
NF_TILE = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a/data_b NF_TILE = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a
NF_VEHICLE = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a NF_VEHICLE = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a
NF_FORCE_BIG = (1 << 4), ///< Force the appearance of a news message if it has already been shown (internal) NF_FORCE_BIG = (1 << 4), ///< Force the appearance of a news message if it has already been shown (internal)
NF_INCOLOR = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white NF_INCOLOR = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white
NF_TILE2 = (1 << 6), ///< There is a second tile to scroll to; tile is in data_b
}; };
DECLARE_ENUM_AS_BIT_SET(NewsFlag); DECLARE_ENUM_AS_BIT_SET(NewsFlag);