order_gui.cpp File Reference

GUI related to orders. More...

#include "stdafx.h"
#include "command_func.h"
#include "viewport_func.h"
#include "depot_map.h"
#include "vehicle_gui.h"
#include "roadveh.h"
#include "timetable.h"
#include "strings_func.h"
#include "window_func.h"
#include "vehicle_func.h"
#include "company_func.h"
#include "widgets/dropdown_func.h"
#include "textbuf_gui.h"
#include "string_func.h"
#include "tilehighlight_func.h"
#include "network/network.h"
#include "station_base.h"
#include "waypoint_base.h"
#include "core/geometry_func.hpp"
#include "hotkeys.h"
#include "table/strings.h"

Go to the source code of this file.

Data Structures

struct  OrdersWindow
 Order window code for all vehicles. More...

Enumerations

enum  OrderWindowWidgets {
  ORDER_WIDGET_CAPTION, ORDER_WIDGET_TIMETABLE_VIEW, ORDER_WIDGET_ORDER_LIST, ORDER_WIDGET_SCROLLBAR,
  ORDER_WIDGET_SKIP, ORDER_WIDGET_DELETE, ORDER_WIDGET_STOP_SHARING, ORDER_WIDGET_NON_STOP,
  ORDER_WIDGET_GOTO, ORDER_WIDGET_FULL_LOAD, ORDER_WIDGET_UNLOAD, ORDER_WIDGET_REFIT,
  ORDER_WIDGET_SERVICE, ORDER_WIDGET_COND_VARIABLE, ORDER_WIDGET_COND_COMPARATOR, ORDER_WIDGET_COND_VALUE,
  ORDER_WIDGET_SEL_TOP_LEFT, ORDER_WIDGET_SEL_TOP_MIDDLE, ORDER_WIDGET_SEL_TOP_RIGHT, ORDER_WIDGET_SEL_TOP_ROW,
  ORDER_WIDGET_SEL_BOTTOM_MIDDLE, ORDER_WIDGET_SHARED_ORDER_LIST
}
 

Widget numbers of the order window.

More...

Functions

uint ConvertSpeedToDisplaySpeed (uint speed)
 Convert the given (internal) speed to the display speed.
uint ConvertDisplaySpeedToSpeed (uint speed)
 Convert the given display speed to the (internal) speed.
static int DepotActionStringIndex (const Order *order)
void DrawOrderString (const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int left, int middle, int right)
 Draws an order in order or timetable GUI.
static Order GetOrderCmdFromTile (const Vehicle *v, TileIndex tile)
void ShowOrdersWindow (const Vehicle *v)

Variables

static const StringID _station_load_types [][5]
 Order load types that could be given to station orders.
static const StringID _order_non_stop_drowdown []
static const StringID _order_full_load_drowdown []
static const StringID _order_unload_drowdown []
static const StringID _order_goto_dropdown []
static const StringID _order_goto_dropdown_aircraft []
static const StringID _order_conditional_variable []
static const StringID _order_conditional_condition []
static const StringID _order_depot_action_dropdown []
Hotkey< OrdersWindow > * _order_hotkeys = OrdersWindow::order_hotkeys
static const NWidgetPart _nested_orders_train_widgets []
 Nested widget definition for "your" train orders.
static const WindowDesc _orders_train_desc (WDP_AUTO, 384, 100, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_CONSTRUCTION, _nested_orders_train_widgets, lengthof(_nested_orders_train_widgets))
static const NWidgetPart _nested_orders_widgets []
 Nested widget definition for "your" orders (non-train).
static const WindowDesc _orders_desc (WDP_AUTO, 384, 100, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_CONSTRUCTION, _nested_orders_widgets, lengthof(_nested_orders_widgets))
static const NWidgetPart _nested_other_orders_widgets []
 Nested widget definition for competitor orders.
static const WindowDesc _other_orders_desc (WDP_AUTO, 384, 86, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_UNCLICK_BUTTONS|WDF_CONSTRUCTION, _nested_other_orders_widgets, lengthof(_nested_other_orders_widgets))

Detailed Description

GUI related to orders.

Definition in file order_gui.cpp.


Enumeration Type Documentation

Widget numbers of the order window.

Enumerator:
ORDER_WIDGET_SEL_TOP_LEFT 

NWID_SELECTION widget for left part of the top row of the 'your train' order window.

ORDER_WIDGET_SEL_TOP_MIDDLE 

NWID_SELECTION widget for middle part of the top row of the 'your train' order window.

ORDER_WIDGET_SEL_TOP_RIGHT 

NWID_SELECTION widget for right part of the top row of the 'your train' order window.

ORDER_WIDGET_SEL_TOP_ROW 

NWID_SELECTION widget for the top row of the 'your non-trains' order window.

ORDER_WIDGET_SEL_BOTTOM_MIDDLE 

NWID_SELECTION widget for the middle part of the bottom row of the 'your train' order window.

Definition at line 36 of file order_gui.cpp.


Function Documentation

uint ConvertDisplaySpeedToSpeed ( uint  speed  ) 

Convert the given display speed to the (internal) speed.

Parameters:
speed the speed to convert
Returns:
the converted speed.

Definition at line 609 of file strings.cpp.

References _settings_game, GameSettings::locale, Units::s_m, Units::s_s, and LocaleSettings::units.

Referenced by OrdersWindow::OnQueryTextFinished().

uint ConvertSpeedToDisplaySpeed ( uint  speed  ) 

Convert the given (internal) speed to the display speed.

Parameters:
speed the speed to convert
Returns:
the converted speed.

Definition at line 599 of file strings.cpp.

References _settings_game, GameSettings::locale, Units::s_m, and LocaleSettings::units.

Referenced by DrawOrderString(), FormatString(), OrdersWindow::OnClick(), and OrdersWindow::SetStringParameters().

void DrawOrderString ( const Vehicle v,
const Order order,
int  order_index,
int  y,
bool  selected,
bool  timetable,
int  left,
int  middle,
int  right 
)

Variable Documentation

Nested widget definition for "your" train orders.

Definition at line 1450 of file order_gui.cpp.

Nested widget definition for "your" orders (non-train).

Definition at line 1518 of file order_gui.cpp.

Initial value:
 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_GREY),
    NWidget(WWT_CAPTION, COLOUR_GREY, ORDER_WIDGET_CAPTION), SetDataTip(STR_ORDERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
    NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_TIMETABLE_VIEW), SetMinimalSize(61, 14), SetDataTip(STR_ORDERS_TIMETABLE_VIEW, STR_ORDERS_TIMETABLE_VIEW_TOOLTIP),
    NWidget(WWT_SHADEBOX, COLOUR_GREY),
    NWidget(WWT_STICKYBOX, COLOUR_GREY),
  EndContainer(),
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_PANEL, COLOUR_GREY, ORDER_WIDGET_ORDER_LIST), SetMinimalSize(372, 72), SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), SetResize(1, 1), SetScrollbar(ORDER_WIDGET_SCROLLBAR), EndContainer(),
    NWidget(NWID_VERTICAL),
      NWidget(NWID_VSCROLLBAR, COLOUR_GREY, ORDER_WIDGET_SCROLLBAR),
      NWidget(WWT_RESIZEBOX, COLOUR_GREY),
    EndContainer(),
  EndContainer(),
}

Nested widget definition for competitor orders.

Definition at line 1587 of file order_gui.cpp.

const StringID _order_conditional_condition[] [static]
Initial value:
 {
  STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS,
  STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS,
  STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN,
  STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS,
  STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN,
  STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS,
  STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE,
  STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE,
  INVALID_STRING_ID,
}

Definition at line 148 of file order_gui.cpp.

const StringID _order_conditional_variable[] [static]
Initial value:
 {
  STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE,
  STR_ORDER_CONDITIONAL_RELIABILITY,
  STR_ORDER_CONDITIONAL_MAX_SPEED,
  STR_ORDER_CONDITIONAL_AGE,
  STR_ORDER_CONDITIONAL_REQUIRES_SERVICE,
  STR_ORDER_CONDITIONAL_UNCONDITIONALLY,
  INVALID_STRING_ID,
}

Definition at line 138 of file order_gui.cpp.

const StringID _order_depot_action_dropdown[] [static]
Initial value:
 {
  STR_ORDER_DROP_GO_ALWAYS_DEPOT,
  STR_ORDER_DROP_SERVICE_DEPOT,
  STR_ORDER_DROP_HALT_DEPOT,
  INVALID_STRING_ID
}

Definition at line 163 of file order_gui.cpp.

const StringID _order_full_load_drowdown[] [static]
Initial value:
 {
  STR_ORDER_DROP_LOAD_IF_POSSIBLE,
  STR_EMPTY,
  STR_ORDER_DROP_FULL_LOAD_ALL,
  STR_ORDER_DROP_FULL_LOAD_ANY,
  STR_ORDER_DROP_NO_LOADING,
  INVALID_STRING_ID
}

Definition at line 104 of file order_gui.cpp.

const StringID _order_goto_dropdown[] [static]
Initial value:
 {
  STR_ORDER_GO_TO,
  STR_ORDER_GO_TO_NEAREST_DEPOT,
  STR_ORDER_CONDITIONAL,
  STR_ORDER_SHARE,
  INVALID_STRING_ID
}

Definition at line 122 of file order_gui.cpp.

const StringID _order_goto_dropdown_aircraft[] [static]
Initial value:
 {
  STR_ORDER_GO_TO,
  STR_ORDER_GO_TO_NEAREST_HANGAR,
  STR_ORDER_CONDITIONAL,
  STR_ORDER_SHARE,
  INVALID_STRING_ID
}

Definition at line 130 of file order_gui.cpp.

const StringID _order_non_stop_drowdown[] [static]
Initial value:
 {
  STR_ORDER_GO_TO,
  STR_ORDER_GO_NON_STOP_TO,
  STR_ORDER_GO_VIA,
  STR_ORDER_GO_NON_STOP_VIA,
  INVALID_STRING_ID
}

Definition at line 96 of file order_gui.cpp.

const StringID _order_unload_drowdown[] [static]
Initial value:
 {
  STR_ORDER_DROP_UNLOAD_IF_ACCEPTED,
  STR_ORDER_DROP_UNLOAD,
  STR_ORDER_DROP_TRANSFER,
  STR_EMPTY,
  STR_ORDER_DROP_NO_UNLOADING,
  INVALID_STRING_ID
}

Definition at line 113 of file order_gui.cpp.

const StringID _station_load_types[][5] [static]

Order load types that could be given to station orders.

Definition at line 62 of file order_gui.cpp.

Referenced by DrawOrderString().


Generated on Fri Dec 31 17:15:49 2010 for OpenTTD by  doxygen 1.6.1