src/rail_gui.cpp
changeset 9652 0405e98d8e96
parent 9607 5a5728fb702a
child 9762 5e591b9665a2
equal deleted inserted replaced
9651:1285c0b3a4de 9652:0405e98d8e96
   837  */
   837  */
   838 void ShowBuildRailToolbar(RailType railtype, int button)
   838 void ShowBuildRailToolbar(RailType railtype, int button)
   839 {
   839 {
   840 	BuildRailToolbarWindow *w;
   840 	BuildRailToolbarWindow *w;
   841 
   841 
   842 	if (!IsValidPlayer(_current_player)) return;
   842 	if (!IsValidPlayerID(_current_player)) return;
   843 	if (!ValParamRailtype(railtype)) return;
   843 	if (!ValParamRailtype(railtype)) return;
   844 
   844 
   845 	// don't recreate the window if we're clicking on a button and the window exists.
   845 	// don't recreate the window if we're clicking on a button and the window exists.
   846 	if (button < 0 || !(w = dynamic_cast<BuildRailToolbarWindow*>(FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL)))) {
   846 	if (button < 0 || !(w = dynamic_cast<BuildRailToolbarWindow*>(FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL)))) {
   847 		DeleteWindowByClass(WC_BUILD_TOOLBAR);
   847 		DeleteWindowByClass(WC_BUILD_TOOLBAR);
  1696 }
  1696 }
  1697 
  1697 
  1698 /** Set the initial (default) railtype to use */
  1698 /** Set the initial (default) railtype to use */
  1699 static void SetDefaultRailGui()
  1699 static void SetDefaultRailGui()
  1700 {
  1700 {
  1701 	if (_local_player == PLAYER_SPECTATOR || !IsValidPlayer(_local_player)) return;
  1701 	if (_local_player == PLAYER_SPECTATOR || !IsValidPlayerID(_local_player)) return;
  1702 
  1702 
  1703 	extern RailType _last_built_railtype;
  1703 	extern RailType _last_built_railtype;
  1704 	RailType rt = (RailType)_settings_client.gui.default_rail_type;
  1704 	RailType rt = (RailType)_settings_client.gui.default_rail_type;
  1705 	if (rt >= RAILTYPE_END) {
  1705 	if (rt >= RAILTYPE_END) {
  1706 		if (rt == RAILTYPE_END + 2) {
  1706 		if (rt == RAILTYPE_END + 2) {