mirror of https://github.com/OpenTTD/OpenTTD
(svn r24422) [1.2] -Backport from trunk:
- Fix: When airport construction was denied due to noise, the error message named the wrong town (r24354) - Fix: [NoAI] A TileIndex is not a station id, so do not use it as one [FS#5215] (r24353) - Fix: When highlighting the drop position for vehicles in depots, make space for all articulated parts (r24352) - Fix: Short vehicles were not properly positioned at the cursor when dragging for RTL languages (r24351)release/1.2
parent
fc11459405
commit
975b6de604
|
@ -480,13 +480,14 @@ struct DepotWindow : Window {
|
|||
this->sel = INVALID_VEHICLE;
|
||||
TrainDepotMoveVehicle(v, sel, gdvp.head);
|
||||
} else if (v != NULL) {
|
||||
int image = v->GetImage(_current_text_dir == TD_RTL ? DIR_E : DIR_W, EIT_IN_DEPOT);
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
int image = v->GetImage(rtl ? DIR_E : DIR_W, EIT_IN_DEPOT);
|
||||
SetObjectToPlaceWnd(image, GetVehiclePalette(v), HT_DRAG, this);
|
||||
|
||||
this->sel = v->index;
|
||||
this->SetDirty();
|
||||
|
||||
_cursor.short_vehicle_offset = v->IsGroundVehicle() ? 16 - v->GetGroundVehicleCache()->cached_veh_length * 2 : 0;
|
||||
_cursor.short_vehicle_offset = v->IsGroundVehicle() ? (16 - v->GetGroundVehicleCache()->cached_veh_length * 2) * (rtl ? -1 : 1) : 0;
|
||||
_cursor.vehchain = _ctrl_pressed;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -659,8 +659,8 @@ static void _DoCommandReturnSetOrderFlags(class ScriptInstance *instance)
|
|||
/* static */ uint ScriptOrder::GetOrderDistance(ScriptVehicle::VehicleType vehicle_type, TileIndex origin_tile, TileIndex dest_tile)
|
||||
{
|
||||
if (vehicle_type == ScriptVehicle::VT_AIR) {
|
||||
if (ScriptTile::IsStationTile(origin_tile) && ::Station::Get(origin_tile)->airport.tile != INVALID_TILE) origin_tile = ::Station::Get(origin_tile)->airport.tile;
|
||||
if (ScriptTile::IsStationTile(dest_tile) && ::Station::Get(dest_tile)->airport.tile != INVALID_TILE) dest_tile = ::Station::Get(dest_tile)->airport.tile;
|
||||
if (ScriptTile::IsStationTile(origin_tile) && ::Station::GetByTile(origin_tile)->airport.tile != INVALID_TILE) origin_tile = ::Station::GetByTile(origin_tile)->airport.tile;
|
||||
if (ScriptTile::IsStationTile(dest_tile) && ::Station::GetByTile(dest_tile)->airport.tile != INVALID_TILE) dest_tile = ::Station::GetByTile(dest_tile)->airport.tile;
|
||||
|
||||
return ScriptMap::DistanceSquare(origin_tile, dest_tile);
|
||||
} else {
|
||||
|
|
|
@ -2165,11 +2165,13 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
|||
|
||||
/* Check if local auth would allow a new airport */
|
||||
StringID authority_refuse_message = STR_NULL;
|
||||
Town *authority_refuse_town = NULL;
|
||||
|
||||
if (_settings_game.economy.station_noise_level) {
|
||||
/* do not allow to build a new airport if this raise the town noise over the maximum allowed by town */
|
||||
if ((nearest->noise_reached + newnoise_level) > nearest->MaxTownNoise()) {
|
||||
authority_refuse_message = STR_ERROR_LOCAL_AUTHORITY_REFUSES_NOISE;
|
||||
authority_refuse_town = nearest;
|
||||
}
|
||||
} else {
|
||||
uint num = 0;
|
||||
|
@ -2179,11 +2181,12 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
|||
}
|
||||
if (num >= 2) {
|
||||
authority_refuse_message = STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT;
|
||||
authority_refuse_town = t;
|
||||
}
|
||||
}
|
||||
|
||||
if (authority_refuse_message != STR_NULL) {
|
||||
SetDParam(0, t->index);
|
||||
SetDParam(0, authority_refuse_town->index);
|
||||
return_cmd_error(authority_refuse_message);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,8 +61,10 @@ static int HighlightDragPosition(int px, int max_width, VehicleID selection)
|
|||
bool rtl = _current_text_dir == TD_RTL;
|
||||
|
||||
assert(selection != INVALID_VEHICLE);
|
||||
Point offset;
|
||||
int dragged_width = Train::Get(selection)->GetDisplayImageWidth(&offset) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
|
||||
int dragged_width = WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
|
||||
for (Train *t = Train::Get(selection); t != NULL; t = t->HasArticulatedPart() ? t->GetNextArticulatedPart() : NULL) {
|
||||
dragged_width += t->GetDisplayImageWidth(NULL);
|
||||
}
|
||||
|
||||
int drag_hlight_left = rtl ? max(px -dragged_width, 0) : px;
|
||||
int drag_hlight_right = rtl ? px : min(px + dragged_width, max_width);
|
||||
|
|
Loading…
Reference in New Issue