(svn r10522) -Fix: the "build truck station" GUI showed that it would accept tourists when it does not, whereas the "build bus station" GUI did not show them when it did accept them.
authorrubidium
Thu, 12 Jul 2007 13:40:24 +0000
changeset 7737 7ab95e599292
parent 7736 1119c5e38774
child 7738 2667e9a4e75e
(svn r10522) -Fix: the "build truck station" GUI showed that it would accept tourists when it does not, whereas the "build bus station" GUI did not show them when it did accept them.
src/airport_gui.cpp
src/dock_gui.cpp
src/gui.h
src/misc_gui.cpp
src/rail_gui.cpp
src/road_gui.cpp
--- a/src/airport_gui.cpp	Thu Jul 12 13:25:06 2007 +0000
+++ b/src/airport_gui.cpp	Thu Jul 12 13:40:24 2007 +0000
@@ -183,7 +183,7 @@
 		DrawWindowWidgets(w);
 		// strings such as 'Size' and 'Coverage Area'
 		// 'Coverage Area'
-		DrawStationCoverageAreaText(2, 206, (uint)-1, rad);
+		DrawStationCoverageAreaText(2, 206, SCT_ALL, rad);
 		break;
 	}
 
--- a/src/dock_gui.cpp	Thu Jul 12 13:25:06 2007 +0000
+++ b/src/dock_gui.cpp	Thu Jul 12 13:40:24 2007 +0000
@@ -250,7 +250,7 @@
 			SetTileSelectSize(1, 1);
 		}
 
-		DrawStationCoverageAreaText(4, 50, (uint)-1, rad);
+		DrawStationCoverageAreaText(4, 50, SCT_ALL, rad);
 		break;
 	}
 
--- a/src/gui.h	Thu Jul 12 13:25:06 2007 +0000
+++ b/src/gui.h	Thu Jul 12 13:40:24 2007 +0000
@@ -108,7 +108,13 @@
 void ShowEstimatedCostOrIncome(Money cost, int x, int y);
 void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y);
 
-void DrawStationCoverageAreaText(int sx, int sy, uint mask,int rad);
+enum StationCoverageType {
+	SCT_PASSENGERS_ONLY,
+	SCT_NON_PASSENGERS_ONLY,
+	SCT_ALL
+};
+
+void DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad);
 void CheckRedrawStationCoverage(const Window *w);
 
 void ShowSmallMap();
--- a/src/misc_gui.cpp	Thu Jul 12 13:25:06 2007 +0000
+++ b/src/misc_gui.cpp	Thu Jul 12 13:40:24 2007 +0000
@@ -751,16 +751,22 @@
 
 
 static void DrawStationCoverageText(const AcceptedCargo accepts,
-	int str_x, int str_y, uint mask)
+	int str_x, int str_y, StationCoverageType sct)
 {
 	char *b = _userstring;
 	bool first = true;
 
 	b = InlineString(b, STR_000D_ACCEPTS);
 
-	for (CargoID i = 0; i < NUM_CARGO; i++, mask >>= 1) {
+	for (CargoID i = 0; i < NUM_CARGO; i++) {
 		if (b >= lastof(_userstring) - 5) break;
-		if (accepts[i] >= 8 && mask & 1) {
+		switch (sct) {
+			case SCT_PASSENGERS_ONLY: if (!IsCargoInClass(i, CC_PASSENGERS)) continue; break;
+			case SCT_NON_PASSENGERS_ONLY: if (IsCargoInClass(i, CC_PASSENGERS)) continue; break;
+			case SCT_ALL: break;
+			default: NOT_REACHED();
+		}
+		if (accepts[i] >= 8) {
 			if (first) {
 				first = false;
 			} else {
@@ -779,12 +785,12 @@
 	DrawStringMultiLine(str_x, str_y, STR_SPEC_USERSTRING, 144);
 }
 
-void DrawStationCoverageAreaText(int sx, int sy, uint mask, int rad) {
+void DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad) {
 	TileIndex tile = TileVirtXY(_thd.pos.x, _thd.pos.y);
 	AcceptedCargo accepts;
 	if (tile < MapSize()) {
 		GetAcceptanceAroundTiles(accepts, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad);
-		DrawStationCoverageText(accepts, sx, sy, mask);
+		DrawStationCoverageText(accepts, sx, sy, sct);
 	}
 }
 
--- a/src/rail_gui.cpp	Thu Jul 12 13:25:06 2007 +0000
+++ b/src/rail_gui.cpp	Thu Jul 12 13:40:24 2007 +0000
@@ -778,7 +778,7 @@
 		DrawStringCentered(74, 101 + y_offset, STR_3004_PLATFORM_LENGTH, 0);
 		DrawStringCentered(74, 141 + y_offset, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0);
 
-		DrawStationCoverageAreaText(2, 166 + y_offset, (uint)-1, rad);
+		DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad);
 
 		if (newstations) {
 			uint16 i;
--- a/src/road_gui.cpp	Thu Jul 12 13:25:06 2007 +0000
+++ b/src/road_gui.cpp	Thu Jul 12 13:40:24 2007 +0000
@@ -579,7 +579,7 @@
 		StationPickerDrawSprite(171, 85, RAILTYPE_BEGIN, _cur_roadtype, image + 1);
 
 		DrawStationCoverageAreaText(2, 146,
-			((w->window_class == WC_BUS_STATION) ? (1 << CT_PASSENGERS) : ~(1 << CT_PASSENGERS)),
+			(w->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY,
 			3);
 
 	} break;