Fix crash in station joining highlight
This commit is contained in:
@@ -155,12 +155,29 @@ void OnStationTileSetChange(const Station *station, bool adding, StationType typ
|
||||
if (station == _viewport_highlight_station) MarkCoverageAreaDirty(_viewport_highlight_station);
|
||||
}
|
||||
|
||||
void OnStationDeleted(const Station *station) {
|
||||
if (_highlight_station_to_join == station) {
|
||||
MarkCoverageAreaDirty(station);
|
||||
_highlight_station_to_join = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
const Station *_last_built_station;
|
||||
void OnStationPartBuilt(const Station *station) {
|
||||
_last_built_station = station;
|
||||
CheckRedrawStationCoverage();
|
||||
}
|
||||
|
||||
void OnStationRemoved(const Station *station) {
|
||||
if (_last_built_station == station) _last_built_station = nullptr;
|
||||
if (_station_to_join == station) {
|
||||
// TODO MarkJoinHighlight
|
||||
MarkCoverageAreaDirty(station);
|
||||
_station_to_join = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Station *CheckClickOnDeadStationSign() {
|
||||
int x = _cursor.pos.x;
|
||||
int y = _cursor.pos.y;
|
||||
|
||||
@@ -27,6 +27,7 @@ enum class StationBuildingStatus {
|
||||
bool UseImprovedStationJoin();
|
||||
void OnStationTileSetChange(const Station *station, bool adding, StationType type);
|
||||
void OnStationPartBuilt(const Station *station);
|
||||
void OnStationRemoved(const Station *station);
|
||||
void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, RoadStopType stop_type, bool adjacent, RoadType rt, StringID err_msg);
|
||||
void HandleStationPlacement(TileIndex start, TileIndex end);
|
||||
void PlaceRail_Station(TileIndex tile);
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "citymania/cm_station_gui.hpp"
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
/** The pool of stations. */
|
||||
@@ -87,6 +89,8 @@ Station::Station(TileIndex tile) :
|
||||
*/
|
||||
Station::~Station()
|
||||
{
|
||||
citymania::OnStationRemoved(this);
|
||||
|
||||
for (Town *t : Town::Iterate()) {
|
||||
// Using poiter comparison instead of cycling cargos
|
||||
if (t->ad_ref_goods_entry >= this->goods &&
|
||||
|
||||
Reference in New Issue
Block a user