(svn r7649) [cbh] - Fix: [YAPF] assert on cbh custombridgeheads
authorKUDr
Sat, 30 Dec 2006 17:06:34 +0000
branchcustombridgeheads
changeset 5604 729d54e97b94
parent 5603 f3aa14b91b0a
child 5605 3864438e7cb2
(svn r7649) [cbh] - Fix: [YAPF] assert on cbh
openttd_vs80.vcproj
yapf/follow_track.hpp
--- a/openttd_vs80.vcproj	Sat Dec 30 13:15:15 2006 +0000
+++ b/openttd_vs80.vcproj	Sat Dec 30 17:06:34 2006 +0000
@@ -16,7 +16,7 @@
 	</Platforms>
 	<ToolFiles>
 		<ToolFile
-			RelativePath="masm64.rules"
+			RelativePath=".\masm64.rules"
 		/>
 	</ToolFiles>
 	<Configurations>
@@ -729,6 +729,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\oldpool.c"
+				>
+			</File>
+			<File
 				RelativePath=".\openttd.c"
 				>
 			</File>
@@ -749,10 +753,6 @@
 				>
 			</File>
 			<File
-				RelativePath=".\oldpool.c"
-				>
-			</File>
-			<File
 				RelativePath=".\queue.c"
 				>
 			</File>
@@ -821,6 +821,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\tunnel_cmd.c"
+				>
+			</File>
+			<File
 				RelativePath=".\vehicle.c"
 				>
 			</File>
@@ -1124,6 +1128,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\oldpool.h"
+				>
+			</File>
+			<File
 				RelativePath=".\openttd.h"
 				>
 			</File>
@@ -1136,10 +1144,6 @@
 				>
 			</File>
 			<File
-				RelativePath=".\oldpool.h"
-				>
-			</File>
-			<File
 				RelativePath=".\queue.h"
 				>
 			</File>
@@ -1396,6 +1400,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\bridge_cmd.c"
+				>
+			</File>
+			<File
 				RelativePath=".\clear_cmd.c"
 				>
 			</File>
@@ -1452,10 +1460,6 @@
 				>
 			</File>
 			<File
-				RelativePath=".\tunnelbridge_cmd.c"
-				>
-			</File>
-			<File
 				RelativePath=".\unmovable_cmd.c"
 				>
 			</File>
--- a/yapf/follow_track.hpp	Sat Dec 30 13:15:15 2006 +0000
+++ b/yapf/follow_track.hpp	Sat Dec 30 17:06:34 2006 +0000
@@ -49,11 +49,12 @@
 		if (!CanExitOldTile()) return false;
 		FollowTileExit();
 		if (!QueryNewTileTrackStatus()) return TryReverse();
-		if (!CanEnterNewTile()) return false;
 		m_new_td_bits &= DiagdirReachesTrackdirs(m_exitdir);
 		if (!Allow90degTurns())
 			m_new_td_bits &= (TrackdirBits)~(int)TrackdirCrossesTrackdirs(m_old_td);
-		return (m_new_td_bits != TRACKDIR_BIT_NONE);
+		if (m_new_td_bits == TRACKDIR_BIT_NONE) return false;
+		if (!CanEnterNewTile()) return false;
+		return true;
 	}
 
 protected:
@@ -77,18 +78,17 @@
 			assert(ReverseDiagDir(tunnel_enterdir) == m_exitdir);
 		}
 
-		// extra handling for bridge ramp in our direction
+		// extra handling when leaving bridge ramp and entering the bridge
 		if (IsBridgeTile(m_old_tile)) {
 			DiagDirection bridge_enterdir = GetBridgeRampDirection(m_old_tile);
 			if (bridge_enterdir == m_exitdir) {
-				// we are entering the bridge ramp
+				// we are entering the bridge
 				m_new_tile = GetOtherBridgeEnd(m_old_tile);
 				uint32 bridge_length = GetBridgeLength(m_old_tile, m_new_tile);
 				m_tiles_skipped = bridge_length;
 				m_is_bridge = true;
 				return;
 			}
-			assert(ReverseDiagDir(bridge_enterdir) == m_exitdir);
 		}
 
 		// normal or station tile, do one step