vehicle_gui.c
changeset 3414 d728e3793041
parent 3393 c40975f04842
child 3492 265e806ed58e
equal deleted inserted replaced
3413:bebbb9d71cc8 3414:d728e3793041
   471 		if (*sel == 0) *selected_id = j;
   471 		if (*sel == 0) *selected_id = j;
   472 
   472 
   473 
   473 
   474 		colour = *sel == 0 ? 0xC : 0x10;
   474 		colour = *sel == 0 ? 0xC : 0x10;
   475 		if (!(ENGINE_AVAILABLE && show_outdated && RailVehInfo(i)->power && e->railtype == railtype)) {
   475 		if (!(ENGINE_AVAILABLE && show_outdated && RailVehInfo(i)->power && e->railtype == railtype)) {
   476 			if ((!HasPowerOnRail(e->railtype, railtype) && show_compatible)
   476 			if ((!IsCompatibleRail(e->railtype, railtype) && show_compatible)
   477 				|| (e->railtype != railtype && !show_compatible)
   477 				|| (e->railtype != railtype && !show_compatible)
   478 				|| !(rvi->flags & RVI_WAGON) != is_engine ||
   478 				|| !(rvi->flags & RVI_WAGON) != is_engine ||
   479 				!HASBIT(e->player_avail, _local_player))
   479 				!HASBIT(e->player_avail, _local_player))
   480 				continue;
   480 				continue;
   481 		} /*else {
   481 		} /*else {
   527 
   527 
   528 				// left window contains compatible engines while right window only contains engines of the selected type
   528 				// left window contains compatible engines while right window only contains engines of the selected type
   529 				if (ENGINE_AVAILABLE && (
   529 				if (ENGINE_AVAILABLE && (
   530 							(RailVehInfo(eid)->power != 0 && WP(w, replaceveh_d).wagon_btnstate) ||
   530 							(RailVehInfo(eid)->power != 0 && WP(w, replaceveh_d).wagon_btnstate) ||
   531 							(RailVehInfo(eid)->power == 0 && !WP(w, replaceveh_d).wagon_btnstate))) {
   531 							(RailVehInfo(eid)->power == 0 && !WP(w, replaceveh_d).wagon_btnstate))) {
   532 					if (HasPowerOnRail(e->railtype, railtype) && (_player_num_engines[eid] > 0 || EngineHasReplacementForPlayer(p, eid))) {
   532 					if (IsCompatibleRail(e->railtype, railtype) && (_player_num_engines[eid] > 0 || EngineHasReplacementForPlayer(p, eid))) {
   533 						if (sel[0] == count) selected_id[0] = eid;
   533 						if (sel[0] == count) selected_id[0] = eid;
   534 						count++;
   534 						count++;
   535 					}
   535 					}
   536 					if (e->railtype == railtype && HASBIT(e->player_avail, _local_player)) {
   536 					if (e->railtype == railtype && HASBIT(e->player_avail, _local_player)) {
   537 						if (sel[1] == count2) selected_id[1] = eid;
   537 						if (sel[1] == count2) selected_id[1] = eid;
  1006 			break;
  1006 			break;
  1007 		}
  1007 		}
  1008 
  1008 
  1009 		case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
  1009 		case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
  1010 			_railtype_selected_in_replace_gui = e->dropdown.index;
  1010 			_railtype_selected_in_replace_gui = e->dropdown.index;
       
  1011 			/* Reset scrollbar positions */
       
  1012 			w->vscroll.pos  = 0;
       
  1013 			w->vscroll2.pos = 0;
  1011 			SetWindowDirty(w);
  1014 			SetWindowDirty(w);
  1012 			break;
  1015 			break;
  1013 
  1016 
  1014 		case WE_RESIZE:
  1017 		case WE_RESIZE:
  1015 			w->vscroll.cap  += e->sizing.diff.y / (int)w->resize.step_height;
  1018 			w->vscroll.cap  += e->sizing.diff.y / (int)w->resize.step_height;