rail_gui.c
branch0.5
changeset 5394 58afc8e5ff3e
parent 5231 3bf4c8b8ddeb
child 5459 74356913b47d
equal deleted inserted replaced
5393:55e249a41db4 5394:58afc8e5ff3e
   692 		int rad;
   692 		int rad;
   693 		uint bits;
   693 		uint bits;
   694 		bool newstations = _railstation.newstations;
   694 		bool newstations = _railstation.newstations;
   695 		int y_offset;
   695 		int y_offset;
   696 		DrawPixelInfo tmp_dpi, *old_dpi;
   696 		DrawPixelInfo tmp_dpi, *old_dpi;
       
   697 		const StationSpec *statspec = newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL;
   697 
   698 
   698 		if (WP(w,def_d).close) return;
   699 		if (WP(w,def_d).close) return;
   699 
   700 
   700 		if (_railstation.dragdrop) {
   701 		if (_railstation.dragdrop) {
   701 			SetTileSelectSize(1, 1);
   702 			SetTileSelectSize(1, 1);
   710 		rad = (_patches.modified_catchment) ? CA_TRAIN : 4;
   711 		rad = (_patches.modified_catchment) ? CA_TRAIN : 4;
   711 
   712 
   712 		if (_station_show_coverage)
   713 		if (_station_show_coverage)
   713 			SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
   714 			SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
   714 
   715 
   715 		/* Update buttons for correct spread value */
   716 		for (bits = 0; bits < 7; bits++) {
   716 		for (bits = _patches.station_spread; bits < 7; bits++) {
   717 			bool disable = bits >= _patches.station_spread;
   717 			DisableWindowWidget(w, bits + 5);
   718 			if (statspec == NULL) {
   718 			DisableWindowWidget(w, bits + 12);
   719 				SetWindowWidgetDisabledState(w, bits +  5, disable);
   719 		}
   720 				SetWindowWidgetDisabledState(w, bits + 12, disable);
   720 
   721 			} else {
   721 		if (newstations) {
   722 				SetWindowWidgetDisabledState(w, bits +  5, HASBIT(statspec->disallowed_platforms, bits) || disable);
   722 			const StationSpec *statspec = GetCustomStationSpec(_railstation.station_class, _railstation.station_type);
   723 				SetWindowWidgetDisabledState(w, bits + 12, HASBIT(statspec->disallowed_lengths,   bits) || disable);
   723 
       
   724 			for (bits = 0; bits < 7; bits++) {
       
   725 				if (statspec == NULL) {
       
   726 					EnableWindowWidget(w, bits +  5);
       
   727 					EnableWindowWidget(w, bits + 12);
       
   728 				} else {
       
   729 					SetWindowWidgetDisabledState(w, bits +  5, HASBIT(statspec->disallowed_platforms, bits));
       
   730 					SetWindowWidgetDisabledState(w, bits + 12, HASBIT(statspec->disallowed_lengths,   bits));
       
   731 				}
       
   732 			}
   724 			}
   733 		}
   725 		}
   734 
   726 
   735 		SetDParam(0, GetStationClassName(_railstation.station_class));
   727 		SetDParam(0, GetStationClassName(_railstation.station_class));
   736 		DrawWindowWidgets(w);
   728 		DrawWindowWidgets(w);