diff src/tunnelbridge_cmd.cpp @ 7857:707c26c48f4e draft

(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
author truelight <truelight@openttd.org>
date Sun, 11 Nov 2007 12:34:44 +0000
parents e6ee8bfd9045
children 504d4b2ecc6c
line wrap: on
line diff
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -213,7 +213,7 @@
 	if (HASBIT(p2, 15)) {
 		railtype = INVALID_RAILTYPE; // road bridge
 		roadtypes = (RoadTypes)GB(p2, 8, 3);
-		if (!AreValidRoadTypes(roadtypes)) return CMD_ERROR;
+		if (!AreValidRoadTypes(roadtypes) || !HasRoadTypesAvail(_current_player, roadtypes)) return CMD_ERROR;
 	} else {
 		if (!ValParamRailtype(GB(p2, 8, 8))) return CMD_ERROR;
 		railtype = (RailType)GB(p2, 8, 8);
@@ -464,8 +464,9 @@
 	_build_tunnel_endtile = 0;
 	if (!HASBIT(p1, 9)) {
 		if (!ValParamRailtype(p1)) return CMD_ERROR;
-	} else if (!AreValidRoadTypes((RoadTypes)GB(p1, 0, 3))) {
-		return CMD_ERROR;
+	} else {
+		const RoadTypes rts = (RoadTypes)GB(p1, 0, 3);
+		if (!AreValidRoadTypes(rts) || !HasRoadTypesAvail(_current_player, rts)) return CMD_ERROR;
 	}
 
 	start_tileh = GetTileSlope(start_tile, &start_z);