summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-08 22:53:49 +0000
committerrubidium <rubidium@openttd.org>2008-05-08 22:53:49 +0000
commit2ba05f898759269ba72b2ffd73aed7268e0ff56e (patch)
treeb20a6a2b3525e06f4c44ed37151eedb5444c74d4
parentbc514a7f51647e4428658294c8fbde908855fa8b (diff)
downloadopenttd-2ba05f898759269ba72b2ffd73aed7268e0ff56e.tar.xz
(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.
-rw-r--r--src/economy.cpp8
-rw-r--r--src/news_gui.cpp4
-rw-r--r--src/news_type.h3
3 files changed, 8 insertions, 7 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 908cde3fc..f8ed5d4e2 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1142,14 +1142,14 @@ static void SubsidyMonthlyHandler()
if (s->age == 12-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;
modified = true;
} else if (s->age == 2*12-1) {
st = GetStation(s->to);
if (st->owner == _local_player) {
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;
modified = true;
@@ -1188,7 +1188,7 @@ static void SubsidyMonthlyHandler()
if (!CheckSubsidyDuplicate(s)) {
s->age = 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;
break;
}
@@ -1405,7 +1405,7 @@ static bool CheckSubsidised(Station *from, Station *to, CargoID cargo_type)
SetDParam(0, _current_player);
AddNewsItem(
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
);
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 2b1bacb6a..cd0482539 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -209,11 +209,11 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
} else if (ni->flags & NF_TILE) {
if (_ctrl_pressed) {
ShowExtraViewPortWindow(ni->data_a);
- if (ni->data_b != 0) {
+ if (ni->flags & NF_TILE2) {
ShowExtraViewPortWindow(ni->data_b);
}
} else {
- if (!ScrollMainWindowToTile(ni->data_a) && ni->data_b != 0) {
+ if (!ScrollMainWindowToTile(ni->data_a) && ni->flags & NF_TILE2) {
ScrollMainWindowToTile(ni->data_b);
}
}
diff --git a/src/news_type.h b/src/news_type.h
index 8ed7f8335..aa220a83f 100644
--- a/src/news_type.h
+++ b/src/news_type.h
@@ -48,10 +48,11 @@ enum NewsMode {
enum NewsFlag {
NF_NONE = 0, ///< No flag is set.
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_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_TILE2 = (1 << 6), ///< There is a second tile to scroll to; tile is in data_b
};
DECLARE_ENUM_AS_BIT_SET(NewsFlag);