|
|
|
@ -391,21 +391,6 @@ void UpdateAllStationVirtCoords()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update the station virt coords while making the modified parts dirty.
|
|
|
|
|
*
|
|
|
|
|
* This function updates the virt coords and mark the modified parts as dirty
|
|
|
|
|
*
|
|
|
|
|
* @param st The station to update the virt coords
|
|
|
|
|
* @ingroup dirty
|
|
|
|
|
*/
|
|
|
|
|
static void UpdateStationVirtCoordDirty(Station *st)
|
|
|
|
|
{
|
|
|
|
|
st->sign.MarkDirty();
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
st->sign.MarkDirty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Get a mask of the cargo types that the station accepts.
|
|
|
|
|
* @param st Station to query
|
|
|
|
|
* @return the expected mask
|
|
|
|
@ -598,7 +583,7 @@ static void UpdateStationSignCoord(Station *st)
|
|
|
|
|
|
|
|
|
|
/* clamp sign coord to be inside the station rect */
|
|
|
|
|
st->xy = TileXY(ClampU(TileX(st->xy), r->left, r->right), ClampU(TileY(st->xy), r->top, r->bottom));
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** This is called right after a station was deleted.
|
|
|
|
@ -1043,7 +1028,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, DoCommandFlag flags, uin
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
st->MarkTilesDirty(false);
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
|
@ -1218,7 +1203,7 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, DoCommandFlag flags, ui
|
|
|
|
|
if (st->train_tile == INVALID_TILE) {
|
|
|
|
|
st->facilities &= ~FACIL_TRAIN;
|
|
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS);
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
DeleteStationIfEmpty(st);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1302,7 +1287,7 @@ static CommandCost RemoveRailroadStation(TileIndex tile, DoCommandFlag flags)
|
|
|
|
|
st->cached_anim_triggers = 0;
|
|
|
|
|
|
|
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS);
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
DeleteStationIfEmpty(st);
|
|
|
|
|
}
|
|
|
|
@ -1468,7 +1453,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
|
|
|
|
MakeRoadStop(tile, st->owner, st->index, rs_type, rts, (DiagDirection)p1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
|
@ -1553,7 +1538,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
|
|
|
|
|
DoClearSquare(tile);
|
|
|
|
|
st->rect.AfterRemoveTile(st, tile);
|
|
|
|
|
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
DeleteStationIfEmpty(st);
|
|
|
|
|
}
|
|
|
|
@ -1837,7 +1822,7 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
|
|
|
|
} END_TILE_LOOP(tile_cur, w, h, tile)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
|
@ -1913,7 +1898,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
|
|
|
|
|
InvalidateWindow(WC_TOWN_VIEW, st->town->index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
DeleteStationIfEmpty(st);
|
|
|
|
|
}
|
|
|
|
@ -1957,7 +1942,7 @@ CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
|
|
|
|
|
|
|
|
|
MakeBuoy(tile, st->index, GetWaterClass(tile));
|
|
|
|
|
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
|
|
|
|
@ -2021,7 +2006,7 @@ static CommandCost RemoveBuoy(TileIndex tile, DoCommandFlag flags)
|
|
|
|
|
MakeWaterKeepingClass(tile, GetTileOwner(tile));
|
|
|
|
|
MarkTileDirtyByTile(tile);
|
|
|
|
|
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
DeleteStationIfEmpty(st);
|
|
|
|
|
}
|
|
|
|
@ -2136,7 +2121,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
|
|
|
|
|
|
|
|
|
MakeDock(tile, st->owner, st->index, direction, wc);
|
|
|
|
|
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
|
@ -2177,7 +2162,7 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
|
|
|
|
|
st->facilities &= ~FACIL_DOCK;
|
|
|
|
|
|
|
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_SHIPS);
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
DeleteStationIfEmpty(st);
|
|
|
|
|
}
|
|
|
|
@ -2850,7 +2835,6 @@ CommandCost CmdRenameStation(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
|
|
|
|
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
InvalidateWindowData(WC_STATION_LIST, st->owner, 1);
|
|
|
|
|
MarkWholeScreenDirty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return CommandCost();
|
|
|
|
@ -3008,7 +2992,7 @@ void BuildOilRig(TileIndex tile)
|
|
|
|
|
st->goods[j].last_age = 255;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
}
|
|
|
|
@ -3027,7 +3011,7 @@ void DeleteOilRig(TileIndex tile)
|
|
|
|
|
|
|
|
|
|
st->rect.AfterRemoveTile(st, tile);
|
|
|
|
|
|
|
|
|
|
UpdateStationVirtCoordDirty(st);
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
|
|
st->RecomputeIndustriesNear();
|
|
|
|
|
if (st->facilities == 0) delete st;
|
|
|
|
|
}
|
|
|
|
|