src/rail_gui.cpp
branchcpp_gui
changeset 6285 187e3ef04cc9
parent 6268 4b5241e5dd10
child 6298 c30fe89622df
equal deleted inserted replaced
6284:45d0233e7d79 6285:187e3ef04cc9
   794 		case 6:
   794 		case 6:
   795 		case 7:
   795 		case 7:
   796 		case 8:
   796 		case 8:
   797 		case 9:
   797 		case 9:
   798 		case 10:
   798 		case 10:
   799 		case 11:
   799 		case 11: {
   800 			w->RaiseWidget(_railstation.numtracks + 4);
   800 			w->RaiseWidget(_railstation.numtracks + 4);
   801 			w->RaiseWidget(19);
   801 			w->RaiseWidget(19);
       
   802 
   802 			_railstation.numtracks = (e->we.click.widget - 5) + 1;
   803 			_railstation.numtracks = (e->we.click.widget - 5) + 1;
   803 			_railstation.dragdrop = false;
   804 			_railstation.dragdrop = false;
       
   805 
       
   806 			const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL;
       
   807 			if (statspec != NULL && HASBIT(statspec->disallowed_lengths, _railstation.platlength - 1)) {
       
   808 				/* The previously selected number of platforms in invalid */
       
   809 				for (uint i = 0; i < 7; i++) {
       
   810 					if (!HASBIT(statspec->disallowed_lengths, i)) {
       
   811 						w->RaiseWidget(_railstation.platlength + 11);
       
   812 						_railstation.platlength = i + 1;
       
   813 						break;
       
   814 					}
       
   815 				}
       
   816 			}
       
   817 
   804 			w->LowerWidget(_railstation.platlength + 11);
   818 			w->LowerWidget(_railstation.platlength + 11);
   805 			w->LowerWidget(_railstation.numtracks + 4);
   819 			w->LowerWidget(_railstation.numtracks + 4);
   806 			SndPlayFx(SND_15_BEEP);
   820 			SndPlayFx(SND_15_BEEP);
   807 			w->SetDirty();
   821 			w->SetDirty();
   808 			break;
   822 			break;
       
   823 		}
   809 
   824 
   810 		case 12:
   825 		case 12:
   811 		case 13:
   826 		case 13:
   812 		case 14:
   827 		case 14:
   813 		case 15:
   828 		case 15:
   814 		case 16:
   829 		case 16:
   815 		case 17:
   830 		case 17:
   816 		case 18:
   831 		case 18: {
   817 			w->RaiseWidget(_railstation.platlength + 11);
   832 			w->RaiseWidget(_railstation.platlength + 11);
   818 			w->RaiseWidget(19);
   833 			w->RaiseWidget(19);
       
   834 
   819 			_railstation.platlength = (e->we.click.widget - 12) + 1;
   835 			_railstation.platlength = (e->we.click.widget - 12) + 1;
   820 			_railstation.dragdrop = false;
   836 			_railstation.dragdrop = false;
       
   837 
       
   838 			const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL;
       
   839 			if (statspec != NULL && HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
       
   840 				/* The previously selected number of tracks in invalid */
       
   841 				for (uint i = 0; i < 7; i++) {
       
   842 					if (!HASBIT(statspec->disallowed_platforms, i)) {
       
   843 						w->RaiseWidget(_railstation.numtracks + 4);
       
   844 						_railstation.numtracks = i + 1;
       
   845 						break;
       
   846 					}
       
   847 				}
       
   848 			}
       
   849 
   821 			w->LowerWidget(_railstation.platlength + 11);
   850 			w->LowerWidget(_railstation.platlength + 11);
   822 			w->LowerWidget(_railstation.numtracks + 4);
   851 			w->LowerWidget(_railstation.numtracks + 4);
   823 			SndPlayFx(SND_15_BEEP);
   852 			SndPlayFx(SND_15_BEEP);
   824 			w->SetDirty();
   853 			w->SetDirty();
   825 			break;
   854 			break;
       
   855 		}
   826 
   856 
   827 		case 19:
   857 		case 19:
   828 			_railstation.dragdrop ^= true;
   858 			_railstation.dragdrop ^= true;
   829 			w->ToggleWidgetLoweredState(19);
   859 			w->ToggleWidgetLoweredState(19);
   830 			w->SetWidgetLoweredState(_railstation.numtracks + 4, !_railstation.dragdrop);
   860 			w->SetWidgetLoweredState(_railstation.numtracks + 4, !_railstation.dragdrop);