mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r20559) -Fix [FS#4045]: make sure that all vehicles are build in the most northern depot/hangar tile
This commit is contained in:
parent
16be24e13a
commit
85740a0283
|
@ -225,9 +225,13 @@ void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height)
|
|||
CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **ret)
|
||||
{
|
||||
const AircraftVehicleInfo *avi = &e->u.air;
|
||||
const Station *st = Station::GetByTile(tile);
|
||||
|
||||
/* Prevent building aircraft types at places which can't handle them */
|
||||
if (!CanVehicleUseStation(e->index, Station::GetByTile(tile))) return CMD_ERROR;
|
||||
if (!CanVehicleUseStation(e->index, st)) return CMD_ERROR;
|
||||
|
||||
/* Make sure all aircraft end up in the first tile of the hanger. */
|
||||
tile = st->airport.GetHangarTile(st->airport.GetHangarNum(tile));
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
Aircraft *v = new Aircraft(); // aircraft
|
||||
|
|
|
@ -613,6 +613,7 @@ bool Ship::Tick()
|
|||
*/
|
||||
CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **ret)
|
||||
{
|
||||
tile = GetShipDepotNorthTile(tile);
|
||||
if (flags & DC_EXEC) {
|
||||
int x;
|
||||
int y;
|
||||
|
|
|
@ -137,7 +137,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
|||
v->unitnumber = unit_num;
|
||||
v->value = value.GetCost();
|
||||
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, tile);
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||
InvalidateWindowClassesData(GetWindowClassForVehicleType(type), 0);
|
||||
SetWindowDirty(WC_COMPANY, _current_company);
|
||||
if (IsLocalCompany()) {
|
||||
|
|
|
@ -172,7 +172,6 @@ static CommandCost RemoveShipDepot(TileIndex tile, DoCommandFlag flags)
|
|||
}
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
/* Kill the depot, which is registered at the northernmost tile. Use that one */
|
||||
delete Depot::GetByTile(tile);
|
||||
|
||||
MakeWaterKeepingClass(tile, GetTileOwner(tile));
|
||||
|
@ -1180,9 +1179,7 @@ static TrackStatus GetTileTrackStatus_Water(TileIndex tile, TransportType mode,
|
|||
static bool ClickTile_Water(TileIndex tile)
|
||||
{
|
||||
if (GetWaterTileType(tile) == WATER_TILE_DEPOT) {
|
||||
TileIndex tile2 = GetOtherShipDepotTile(tile);
|
||||
|
||||
ShowDepotWindow(tile < tile2 ? tile : tile2, VEH_SHIP);
|
||||
ShowDepotWindow(GetShipDepotNorthTile(tile), VEH_SHIP);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -197,6 +197,19 @@ static inline DiagDirection GetShipDepotDirection(TileIndex t)
|
|||
return XYNSToDiagDir(GetShipDepotAxis(t), GB(_m[t].m5, 0, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the most northern tile of a ship depot.
|
||||
* @param tile One of the tiles of the ship depot.
|
||||
* @return The northern tile of the depot.
|
||||
*/
|
||||
static TileIndex GetShipDepotNorthTile(TileIndex t)
|
||||
{
|
||||
assert(IsShipDepot(t));
|
||||
TileIndex tile2 = GetOtherShipDepotTile(t);
|
||||
|
||||
return t < tile2 ? t : tile2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is it a water lock tile?
|
||||
* @param t Water tile to query.
|
||||
|
|
Loading…
Reference in New Issue