src/train_gui.cpp
changeset 7492 35acee076719
parent 7488 6f51ddf4c225
child 7530 bfeada535347
equal deleted inserted replaced
7491:595b714c8719 7492:35acee076719
    98 				}
    98 				}
    99 			}
    99 			}
   100 		}
   100 		}
   101 		dx += width;
   101 		dx += width;
   102 
   102 
   103 		v = v->next;
   103 		v = v->Next();
   104 	} while (dx < count && v != NULL);
   104 	} while (dx < count && v != NULL);
   105 
   105 
   106 	if (highlight_l != highlight_r) {
   106 	if (highlight_l != highlight_r) {
   107 		/* Draw the highlight. Now done after drawing all the engines, as
   107 		/* Draw the highlight. Now done after drawing all the engines, as
   108 		 * the next engine after the highlight could overlap it. */
   108 		 * the next engine after the highlight could overlap it. */
   174 		}
   174 		}
   175 
   175 
   176 		do {
   176 		do {
   177 			act_cargo[u->cargo_type] += u->cargo.Count();
   177 			act_cargo[u->cargo_type] += u->cargo.Count();
   178 			max_cargo[u->cargo_type] += u->cargo_cap;
   178 			max_cargo[u->cargo_type] += u->cargo_cap;
   179 		} while ((u = u->next) != NULL);
   179 		} while ((u = u->Next()) != NULL);
   180 
   180 
   181 		/* Set scroll-amount seperately from counting, as to not compute num double
   181 		/* Set scroll-amount seperately from counting, as to not compute num double
   182 		 * for more carriages of the same type
   182 		 * for more carriages of the same type
   183 		 */
   183 		 */
   184 		for (CargoID i = 0; i < NUM_CARGO; i++) {
   184 		for (CargoID i = 0; i < NUM_CARGO; i++) {
   186 		}
   186 		}
   187 		num++; // needs one more because first line is description string
   187 		num++; // needs one more because first line is description string
   188 	} else {
   188 	} else {
   189 		do {
   189 		do {
   190 			if (!IsArticulatedPart(u) || u->cargo_cap != 0) num++;
   190 			if (!IsArticulatedPart(u) || u->cargo_cap != 0) num++;
   191 		} while ((u = u->next) != NULL);
   191 		} while ((u = u->Next()) != NULL);
   192 	}
   192 	}
   193 
   193 
   194 	SetVScrollCount(w, num);
   194 	SetVScrollCount(w, num);
   195 
   195 
   196 	DisableWindowWidget(w, det_tab + 9);
   196 	DisableWindowWidget(w, det_tab + 9);
   247 				u = v;
   247 				u = v;
   248 				do {
   248 				do {
   249 					SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
   249 					SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
   250 					DrawSprite(u->GetImage(DIR_W), pal, x + WagonLengthToPixels(4 + dx), y + 6 + (is_custom_sprite(RailVehInfo(u->engine_type)->image_index) ? _traininfo_vehicle_pitch : 0));
   250 					DrawSprite(u->GetImage(DIR_W), pal, x + WagonLengthToPixels(4 + dx), y + 6 + (is_custom_sprite(RailVehInfo(u->engine_type)->image_index) ? _traininfo_vehicle_pitch : 0));
   251 					dx += u->u.rail.cached_veh_length;
   251 					dx += u->u.rail.cached_veh_length;
   252 					u = u->next;
   252 					u = u->Next();
   253 				} while (u != NULL && IsArticulatedPart(u) && u->cargo_cap == 0);
   253 				} while (u != NULL && IsArticulatedPart(u) && u->cargo_cap == 0);
   254 
   254 
   255 				px = x + WagonLengthToPixels(dx) + 2;
   255 				px = x + WagonLengthToPixels(dx) + 2;
   256 				py = y + 2;
   256 				py = y + 2;
   257 				switch (det_tab) {
   257 				switch (det_tab) {
   269 
   269 
   270 				v = u;
   270 				v = u;
   271 			} else {
   271 			} else {
   272 				/* Move to the next line */
   272 				/* Move to the next line */
   273 				do {
   273 				do {
   274 					v = v->next;
   274 					v = v->Next();
   275 				} while (v != NULL && IsArticulatedPart(v) && v->cargo_cap == 0);
   275 				} while (v != NULL && IsArticulatedPart(v) && v->cargo_cap == 0);
   276 			}
   276 			}
   277 			if (v == NULL) return;
   277 			if (v == NULL) return;
   278 		}
   278 		}
   279 	} else {
   279 	} else {