rail_gui.c
branch0.5
changeset 5459 74356913b47d
parent 5394 58afc8e5ff3e
child 5542 c719509fb0b7
equal deleted inserted replaced
5458:0a52d7d0e410 5459:74356913b47d
   793 		case 6:
   793 		case 6:
   794 		case 7:
   794 		case 7:
   795 		case 8:
   795 		case 8:
   796 		case 9:
   796 		case 9:
   797 		case 10:
   797 		case 10:
   798 		case 11:
   798 		case 11: {
       
   799 			const StationSpec *statspec;
   799 			RaiseWindowWidget(w, _railstation.numtracks + 4);
   800 			RaiseWindowWidget(w, _railstation.numtracks + 4);
   800 			RaiseWindowWidget(w, 19);
   801 			RaiseWindowWidget(w, 19);
       
   802 
   801 			_railstation.numtracks = (e->we.click.widget - 5) + 1;
   803 			_railstation.numtracks = (e->we.click.widget - 5) + 1;
   802 			_railstation.dragdrop = false;
   804 			_railstation.dragdrop = false;
       
   805 
       
   806 			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 				uint i;
       
   810 				for (i = 0; i < 7; i++) {
       
   811 					if (!HASBIT(statspec->disallowed_lengths, i)) {
       
   812 						RaiseWindowWidget(w, _railstation.platlength + 11);
       
   813 						_railstation.platlength = i + 1;
       
   814 						break;
       
   815 					}
       
   816 				}
       
   817 			}
       
   818 
   803 			LowerWindowWidget(w, _railstation.platlength + 11);
   819 			LowerWindowWidget(w, _railstation.platlength + 11);
   804 			LowerWindowWidget(w, _railstation.numtracks + 4);
   820 			LowerWindowWidget(w, _railstation.numtracks + 4);
   805 			SndPlayFx(SND_15_BEEP);
   821 			SndPlayFx(SND_15_BEEP);
   806 			SetWindowDirty(w);
   822 			SetWindowDirty(w);
   807 			break;
   823 			break;
       
   824 		}
   808 
   825 
   809 		case 12:
   826 		case 12:
   810 		case 13:
   827 		case 13:
   811 		case 14:
   828 		case 14:
   812 		case 15:
   829 		case 15:
   813 		case 16:
   830 		case 16:
   814 		case 17:
   831 		case 17:
   815 		case 18:
   832 		case 18: {
       
   833 			const StationSpec *statspec;
   816 			RaiseWindowWidget(w, _railstation.platlength + 11);
   834 			RaiseWindowWidget(w, _railstation.platlength + 11);
   817 			RaiseWindowWidget(w, 19);
   835 			RaiseWindowWidget(w, 19);
       
   836 
   818 			_railstation.platlength = (e->we.click.widget - 12) + 1;
   837 			_railstation.platlength = (e->we.click.widget - 12) + 1;
   819 			_railstation.dragdrop = false;
   838 			_railstation.dragdrop = false;
       
   839 
       
   840 			statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL;
       
   841 			if (statspec != NULL && HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
       
   842 				/* The previously selected number of tracks in invalid */
       
   843 				uint i;
       
   844 				for (i = 0; i < 7; i++) {
       
   845 					if (!HASBIT(statspec->disallowed_platforms, i)) {
       
   846 						RaiseWindowWidget(w, _railstation.numtracks + 4);
       
   847 						_railstation.numtracks = i + 1;
       
   848 						break;
       
   849 					}
       
   850 				}
       
   851 			}
       
   852 
   820 			LowerWindowWidget(w, _railstation.platlength + 11);
   853 			LowerWindowWidget(w, _railstation.platlength + 11);
   821 			LowerWindowWidget(w, _railstation.numtracks + 4);
   854 			LowerWindowWidget(w, _railstation.numtracks + 4);
   822 			SndPlayFx(SND_15_BEEP);
   855 			SndPlayFx(SND_15_BEEP);
   823 			SetWindowDirty(w);
   856 			SetWindowDirty(w);
   824 			break;
   857 			break;
       
   858 		}
   825 
   859 
   826 		case 19:
   860 		case 19:
   827 			_railstation.dragdrop ^= true;
   861 			_railstation.dragdrop ^= true;
   828 			ToggleWidgetLoweredState(w, 19);
   862 			ToggleWidgetLoweredState(w, 19);
   829 			SetWindowWidgetLoweredState(w, _railstation.numtracks + 4, !_railstation.dragdrop);
   863 			SetWindowWidgetLoweredState(w, _railstation.numtracks + 4, !_railstation.dragdrop);