diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 388bee71e4..e2d710653f 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -3664,8 +3664,11 @@ static void DuplicateTileTable(AirportSpec *as) MemCpyT(table_list[i], as->table[i], num_tiles); } as->table = table_list; - HangarTileTable *depot_table = MallocT(as->nof_depots); - MemCpyT(depot_table, as->depot_table, as->nof_depots); + HangarTileTable *depot_table = NULL; + if (as->nof_depots > 0) { + depot_table = MallocT(as->nof_depots); + MemCpyT(depot_table, as->depot_table, as->nof_depots); + } as->depot_table = depot_table; } diff --git a/src/pathfinder/follow_track.hpp b/src/pathfinder/follow_track.hpp index 80b9b8b984..4d2912efb3 100644 --- a/src/pathfinder/follow_track.hpp +++ b/src/pathfinder/follow_track.hpp @@ -236,7 +236,7 @@ protected: /** stores track status (available trackdirs) for the new tile into m_new_td_bits */ inline bool QueryNewTileTrackStatus() { - CPerfStart perf(*m_pPerf); + CPerfStart perf(m_pPerf); if (IsRailTT() && IsPlainRailTile(m_new_tile)) { m_new_td_bits = (TrackdirBits)(GetTrackBits(m_new_tile) * 0x101); } else { diff --git a/src/pathfinder/pf_performance_timer.hpp b/src/pathfinder/pf_performance_timer.hpp index 808542d25a..0652c80d85 100644 --- a/src/pathfinder/pf_performance_timer.hpp +++ b/src/pathfinder/pf_performance_timer.hpp @@ -51,7 +51,7 @@ struct CPerfStartReal { CPerformanceTimer *m_pperf; - inline CPerfStartReal(CPerformanceTimer& perf) : m_pperf(&perf) + inline CPerfStartReal(CPerformanceTimer* perf) : m_pperf(perf) { if (m_pperf != NULL) m_pperf->Start(); } @@ -72,7 +72,7 @@ struct CPerfStartReal struct CPerfStartFake { - inline CPerfStartFake(CPerformanceTimer& perf) {} + inline CPerfStartFake(CPerformanceTimer* perf) {} inline ~CPerfStartFake() {} inline void Stop() {} }; diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp index fe375ec1a3..1b541193a2 100644 --- a/src/pathfinder/yapf/yapf_costrail.hpp +++ b/src/pathfinder/yapf/yapf_costrail.hpp @@ -94,7 +94,7 @@ protected: public: inline int SlopeCost(TileIndex tile, Trackdir td) { - CPerfStart perf_cost(Yapf().m_perf_slope_cost); + CPerfStart perf_cost(&Yapf().m_perf_slope_cost); if (!stSlopeCost(tile, td)) return 0; return Yapf().PfGetSettings().rail_slope_penalty; } @@ -280,7 +280,7 @@ public: { int cost = 0; /* if there is one-way signal in the opposite direction, then it is not our way */ - CPerfStart perf_cost(Yapf().m_perf_other_cost); + CPerfStart perf_cost(&Yapf().m_perf_other_cost); if (IsTileType(tile, MP_RAILWAY)) { bool has_signal_against = HasSignalOnTrackdir(tile, ReverseTrackdir(trackdir)); bool has_signal_along = HasSignalOnTrackdir(tile, trackdir); @@ -402,7 +402,7 @@ public: assert(tf->m_new_tile == n.m_key.m_tile); assert((TrackdirToTrackdirBits(n.m_key.m_td) & tf->m_new_td_bits) != TRACKDIR_BIT_NONE); - CPerfStart perf_cost(Yapf().m_perf_cost); + CPerfStart perf_cost(&Yapf().m_perf_cost); /* Does the node have some parent node? */ bool has_parent = (n.m_parent != NULL); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 44b88bcc8b..a56bccd04c 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -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)))); } /**