mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Some more null checks
This commit is contained in:
parent
1778b2d66e
commit
bb7353c02a
|
@ -124,8 +124,12 @@ struct CFollowTrackT
|
||||||
m_old_tile = old_tile;
|
m_old_tile = old_tile;
|
||||||
m_old_td = old_td;
|
m_old_td = old_td;
|
||||||
m_err = EC_NONE;
|
m_err = EC_NONE;
|
||||||
assert(((TrackStatusToTrackdirBits(GetTileTrackStatus(m_old_tile, TT(), IsRoadTT() ? RoadVehicle::From(m_veh)->compatible_roadtypes : 0)) & TrackdirToTrackdirBits(m_old_td)) != 0) ||
|
assert(
|
||||||
(IsTram() && GetSingleTramBit(m_old_tile) != INVALID_DIAGDIR)); // Disable the assertion for single tram bits
|
((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);
|
m_exitdir = TrackdirToExitdir(m_old_td);
|
||||||
if (ForcedReverse()) return true;
|
if (ForcedReverse()) return true;
|
||||||
if (!CanExitOldTile()) return false;
|
if (!CanExitOldTile()) return false;
|
||||||
|
|
|
@ -874,7 +874,7 @@ static void RemoveFromConsist(Train *part, bool chain = false)
|
||||||
static void InsertInConsist(Train *dst, Train *chain)
|
static void InsertInConsist(Train *dst, Train *chain)
|
||||||
{
|
{
|
||||||
/* We do not want to add something in the middle of an articulated part. */
|
/* 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());
|
chain->Last()->SetNext(dst->Next());
|
||||||
dst->SetNext(chain);
|
dst->SetNext(chain);
|
||||||
|
|
Loading…
Reference in New Issue