35 #include "table/strings.h" 
   40 static void ShowRoadDepotPicker(
Window *parent);
 
   43 static bool _one_way_button_clicked;
 
   51   RF_START_HALFROAD_Y = 0x01,    
 
   52   RF_END_HALFROAD_Y   = 0x02,    
 
   55   RF_START_HALFROAD_X = 0x08,    
 
   56   RF_END_HALFROAD_X   = 0x10,    
 
  132     STR_ERROR_CAN_T_BUILD_ROAD_HERE,
 
  133     STR_ERROR_CAN_T_REMOVE_ROAD_FROM,
 
  134     STR_ERROR_CAN_T_BUILD_ROAD_DEPOT,
 
  135     { STR_ERROR_CAN_T_BUILD_BUS_STATION,         STR_ERROR_CAN_T_BUILD_TRUCK_STATION          },
 
  136     { STR_ERROR_CAN_T_REMOVE_BUS_STATION,        STR_ERROR_CAN_T_REMOVE_TRUCK_STATION         },
 
  137     { STR_STATION_BUILD_BUS_ORIENTATION,         STR_STATION_BUILD_TRUCK_ORIENTATION          },
 
  138     { STR_STATION_BUILD_BUS_ORIENTATION_TOOLTIP, STR_STATION_BUILD_TRUCK_ORIENTATION_TOOLTIP  },
 
  140     SPR_CURSOR_ROAD_NESW,
 
  141     SPR_CURSOR_ROAD_NWSE,
 
  145     STR_ERROR_CAN_T_BUILD_TRAMWAY_HERE,
 
  146     STR_ERROR_CAN_T_REMOVE_TRAMWAY_FROM,
 
  147     STR_ERROR_CAN_T_BUILD_TRAM_DEPOT,
 
  148     { STR_ERROR_CAN_T_BUILD_PASSENGER_TRAM_STATION,         STR_ERROR_CAN_T_BUILD_CARGO_TRAM_STATION         },
 
  149     { STR_ERROR_CAN_T_REMOVE_PASSENGER_TRAM_STATION,        STR_ERROR_CAN_T_REMOVE_CARGO_TRAM_STATION        },
 
  150     { STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION,         STR_STATION_BUILD_CARGO_TRAM_ORIENTATION         },
 
  151     { STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION_TOOLTIP, STR_STATION_BUILD_CARGO_TRAM_ORIENTATION_TOOLTIP },
 
  153     SPR_CURSOR_TRAMWAY_NESW,
 
  154     SPR_CURSOR_TRAMWAY_NWSE,
 
  177   if (result.
Failed()) 
return;
 
  201   if (result.
Failed()) 
return;
 
  206   TileArea roadstop_area(tile, 
GB(p1, 0, 8), 
GB(p1, 8, 8));
 
  226   uint8 ddir = _road_station_picker_orientation;
 
  227   SB(p2, 16, 16, INVALID_STATION); 
 
  249     if (_road_station_picker_orientation < 
DIAGDIR_END) { 
 
  267     if (_road_station_picker_orientation < 
DIAGDIR_END) { 
 
  276 typedef void OnButtonClick(
Window *w);
 
  340     if (!gui_scope) 
return;
 
  365     switch (clicked_widget) {
 
  409     _one_way_button_clicked = 
false;
 
  434           ShowRoadDepotPicker(
this);
 
  459         SetSelectionRed(
false);
 
  480       default: NOT_REACHED();
 
  498         _place_road_flag = RF_DIR_X;
 
  499         if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X;
 
  504         _place_road_flag = RF_DIR_Y;
 
  505         if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y;
 
  510         _place_road_flag = RF_NONE;
 
  511         if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X;
 
  512         if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y;
 
  521         DoCommandP(tile, _cur_roadtype << 2 | _road_depot_orientation, 0,
 
  542       default: NOT_REACHED();
 
  569     switch (select_proc) {
 
  571         _place_road_flag &= ~RF_END_HALFROAD_X;
 
  572         if (pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
 
  576         _place_road_flag &= ~RF_END_HALFROAD_Y;
 
  577         if (pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
 
  581         _place_road_flag &= ~(RF_END_HALFROAD_Y | RF_END_HALFROAD_X);
 
  582         if (pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
 
  583         if (pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
 
  588             ( (_tile_fract_coords.x < _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) < 16) ||
 
  589             (_tile_fract_coords.x > _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) > 16) ))) {
 
  591           _place_road_flag &= ~RF_DIR_Y;
 
  594           _place_road_flag |= RF_DIR_Y;
 
  609       switch (select_proc) {
 
  610         default: NOT_REACHED();
 
  627           _place_road_flag = (
RoadFlags)((_place_road_flag & RF_DIR_Y) ? (_place_road_flag & 0x07) : (_place_road_flag >> 3));
 
  629           DoCommandP(start_tile, end_tile, _place_road_flag | (_cur_roadtype << 3) | (_one_way_button_clicked << 5),
 
  681   switch (_game_mode) {
 
  683       extern RoadType _last_built_roadtype;
 
  700 static Hotkey roadtoolbar_hotkeys[] = {
 
  717 static const NWidgetPart _nested_build_road_widgets[] = {
 
  754   _nested_build_road_widgets, 
lengthof(_nested_build_road_widgets),
 
  755   &BuildRoadToolbarWindow::hotkeys
 
  758 static const NWidgetPart _nested_build_tramway_widgets[] = {
 
  794   _nested_build_tramway_widgets, 
lengthof(_nested_build_tramway_widgets),
 
  795   &BuildRoadToolbarWindow::hotkeys
 
  808   _cur_roadtype = roadtype;
 
  811   return AllocateWindowDescFront<BuildRoadToolbarWindow>(roadtype == 
ROADTYPE_ROAD ? &_build_road_desc : &_build_tramway_desc, 
TRANSPORT_ROAD);
 
  814 static const NWidgetPart _nested_build_road_scen_widgets[] = {
 
  842   WDP_AUTO, 
"toolbar_road_scen", 0, 0,
 
  845   _nested_build_road_scen_widgets, 
lengthof(_nested_build_road_scen_widgets),
 
  846   &BuildRoadToolbarWindow::hotkeys
 
  856   return AllocateWindowDescFront<BuildRoadToolbarWindow>(&_build_road_scen_desc, 
TRANSPORT_ROAD);
 
  866       this->GetWidget<NWidgetCore>(
WID_BROD_CAPTION)->widget_data = STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION;
 
  908 static const NWidgetPart _nested_build_road_depot_widgets[] = {
 
  942   _nested_build_road_depot_widgets, 
lengthof(_nested_build_road_depot_widgets)
 
  945 static void ShowRoadDepotPicker(
Window *parent)
 
  966     this->GetWidget<NWidgetCore>(
WID_BROS_CAPTION)->widget_data = _road_type_infos[_cur_roadtype].picker_title[rs];
 
  988       SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
 
 1093                       SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
 
 1095                       SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
 
 1106   _nested_rv_station_picker_widgets, 
lengthof(_nested_rv_station_picker_widgets)
 
 1114 void InitializeRoadGui()
 
 1117   _road_station_picker_orientation = 
DIAGDIR_NW;