src/rail_gui.cpp
changeset 6247 7d81e3a5d803
parent 6207 a04057330c4d
child 6453 226bcddeba32
equal deleted inserted replaced
6246:75451000349d 6247:7d81e3a5d803
    43 	byte station_count;
    43 	byte station_count;
    44 } _railstation;
    44 } _railstation;
    45 
    45 
    46 
    46 
    47 static void HandleStationPlacement(TileIndex start, TileIndex end);
    47 static void HandleStationPlacement(TileIndex start, TileIndex end);
    48 static void ShowBuildTrainDepotPicker(void);
    48 static void ShowBuildTrainDepotPicker();
    49 static void ShowBuildWaypointPicker(void);
    49 static void ShowBuildWaypointPicker();
    50 static void ShowStationBuilder(void);
    50 static void ShowStationBuilder();
    51 
    51 
    52 void CcPlaySound1E(bool success, TileIndex tile, uint32 p1, uint32 p2)
    52 void CcPlaySound1E(bool success, TileIndex tile, uint32 p1, uint32 p2)
    53 {
    53 {
    54 	if (success) SndPlayTileFx(SND_20_SPLAT_2, tile);
    54 	if (success) SndPlayTileFx(SND_20_SPLAT_2, tile);
    55 }
    55 }
   346 		CMD_REMOVE_RAILROAD_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) :
   346 		CMD_REMOVE_RAILROAD_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) :
   347 		CMD_BUILD_RAILROAD_TRACK  | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK)
   347 		CMD_BUILD_RAILROAD_TRACK  | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK)
   348 	);
   348 	);
   349 }
   349 }
   350 
   350 
   351 static void HandleAutodirPlacement(void)
   351 static void HandleAutodirPlacement()
   352 {
   352 {
   353 	TileHighlightData *thd = &_thd;
   353 	TileHighlightData *thd = &_thd;
   354 	int trackstat = thd->drawstyle & 0xF; // 0..5
   354 	int trackstat = thd->drawstyle & 0xF; // 0..5
   355 
   355 
   356 	if (thd->drawstyle & HT_RAIL) { // one tile case
   356 	if (thd->drawstyle & HT_RAIL) { // one tile case
   359 	}
   359 	}
   360 
   360 
   361 	DoRailroadTrack(trackstat);
   361 	DoRailroadTrack(trackstat);
   362 }
   362 }
   363 
   363 
   364 static void HandleAutoSignalPlacement(void)
   364 static void HandleAutoSignalPlacement()
   365 {
   365 {
   366 	TileHighlightData *thd = &_thd;
   366 	TileHighlightData *thd = &_thd;
   367 	uint32 p2 = GB(thd->drawstyle, 0, 3); // 0..5
   367 	uint32 p2 = GB(thd->drawstyle, 0, 3); // 0..5
   368 
   368 
   369 	if (thd->drawstyle == HT_RECT) { // one tile case
   369 	if (thd->drawstyle == HT_RECT) { // one tile case
  1010 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
  1010 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
  1011 	_newstation_builder_widgets,
  1011 	_newstation_builder_widgets,
  1012 	StationBuildWndProc
  1012 	StationBuildWndProc
  1013 };
  1013 };
  1014 
  1014 
  1015 static void ShowStationBuilder(void)
  1015 static void ShowStationBuilder()
  1016 {
  1016 {
  1017 	Window *w;
  1017 	Window *w;
  1018 	if (GetNumStationClasses() <= 2 && GetNumCustomStations(STAT_CLASS_DFLT) == 1) {
  1018 	if (GetNumStationClasses() <= 2 && GetNumCustomStations(STAT_CLASS_DFLT) == 1) {
  1019 		w = AllocateWindowDesc(&_station_builder_desc);
  1019 		w = AllocateWindowDesc(&_station_builder_desc);
  1020 		_railstation.newstations = false;
  1020 		_railstation.newstations = false;
  1089 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
  1089 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
  1090 	_build_depot_widgets,
  1090 	_build_depot_widgets,
  1091 	BuildTrainDepotWndProc
  1091 	BuildTrainDepotWndProc
  1092 };
  1092 };
  1093 
  1093 
  1094 static void ShowBuildTrainDepotPicker(void)
  1094 static void ShowBuildTrainDepotPicker()
  1095 {
  1095 {
  1096 	AllocateWindowDesc(&_build_depot_desc);
  1096 	AllocateWindowDesc(&_build_depot_desc);
  1097 }
  1097 }
  1098 
  1098 
  1099 
  1099 
  1175 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
  1175 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
  1176 	_build_waypoint_widgets,
  1176 	_build_waypoint_widgets,
  1177 	BuildWaypointWndProc
  1177 	BuildWaypointWndProc
  1178 };
  1178 };
  1179 
  1179 
  1180 static void ShowBuildWaypointPicker(void)
  1180 static void ShowBuildWaypointPicker()
  1181 {
  1181 {
  1182 	Window *w = AllocateWindowDesc(&_build_waypoint_desc);
  1182 	Window *w = AllocateWindowDesc(&_build_waypoint_desc);
  1183 	w->hscroll.cap = 5;
  1183 	w->hscroll.cap = 5;
  1184 	w->hscroll.count = _waypoint_count;
  1184 	w->hscroll.count = _waypoint_count;
  1185 }
  1185 }
  1186 
  1186 
  1187 
  1187 
  1188 void InitializeRailGui(void)
  1188 void InitializeRailGui()
  1189 {
  1189 {
  1190 	_build_depot_direction = DIAGDIR_NW;
  1190 	_build_depot_direction = DIAGDIR_NW;
  1191 	_railstation.numtracks = 1;
  1191 	_railstation.numtracks = 1;
  1192 	_railstation.platlength = 1;
  1192 	_railstation.platlength = 1;
  1193 	_railstation.dragdrop = true;
  1193 	_railstation.dragdrop = true;