src/order_gui.cpp
branchnoai
changeset 10249 58810805030e
parent 10181 54df587fef5d
child 10455 22c441f5adf9
equal deleted inserted replaced
10216:794533ba4cbf 10249:58810805030e
    11 #include "station_base.h"
    11 #include "station_base.h"
    12 #include "town.h"
    12 #include "town.h"
    13 #include "command_func.h"
    13 #include "command_func.h"
    14 #include "viewport_func.h"
    14 #include "viewport_func.h"
    15 #include "gfx_func.h"
    15 #include "gfx_func.h"
    16 #include "depot.h"
    16 #include "depot_base.h"
    17 #include "waypoint.h"
    17 #include "waypoint.h"
    18 #include "train.h"
    18 #include "train.h"
    19 #include "water_map.h"
    19 #include "water_map.h"
    20 #include "vehicle_gui.h"
    20 #include "vehicle_gui.h"
    21 #include "timetable.h"
    21 #include "timetable.h"
    27 #include "player_func.h"
    27 #include "player_func.h"
    28 #include "newgrf_cargo.h"
    28 #include "newgrf_cargo.h"
    29 #include "widgets/dropdown_func.h"
    29 #include "widgets/dropdown_func.h"
    30 #include "textbuf_gui.h"
    30 #include "textbuf_gui.h"
    31 #include "string_func.h"
    31 #include "string_func.h"
       
    32 #include "depot_base.h"
    32 
    33 
    33 #include "table/sprites.h"
    34 #include "table/sprites.h"
    34 #include "table/strings.h"
    35 #include "table/strings.h"
    35 
    36 
    36 enum OrderWindowWidgets {
    37 enum OrderWindowWidgets {
   460 				}
   461 				}
   461 				break;
   462 				break;
   462 
   463 
   463 			case MP_WATER:
   464 			case MP_WATER:
   464 				if (v->type != VEH_SHIP) break;
   465 				if (v->type != VEH_SHIP) break;
   465 				if (IsTileDepotType(tile, TRANSPORT_WATER) &&
   466 				if (IsShipDepot(tile) && IsTileOwner(tile, _local_player)) {
   466 						IsTileOwner(tile, _local_player)) {
       
   467 					TileIndex tile2 = GetOtherShipDepotTile(tile);
   467 					TileIndex tile2 = GetOtherShipDepotTile(tile);
   468 
   468 
   469 					order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, ODTFB_PART_OF_ORDERS);
   469 					order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, ODTFB_PART_OF_ORDERS);
   470 					return order;
   470 					return order;
   471 				}
   471 				}
   539 
   539 
   540 	const Order cmd = GetOrderCmdFromTile(v, tile);
   540 	const Order cmd = GetOrderCmdFromTile(v, tile);
   541 	if (!cmd.IsValid()) return;
   541 	if (!cmd.IsValid()) return;
   542 
   542 
   543 	if (DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), cmd.Pack(), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER))) {
   543 	if (DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), cmd.Pack(), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER))) {
   544 		if (WP(w, order_d).sel != -1) WP(w,order_d).sel++;
   544 		if (WP(w, order_d).sel != -1) WP(w, order_d).sel++;
   545 		ResetObjectToPlace();
   545 		ResetObjectToPlace();
   546 	}
   546 	}
   547 }
   547 }
   548 
   548 
   549 /**
   549 /**
  1085 	{   WIDGETS_END},
  1085 	{   WIDGETS_END},
  1086 };
  1086 };
  1087 
  1087 
  1088 static const WindowDesc _orders_train_desc = {
  1088 static const WindowDesc _orders_train_desc = {
  1089 	WDP_AUTO, WDP_AUTO, 386, 100, 386, 100,
  1089 	WDP_AUTO, WDP_AUTO, 386, 100, 386, 100,
  1090 	WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW,
  1090 	WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
  1091 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
  1091 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
  1092 	_orders_train_widgets,
  1092 	_orders_train_widgets,
  1093 	OrdersWndProc
  1093 	OrdersWndProc
  1094 };
  1094 };
  1095 
  1095 
  1126 	{   WIDGETS_END},
  1126 	{   WIDGETS_END},
  1127 };
  1127 };
  1128 
  1128 
  1129 static const WindowDesc _orders_desc = {
  1129 static const WindowDesc _orders_desc = {
  1130 	WDP_AUTO, WDP_AUTO, 386, 100, 386, 100,
  1130 	WDP_AUTO, WDP_AUTO, 386, 100, 386, 100,
  1131 	WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW,
  1131 	WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
  1132 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
  1132 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
  1133 	_orders_widgets,
  1133 	_orders_widgets,
  1134 	OrdersWndProc
  1134 	OrdersWndProc
  1135 };
  1135 };
  1136 
  1136 
  1167 	{   WIDGETS_END},
  1167 	{   WIDGETS_END},
  1168 };
  1168 };
  1169 
  1169 
  1170 static const WindowDesc _other_orders_desc = {
  1170 static const WindowDesc _other_orders_desc = {
  1171 	WDP_AUTO, WDP_AUTO, 386, 88, 386, 88,
  1171 	WDP_AUTO, WDP_AUTO, 386, 88, 386, 88,
  1172 	WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW,
  1172 	WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
  1173 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
  1173 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
  1174 	_other_orders_widgets,
  1174 	_other_orders_widgets,
  1175 	OrdersWndProc
  1175 	OrdersWndProc
  1176 };
  1176 };
  1177 
  1177