train_gui.c
changeset 3355 a653b8e47f27
parent 3256 a23d94f568b7
child 3384 81fbe6d4a861
equal deleted inserted replaced
3354:88222b8dafef 3355:a653b8e47f27
   175 	for (j = 0; j < NUM_TRAIN_ENGINES; j++) {
   175 	for (j = 0; j < NUM_TRAIN_ENGINES; j++) {
   176 		EngineID i = GetRailVehAtPosition(j);
   176 		EngineID i = GetRailVehAtPosition(j);
   177 		const Engine *e = GetEngine(i);
   177 		const Engine *e = GetEngine(i);
   178 		const RailVehicleInfo *rvi = RailVehInfo(i);
   178 		const RailVehicleInfo *rvi = RailVehInfo(i);
   179 
   179 
   180 		if (!IsCompatibleRail(e->railtype, railtype) || !(rvi->flags & RVI_WAGON) != is_engine ||
   180 		if (!HasPowerOnRail(e->railtype, railtype) || !(rvi->flags & RVI_WAGON) != is_engine ||
   181 				!HASBIT(e->player_avail, _local_player))
   181 				!HASBIT(e->player_avail, _local_player))
   182 			continue;
   182 			continue;
   183 
   183 
   184 		if (*sel == 0)
   184 		if (*sel == 0)
   185 			*selected_id = i;
   185 			*selected_id = i;
   206 			RailType railtype = WP(w,buildtrain_d).railtype;
   206 			RailType railtype = WP(w,buildtrain_d).railtype;
   207 			EngineID i;
   207 			EngineID i;
   208 
   208 
   209 			for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
   209 			for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
   210 				const Engine *e = GetEngine(i);
   210 				const Engine *e = GetEngine(i);
   211 				if (IsCompatibleRail(e->railtype, railtype)
   211 				if (HasPowerOnRail(e->railtype, railtype)
   212 				    && HASBIT(e->player_avail, _local_player))
   212 				    && HASBIT(e->player_avail, _local_player))
   213 					count++;
   213 					count++;
   214 			}
   214 			}
   215 			SetVScrollCount(w, count);
   215 			SetVScrollCount(w, count);
   216 		}
   216 		}