(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.
authorrubidium
Thu, 08 May 2008 22:53:49 +0000
changeset 10478 f7761642d9b6
parent 10477 84cf8bf8184e
child 10479 d1ab1e4b6cf8
(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.
src/economy.cpp
src/news_gui.cpp
src/news_type.h
--- a/src/economy.cpp	Thu May 08 21:09:21 2008 +0000
+++ b/src/economy.cpp	Thu May 08 22:53:49 2008 +0000
@@ -1142,14 +1142,14 @@
 
 		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 @@
 				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 @@
 			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
 			);
 
--- a/src/news_gui.cpp	Thu May 08 21:09:21 2008 +0000
+++ b/src/news_gui.cpp	Thu May 08 22:53:49 2008 +0000
@@ -209,11 +209,11 @@
 					} 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);
 							}
 						}
--- a/src/news_type.h	Thu May 08 21:09:21 2008 +0000
+++ b/src/news_type.h	Thu May 08 22:53:49 2008 +0000
@@ -48,10 +48,11 @@
 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);