Changeset - r23029:136b3d368340
[Not reviewed]
master
0 2 0
Charles Pigott - 6 years ago 2018-10-27 17:13:42
charlespigott@googlemail.com
Codechange: Some more null checks
2 files changed with 7 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/pathfinder/follow_track.hpp
Show inline comments
 
@@ -124,8 +124,12 @@ struct CFollowTrackT
 
		m_old_tile = old_tile;
 
		m_old_td = old_td;
 
		m_err = EC_NONE;
 
		assert(((TrackStatusToTrackdirBits(GetTileTrackStatus(m_old_tile, TT(), IsRoadTT() ? RoadVehicle::From(m_veh)->compatible_roadtypes : 0)) & TrackdirToTrackdirBits(m_old_td)) != 0) ||
 
		       (IsTram() && GetSingleTramBit(m_old_tile) != INVALID_DIAGDIR)); // Disable the assertion for single tram bits
 
		assert(
 
			((TrackStatusToTrackdirBits(
 
				GetTileTrackStatus(m_old_tile, TT(), (IsRoadTT() && m_veh != NULL) ? RoadVehicle::From(m_veh)->compatible_roadtypes : 0)
 
			) & TrackdirToTrackdirBits(m_old_td)) != 0) ||
 
			(IsTram() && GetSingleTramBit(m_old_tile) != INVALID_DIAGDIR) // Disable the assertion for single tram bits
 
		);
 
		m_exitdir = TrackdirToExitdir(m_old_td);
 
		if (ForcedReverse()) return true;
 
		if (!CanExitOldTile()) return false;
src/train_cmd.cpp
Show inline comments
 
@@ -874,7 +874,7 @@ static void RemoveFromConsist(Train *par
 
static void InsertInConsist(Train *dst, Train *chain)
 
{
 
	/* We do not want to add something in the middle of an articulated part. */
 
	assert(dst->Next() == NULL || !dst->Next()->IsArticulatedPart());
 
	assert(dst != NULL && (dst->Next() == NULL || !dst->Next()->IsArticulatedPart()));
 

	
 
	chain->Last()->SetNext(dst->Next());
 
	dst->SetNext(chain);
0 comments (0 inline, 0 general)