(svn r9746) -Codechange [YAPF]: added DEBUGs level 0 if the current train order is OT_GOTO_WAYPOINT and waypoint is invalid or v->dest_tile is wrong
authorKUDr
Sun, 29 Apr 2007 10:14:42 +0000
changeset 6549 8fca195512a9
parent 6548 8a9ea9bb12b0
child 6550 8bdb954bba16
(svn r9746) -Codechange [YAPF]: added DEBUGs level 0 if the current train order is OT_GOTO_WAYPOINT and waypoint is invalid or v->dest_tile is wrong
src/yapf/yapf_destrail.hpp
--- a/src/yapf/yapf_destrail.hpp	Sun Apr 29 09:55:32 2007 +0000
+++ b/src/yapf/yapf_destrail.hpp	Sun Apr 29 10:14:42 2007 +0000
@@ -95,8 +95,16 @@
 
 			case OT_GOTO_WAYPOINT: {
 				Waypoint *wp = GetWaypoint(v->current_order.dest);
-				if (wp == NULL) break;
+				if (wp == NULL) {
+					/* Invalid waypoint in orders! */
+					DEBUG(yapf, 0, "Invalid waypoint in orders == 0x%04X (train %d, player %d)", v->current_order.dest, v->unitnumber, (PlayerID)v->owner);
+					break;
+				}
 				m_destTile = wp->xy;
+				if (m_destTile != v->dest_tile) {
+					/* Something is wrong with orders! */
+					DEBUG(yapf, 0, "Invalid v->dest_tile == 0x%04X (train %d, player %d)", v->dest_tile, v->unitnumber, (PlayerID)v->owner);
+				}
 				m_dest_station_id = INVALID_STATION;
 				m_destTrackdirs = TrackToTrackdirBits(AxisToTrack(GetWaypointAxis(wp->xy)));
 				break;