mirror of https://github.com/OpenTTD/OpenTTD
(svn r20429) [1.0] -Backport from trunk:
- Fix: The caption of the 'Available vehicle' lists was black, whereas for building those vehicles, which uses the exact same window, it was white (r20244) - Fix: Refit costs from refit orders are subtracted from the vehicle yearly income [FS#3988] (r20234) - Fix: Road vehicles could be dead locked with one way roads. This allows one wayness to be removed if there are vehicles on a tile; it does not allow you to add one wayness to roads that have vehicles on them as it makes turning vehicles jump [FS#3961] (r20230) - Fix: 'Service at nearest depot' behaved the same as 'Go to nearest depot' [FS#3986] (r20229) - Fix: Depot did not become unsnowy, when snowline rises [FS#3976] (r20224)release/1.0
parent
266bb52e1e
commit
cc9c1ff2b0
|
@ -127,7 +127,7 @@ static const NWidgetPart _nested_group_widgets[] = {
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
NWidget(NWID_HORIZONTAL),
|
NWidget(NWID_HORIZONTAL),
|
||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, GRP_WIDGET_AVAILABLE_VEHICLES), SetMinimalSize(106, 12), SetFill(0, 1),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, GRP_WIDGET_AVAILABLE_VEHICLES), SetMinimalSize(106, 12), SetFill(0, 1),
|
||||||
SetDataTip(0x0, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
|
SetDataTip(STR_BLACK_STRING, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
|
||||||
NWidget(WWT_DROPDOWN, COLOUR_GREY, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN), SetMinimalSize(118, 12), SetFill(0, 1),
|
NWidget(WWT_DROPDOWN, COLOUR_GREY, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN), SetMinimalSize(118, 12), SetFill(0, 1),
|
||||||
SetDataTip(STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP),
|
SetDataTip(STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP),
|
||||||
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_STOP_ALL), SetMinimalSize(12, 12), SetFill(0, 1),
|
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_STOP_ALL), SetMinimalSize(12, 12), SetFill(0, 1),
|
||||||
|
@ -226,7 +226,6 @@ public:
|
||||||
|
|
||||||
this->GetWidget<NWidgetCore>(GRP_WIDGET_CAPTION)->widget_data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->vehicle_type;
|
this->GetWidget<NWidgetCore>(GRP_WIDGET_CAPTION)->widget_data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->vehicle_type;
|
||||||
this->GetWidget<NWidgetCore>(GRP_WIDGET_LIST_VEHICLE)->tool_tip = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vehicle_type;
|
this->GetWidget<NWidgetCore>(GRP_WIDGET_LIST_VEHICLE)->tool_tip = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vehicle_type;
|
||||||
this->GetWidget<NWidgetCore>(GRP_WIDGET_AVAILABLE_VEHICLES)->widget_data = STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vehicle_type;
|
|
||||||
|
|
||||||
this->GetWidget<NWidgetCore>(GRP_WIDGET_CREATE_GROUP)->widget_data += this->vehicle_type;
|
this->GetWidget<NWidgetCore>(GRP_WIDGET_CREATE_GROUP)->widget_data += this->vehicle_type;
|
||||||
this->GetWidget<NWidgetCore>(GRP_WIDGET_RENAME_GROUP)->widget_data += this->vehicle_type;
|
this->GetWidget<NWidgetCore>(GRP_WIDGET_RENAME_GROUP)->widget_data += this->vehicle_type;
|
||||||
|
@ -301,22 +300,28 @@ public:
|
||||||
|
|
||||||
virtual void SetStringParameters(int widget) const
|
virtual void SetStringParameters(int widget) const
|
||||||
{
|
{
|
||||||
if (widget != GRP_WIDGET_CAPTION) return;
|
switch (widget) {
|
||||||
|
case GRP_WIDGET_AVAILABLE_VEHICLES:
|
||||||
|
SetDParam(0, STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vehicle_type);
|
||||||
|
break;
|
||||||
|
|
||||||
/* If selected_group == DEFAULT_GROUP || ALL_GROUP, draw the standard caption
|
case GRP_WIDGET_CAPTION:
|
||||||
* We list all vehicles or ungrouped vehicles */
|
/* If selected_group == DEFAULT_GROUP || ALL_GROUP, draw the standard caption
|
||||||
if (IsDefaultGroupID(this->group_sel) || IsAllGroupID(this->group_sel)) {
|
* We list all vehicles or ungrouped vehicles */
|
||||||
SetDParam(0, STR_COMPANY_NAME);
|
if (IsDefaultGroupID(this->group_sel) || IsAllGroupID(this->group_sel)) {
|
||||||
SetDParam(1, GB(this->window_number, 0, 8));
|
SetDParam(0, STR_COMPANY_NAME);
|
||||||
SetDParam(2, this->vehicles.Length());
|
SetDParam(1, GB(this->window_number, 0, 8));
|
||||||
SetDParam(3, this->vehicles.Length());
|
SetDParam(2, this->vehicles.Length());
|
||||||
} else {
|
SetDParam(3, this->vehicles.Length());
|
||||||
const Group *g = Group::Get(this->group_sel);
|
} else {
|
||||||
|
const Group *g = Group::Get(this->group_sel);
|
||||||
|
|
||||||
SetDParam(0, STR_GROUP_NAME);
|
SetDParam(0, STR_GROUP_NAME);
|
||||||
SetDParam(1, g->index);
|
SetDParam(1, g->index);
|
||||||
SetDParam(2, g->num_vehicle);
|
SetDParam(2, g->num_vehicle);
|
||||||
SetDParam(3, g->num_vehicle);
|
SetDParam(3, g->num_vehicle);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2656,10 +2656,10 @@ STR_VEHICLE_LIST_AIRCRAFT_TOOLTIP :{BLACK}Aircraft
|
||||||
|
|
||||||
STR_VEHICLE_LIST_PROFIT_THIS_YEAR_LAST_YEAR :{TINYFONT}{BLACK}Profit this year: {CURRENCY} (last year: {CURRENCY})
|
STR_VEHICLE_LIST_PROFIT_THIS_YEAR_LAST_YEAR :{TINYFONT}{BLACK}Profit this year: {CURRENCY} (last year: {CURRENCY})
|
||||||
|
|
||||||
STR_VEHICLE_LIST_AVAILABLE_TRAINS :{BLACK}Available Trains
|
STR_VEHICLE_LIST_AVAILABLE_TRAINS :Available Trains
|
||||||
STR_VEHICLE_LIST_AVAILABLE_ROAD_VEHICLES :{BLACK}Available Vehicles
|
STR_VEHICLE_LIST_AVAILABLE_ROAD_VEHICLES :Available Vehicles
|
||||||
STR_VEHICLE_LIST_AVAILABLE_SHIPS :{BLACK}Available Ships
|
STR_VEHICLE_LIST_AVAILABLE_SHIPS :Available Ships
|
||||||
STR_VEHICLE_LIST_AVAILABLE_AIRCRAFT :{BLACK}Available Aircraft
|
STR_VEHICLE_LIST_AVAILABLE_AIRCRAFT :Available Aircraft
|
||||||
STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP :{BLACK}See a list of available engine designs for this vehicle type.
|
STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP :{BLACK}See a list of available engine designs for this vehicle type.
|
||||||
|
|
||||||
STR_VEHICLE_LIST_MANAGE_LIST :{BLACK}Manage list
|
STR_VEHICLE_LIST_MANAGE_LIST :{BLACK}Manage list
|
||||||
|
|
|
@ -1671,6 +1671,12 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case OT_GOTO_DEPOT:
|
case OT_GOTO_DEPOT:
|
||||||
|
if ((order->GetDepotOrderType() & ODTFB_SERVICE) && !v->NeedsServicing()) {
|
||||||
|
UpdateVehicleTimetable(v, true);
|
||||||
|
v->IncrementOrderIndex();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (v->current_order.GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
|
if (v->current_order.GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
|
||||||
/* We need to search for the nearest depot (hangar). */
|
/* We need to search for the nearest depot (hangar). */
|
||||||
TileIndex location;
|
TileIndex location;
|
||||||
|
@ -1695,9 +1701,6 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateVehicleTimetable(v, true);
|
|
||||||
v->IncrementOrderIndex();
|
|
||||||
} else if ((order->GetDepotOrderType() & ODTFB_SERVICE) && !v->NeedsServicing()) {
|
|
||||||
UpdateVehicleTimetable(v, true);
|
UpdateVehicleTimetable(v, true);
|
||||||
v->IncrementOrderIndex();
|
v->IncrementOrderIndex();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2372,11 +2372,9 @@ static void TileLoop_Track(TileIndex tile)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsPlainRail(tile)) return;
|
|
||||||
|
|
||||||
new_ground = RAIL_GROUND_GRASS;
|
new_ground = RAIL_GROUND_GRASS;
|
||||||
|
|
||||||
if (old_ground != RAIL_GROUND_BARREN) { // wait until bottom is green
|
if (IsPlainRail(tile) && old_ground != RAIL_GROUND_BARREN) { // wait until bottom is green
|
||||||
/* determine direction of fence */
|
/* determine direction of fence */
|
||||||
TrackBits rail = GetTrackBits(tile);
|
TrackBits rail = GetTrackBits(tile);
|
||||||
|
|
||||||
|
|
|
@ -491,11 +491,20 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
Owner owner = GetRoadOwner(tile, ROADTYPE_ROAD);
|
Owner owner = GetRoadOwner(tile, ROADTYPE_ROAD);
|
||||||
if (owner != OWNER_NONE && !CheckOwnership(owner, tile)) return CMD_ERROR;
|
if (owner != OWNER_NONE && !CheckOwnership(owner, tile)) return CMD_ERROR;
|
||||||
|
|
||||||
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
|
DisallowedRoadDirections dis_existing = GetDisallowedRoadDirections(tile);
|
||||||
|
DisallowedRoadDirections dis_new = dis_existing ^ toggle_drd;
|
||||||
|
|
||||||
|
/* We allow removing disallowed directions to break up
|
||||||
|
* deadlocks, but adding them can break articulated
|
||||||
|
* vehicles. As such, only when less is disallowed,
|
||||||
|
* i.e. bits are removed, we skip the vehicle check. */
|
||||||
|
if (CountBits(dis_existing) <= CountBits(dis_new)) {
|
||||||
|
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
/* Ignore half built tiles */
|
/* Ignore half built tiles */
|
||||||
if ((flags & DC_EXEC) && rt != ROADTYPE_TRAM && IsStraightRoad(existing)) {
|
if ((flags & DC_EXEC) && rt != ROADTYPE_TRAM && IsStraightRoad(existing)) {
|
||||||
SetDisallowedRoadDirections(tile, GetDisallowedRoadDirections(tile) ^ toggle_drd);
|
SetDisallowedRoadDirections(tile, dis_new);
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
}
|
}
|
||||||
return CommandCost();
|
return CommandCost();
|
||||||
|
|
|
@ -1069,8 +1069,11 @@ void VehicleEnterDepot(Vehicle *v)
|
||||||
SetDParam(0, v->index);
|
SetDParam(0, v->index);
|
||||||
AddVehicleNewsItem(STR_NEWS_ORDER_REFIT_FAILED, NS_ADVICE, v->index);
|
AddVehicleNewsItem(STR_NEWS_ORDER_REFIT_FAILED, NS_ADVICE, v->index);
|
||||||
}
|
}
|
||||||
} else if (v->owner == _local_company && cost.GetCost() != 0) {
|
} else if (cost.GetCost() != 0) {
|
||||||
ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, cost.GetCost());
|
v->profit_this_year -= cost.GetCost() << 8;
|
||||||
|
if (v->owner == _local_company) {
|
||||||
|
ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, cost.GetCost());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -784,7 +784,7 @@ static const NWidgetPart _nested_vehicle_list[] = {
|
||||||
NWidget(NWID_SELECTION, INVALID_COLOUR, VLW_WIDGET_HIDE_BUTTONS),
|
NWidget(NWID_SELECTION, INVALID_COLOUR, VLW_WIDGET_HIDE_BUTTONS),
|
||||||
NWidget(NWID_HORIZONTAL),
|
NWidget(NWID_HORIZONTAL),
|
||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, VLW_WIDGET_AVAILABLE_VEHICLES), SetMinimalSize(106, 12), SetFill(0, 1),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, VLW_WIDGET_AVAILABLE_VEHICLES), SetMinimalSize(106, 12), SetFill(0, 1),
|
||||||
SetDataTip(0x0, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
|
SetDataTip(STR_BLACK_STRING, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
|
||||||
NWidget(WWT_DROPDOWN, COLOUR_GREY, VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN), SetMinimalSize(118, 12), SetFill(0, 1),
|
NWidget(WWT_DROPDOWN, COLOUR_GREY, VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN), SetMinimalSize(118, 12), SetFill(0, 1),
|
||||||
SetDataTip(STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP),
|
SetDataTip(STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP),
|
||||||
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, VLW_WIDGET_STOP_ALL), SetMinimalSize(12, 12), SetFill(0, 1),
|
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, VLW_WIDGET_STOP_ALL), SetMinimalSize(12, 12), SetFill(0, 1),
|
||||||
|
@ -978,8 +978,7 @@ public:
|
||||||
this->CreateNestedTree(desc);
|
this->CreateNestedTree(desc);
|
||||||
|
|
||||||
/* Set up the window widgets */
|
/* Set up the window widgets */
|
||||||
this->GetWidget<NWidgetCore>(VLW_WIDGET_LIST)->tool_tip = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vehicle_type;
|
this->GetWidget<NWidgetCore>(VLW_WIDGET_LIST)->tool_tip = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vehicle_type;
|
||||||
this->GetWidget<NWidgetCore>(VLW_WIDGET_AVAILABLE_VEHICLES)->widget_data = STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vehicle_type;
|
|
||||||
|
|
||||||
if (window_type == VLW_SHARED_ORDERS) {
|
if (window_type == VLW_SHARED_ORDERS) {
|
||||||
this->GetWidget<NWidgetCore>(VLW_WIDGET_CAPTION)->widget_data = STR_VEHICLE_LIST_SHARED_ORDERS_LIST_CAPTION;
|
this->GetWidget<NWidgetCore>(VLW_WIDGET_CAPTION)->widget_data = STR_VEHICLE_LIST_SHARED_ORDERS_LIST_CAPTION;
|
||||||
|
@ -1022,47 +1021,53 @@ public:
|
||||||
|
|
||||||
virtual void SetStringParameters(int widget) const
|
virtual void SetStringParameters(int widget) const
|
||||||
{
|
{
|
||||||
if (widget != VLW_WIDGET_CAPTION) return;
|
switch (widget) {
|
||||||
|
case VLW_WIDGET_AVAILABLE_VEHICLES:
|
||||||
|
SetDParam(0, STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vehicle_type);
|
||||||
|
break;
|
||||||
|
|
||||||
const uint16 index = GB(this->window_number, 16, 16);
|
case VLW_WIDGET_CAPTION: {
|
||||||
switch (this->window_number & VLW_MASK) {
|
const uint16 index = GB(this->window_number, 16, 16);
|
||||||
case VLW_SHARED_ORDERS: // Shared Orders
|
switch (this->window_number & VLW_MASK) {
|
||||||
if (this->vehicles.Length() == 0) {
|
case VLW_SHARED_ORDERS: // Shared Orders
|
||||||
/* We can't open this window without vehicles using this order
|
if (this->vehicles.Length() == 0) {
|
||||||
* and we should close the window when deleting the order */
|
/* We can't open this window without vehicles using this order
|
||||||
NOT_REACHED();
|
* and we should close the window when deleting the order */
|
||||||
|
NOT_REACHED();
|
||||||
|
}
|
||||||
|
SetDParam(0, this->vscroll.GetCount());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VLW_STANDARD: // Company Name
|
||||||
|
SetDParam(0, STR_COMPANY_NAME);
|
||||||
|
SetDParam(1, index);
|
||||||
|
SetDParam(2, this->vscroll.GetCount());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VLW_WAYPOINT_LIST:
|
||||||
|
SetDParam(0, STR_WAYPOINT_NAME);
|
||||||
|
SetDParam(1, index);
|
||||||
|
SetDParam(2, this->vscroll.GetCount());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VLW_STATION_LIST: // Station Name
|
||||||
|
SetDParam(0, STR_STATION_NAME);
|
||||||
|
SetDParam(1, index);
|
||||||
|
SetDParam(2, this->vscroll.GetCount());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VLW_DEPOT_LIST:
|
||||||
|
SetDParam(0, STR_DEPOT_TRAIN_CAPTION + this->vehicle_type);
|
||||||
|
if (this->vehicle_type == VEH_AIRCRAFT) {
|
||||||
|
SetDParam(1, index); // Airport name
|
||||||
|
} else {
|
||||||
|
SetDParam(1, Depot::Get(index)->town_index);
|
||||||
|
}
|
||||||
|
SetDParam(2, this->vscroll.GetCount());
|
||||||
|
break;
|
||||||
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
SetDParam(0, this->vscroll.GetCount());
|
} break;
|
||||||
break;
|
|
||||||
|
|
||||||
case VLW_STANDARD: // Company Name
|
|
||||||
SetDParam(0, STR_COMPANY_NAME);
|
|
||||||
SetDParam(1, index);
|
|
||||||
SetDParam(2, this->vscroll.GetCount());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VLW_WAYPOINT_LIST:
|
|
||||||
SetDParam(0, STR_WAYPOINT_NAME);
|
|
||||||
SetDParam(1, index);
|
|
||||||
SetDParam(2, this->vscroll.GetCount());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VLW_STATION_LIST: // Station Name
|
|
||||||
SetDParam(0, STR_STATION_NAME);
|
|
||||||
SetDParam(1, index);
|
|
||||||
SetDParam(2, this->vscroll.GetCount());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VLW_DEPOT_LIST:
|
|
||||||
SetDParam(0, STR_DEPOT_TRAIN_CAPTION + this->vehicle_type);
|
|
||||||
if (this->vehicle_type == VEH_AIRCRAFT) {
|
|
||||||
SetDParam(1, index); // Airport name
|
|
||||||
} else {
|
|
||||||
SetDParam(1, Depot::Get(index)->town_index);
|
|
||||||
}
|
|
||||||
SetDParam(2, this->vscroll.GetCount());
|
|
||||||
break;
|
|
||||||
default: NOT_REACHED();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue