src/station_gui.cpp
changeset 6122 3359af5a1f54
parent 6091 c8827d9ae04a
child 6202 4ec72ee98c7d
equal deleted inserted replaced
6121:2aae24b0881f 6122:3359af5a1f54
    57  * @param amount Cargo amount
    57  * @param amount Cargo amount
    58  * @param rating ratings data for that particular cargo */
    58  * @param rating ratings data for that particular cargo */
    59 static void StationsWndShowStationRating(int x, int y, CargoID type, uint amount, byte rating)
    59 static void StationsWndShowStationRating(int x, int y, CargoID type, uint amount, byte rating)
    60 {
    60 {
    61 	const CargoSpec *cs = GetCargo(type);
    61 	const CargoSpec *cs = GetCargo(type);
    62 	if (cs->bitnum == 0xFF) return;
    62 	if (!cs->IsValid()) return;
    63 
    63 
    64 	int colour = cs->rating_colour;
    64 	int colour = cs->rating_colour;
    65 	uint w = (minu(amount, 576) + 5) / 36;
    65 	uint w = (minu(amount, 576) + 5) / 36;
    66 
    66 
    67 	/* Draw total cargo (limited) on station (fits into 16 pixels) */
    67 	/* Draw total cargo (limited) on station (fits into 16 pixels) */
   326 
   326 
   327 			for (i = 0; i < NUM_CARGO; i++) {
   327 			for (i = 0; i < NUM_CARGO; i++) {
   328 				cg_ofst = IsWindowWidgetLowered(w, i + STATIONLIST_WIDGET_CARGOSTART) ? 2 : 1;
   328 				cg_ofst = IsWindowWidgetLowered(w, i + STATIONLIST_WIDGET_CARGOSTART) ? 2 : 1;
   329 
   329 
   330 				const CargoSpec *cs = GetCargo(i);
   330 				const CargoSpec *cs = GetCargo(i);
   331 				if (cs->bitnum != 0xFF) {
   331 				if (cs->IsValid()) {
   332 					GfxFillRect(x + cg_ofst, y + cg_ofst, x + cg_ofst + 10 , y + cg_ofst + 7, cs->rating_colour);
   332 					GfxFillRect(x + cg_ofst, y + cg_ofst, x + cg_ofst + 10 , y + cg_ofst + 7, cs->rating_colour);
   333 					DrawStringCentered(x + 6 + cg_ofst, y + cg_ofst, cs->abbrev, 0x10);
   333 					DrawStringCentered(x + 6 + cg_ofst, y + cg_ofst, cs->abbrev, 0x10);
   334 				}
   334 				}
   335 				x += 14;
   335 				x += 14;
   336 			}
   336 			}