openttd updated to 1.5.0-beta2
--HG-- branch : openttd
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Id: order_gui.cpp 26086 2013-11-24 14:46:26Z rubidium $ */
|
||||
/* $Id: order_gui.cpp 26693 2014-07-16 21:06:45Z frosch $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#include "widgets/order_widget.h"
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
|
||||
/** Order load types that could be given to station orders. */
|
||||
static const StringID _station_load_types[][5][5] = {
|
||||
@@ -264,9 +266,9 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
|
||||
if (timetable) {
|
||||
SetDParam(3, STR_EMPTY);
|
||||
|
||||
if (order->wait_time > 0) {
|
||||
SetDParam(5, STR_TIMETABLE_STAY_FOR);
|
||||
SetTimetableParams(6, 7, order->wait_time);
|
||||
if (order->GetWaitTime() > 0) {
|
||||
SetDParam(5, order->IsWaitTimetabled() ? STR_TIMETABLE_STAY_FOR : STR_TIMETABLE_STAY_FOR_ESTIMATED);
|
||||
SetTimetableParams(6, 7, order->GetWaitTime());
|
||||
}
|
||||
} else {
|
||||
SetDParam(3, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) ? STR_EMPTY : _station_load_types[order->IsRefit()][unload][load]);
|
||||
@@ -332,9 +334,9 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
|
||||
SetDParam(4, value);
|
||||
}
|
||||
|
||||
if (timetable && order->wait_time > 0) {
|
||||
SetDParam(5, STR_TIMETABLE_AND_TRAVEL_FOR);
|
||||
SetTimetableParams(6, 7, order->wait_time);
|
||||
if (timetable && order->GetWaitTime() > 0) {
|
||||
SetDParam(5, order->IsWaitTimetabled() ? STR_TIMETABLE_AND_TRAVEL_FOR : STR_TIMETABLE_AND_TRAVEL_FOR_ESTIMATED);
|
||||
SetTimetableParams(6, 7, order->GetWaitTime());
|
||||
} else {
|
||||
SetDParam(5, STR_EMPTY);
|
||||
}
|
||||
@@ -346,7 +348,12 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
|
||||
DrawString(rtl ? left : middle, rtl ? middle : right, y, STR_ORDER_TEXT, colour);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the order command a vehicle can do in a given tile.
|
||||
* @param v Vehicle involved.
|
||||
* @param tile Tile being queried.
|
||||
* @return The order associated to vehicle v in given tile (or empty order if vehicle can do nothing in the tile).
|
||||
*/
|
||||
static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||
{
|
||||
/* Hack-ish; unpack order 0, so everything gets initialised with either zero
|
||||
@@ -356,59 +363,27 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||
order.index = 0;
|
||||
|
||||
/* check depot first */
|
||||
switch (GetTileType(tile)) {
|
||||
case MP_RAILWAY:
|
||||
if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_company)) {
|
||||
if (IsRailDepot(tile)) {
|
||||
order.MakeGoToDepot(GetDepotIndex(tile), ODTFB_PART_OF_ORDERS,
|
||||
_settings_client.gui.new_nonstop ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
|
||||
if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE));
|
||||
return order;
|
||||
}
|
||||
}
|
||||
break;
|
||||
if (IsDepotTypeTile(tile, (TransportType)(uint)v->type) && IsTileOwner(tile, _local_company)) {
|
||||
order.MakeGoToDepot(v->type == VEH_AIRCRAFT ? GetStationIndex(tile) : GetDepotIndex(tile),
|
||||
ODTFB_PART_OF_ORDERS,
|
||||
(_settings_client.gui.new_nonstop && v->IsGroundVehicle()) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
|
||||
|
||||
case MP_ROAD:
|
||||
if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_company)) {
|
||||
order.MakeGoToDepot(GetDepotIndex(tile), ODTFB_PART_OF_ORDERS,
|
||||
_settings_client.gui.new_nonstop ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
|
||||
if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE));
|
||||
return order;
|
||||
}
|
||||
break;
|
||||
if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE));
|
||||
|
||||
case MP_STATION:
|
||||
if (v->type != VEH_AIRCRAFT) break;
|
||||
if (IsHangar(tile) && IsTileOwner(tile, _local_company)) {
|
||||
order.MakeGoToDepot(GetStationIndex(tile), ODTFB_PART_OF_ORDERS, ONSF_STOP_EVERYWHERE);
|
||||
if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE));
|
||||
return order;
|
||||
}
|
||||
break;
|
||||
|
||||
case MP_WATER:
|
||||
if (v->type != VEH_SHIP) break;
|
||||
if (IsShipDepot(tile) && IsTileOwner(tile, _local_company)) {
|
||||
order.MakeGoToDepot(GetDepotIndex(tile), ODTFB_PART_OF_ORDERS, ONSF_STOP_EVERYWHERE);
|
||||
if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE));
|
||||
return order;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
return order;
|
||||
}
|
||||
|
||||
/* check waypoint */
|
||||
/* check rail waypoint */
|
||||
if (IsRailWaypointTile(tile) &&
|
||||
v->type == VEH_TRAIN &&
|
||||
IsTileOwner(tile, _local_company)) {
|
||||
order.MakeGoToWaypoint(Waypoint::GetByTile(tile)->index);
|
||||
order.MakeGoToWaypoint(GetStationIndex(tile));
|
||||
if (_settings_client.gui.new_nonstop != _ctrl_pressed) order.SetNonStopType(ONSF_NO_STOP_AT_ANY_STATION);
|
||||
return order;
|
||||
}
|
||||
|
||||
if ((IsBuoyTile(tile) && v->type == VEH_SHIP) || (IsRailWaypointTile(tile) && v->type == VEH_TRAIN)) {
|
||||
/* check buoy (no ownership) */
|
||||
if (IsBuoyTile(tile) && v->type == VEH_SHIP) {
|
||||
order.MakeGoToWaypoint(GetStationIndex(tile));
|
||||
return order;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user