train_gui.c
changeset 1926 530480d14685
parent 1922 bda6f85eefaa
child 1938 70baf462aff1
equal deleted inserted replaced
1925:e0c7c3fca6a5 1926:530480d14685
    24  * @param engine_number the engine of which to draw the info of
    24  * @param engine_number the engine of which to draw the info of
    25  */
    25  */
    26 void DrawTrainEnginePurchaseInfo(int x, int y, EngineID engine_number)
    26 void DrawTrainEnginePurchaseInfo(int x, int y, EngineID engine_number)
    27 {
    27 {
    28 	const RailVehicleInfo *rvi = RailVehInfo(engine_number);
    28 	const RailVehicleInfo *rvi = RailVehInfo(engine_number);
    29 	Engine *e = &_engines[engine_number];
    29 	const Engine* e = GetEngine(engine_number);
    30 	int multihead = (rvi->flags&RVI_MULTIHEAD?1:0);
    30 	int multihead = (rvi->flags&RVI_MULTIHEAD?1:0);
    31 	YearMonthDay ymd;
    31 	YearMonthDay ymd;
    32 	ConvertDayToYMD(&ymd, e->intro_date);
    32 	ConvertDayToYMD(&ymd, e->intro_date);
    33 
    33 
    34 	/* Purchase Cost - Engine weight */
    34 	/* Purchase Cost - Engine weight */
   155 	int *selected_id, byte railtype, byte show_max, bool is_engine)
   155 	int *selected_id, byte railtype, byte show_max, bool is_engine)
   156 {
   156 {
   157 	int i;
   157 	int i;
   158 
   158 
   159 	for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
   159 	for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
   160 		const Engine *e = DEREF_ENGINE(i);
   160 		const Engine *e = GetEngine(i);
   161 		const RailVehicleInfo *rvi = RailVehInfo(i);
   161 		const RailVehicleInfo *rvi = RailVehInfo(i);
   162 
   162 
   163 		if (e->railtype != railtype || !(rvi->flags & RVI_WAGON) != is_engine ||
   163 		if (e->railtype != railtype || !(rvi->flags & RVI_WAGON) != is_engine ||
   164 				!HASBIT(e->player_avail, _local_player))
   164 				!HASBIT(e->player_avail, _local_player))
   165 			continue;
   165 			continue;
   189 			int count = 0;
   189 			int count = 0;
   190 			byte railtype = WP(w,buildtrain_d).railtype;
   190 			byte railtype = WP(w,buildtrain_d).railtype;
   191 			int i;
   191 			int i;
   192 
   192 
   193 			for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
   193 			for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
   194 				const Engine *e = DEREF_ENGINE(i);
   194 				const Engine *e = GetEngine(i);
   195 				if (e->railtype == railtype
   195 				if (e->railtype == railtype
   196 				    && HASBIT(e->player_avail, _local_player))
   196 				    && HASBIT(e->player_avail, _local_player))
   197 					count++;
   197 					count++;
   198 			}
   198 			}
   199 			SetVScrollCount(w, count);
   199 			SetVScrollCount(w, count);