Minor changes to avoid undefined behaviour warnings.
Avoid creating a reference from a nullptr. Avoid trying a malloc and memcpy into a 0 length buffer. Virtual trains should never be drawn.
This commit is contained in:
@@ -296,10 +296,10 @@ uint Vehicle::Crash(bool flooded)
|
||||
*/
|
||||
bool Vehicle::IsDrawn() const
|
||||
{
|
||||
return !(this->vehstatus & VS_HIDDEN) ||
|
||||
return !(HasBit(this->subtype, GVSF_VIRTUAL)) && (!(this->vehstatus & VS_HIDDEN) ||
|
||||
(IsTransparencySet(TO_TUNNELS) &&
|
||||
((this->type == VEH_TRAIN && Train::From(this)->track == TRACK_BIT_WORMHOLE) ||
|
||||
(this->type == VEH_ROAD && RoadVehicle::From(this)->state == RVSB_WORMHOLE)));
|
||||
(this->type == VEH_ROAD && RoadVehicle::From(this)->state == RVSB_WORMHOLE))));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user