49 /** Draw small boxes of cargo amount and ratings data at the given |
51 /** Draw small boxes of cargo amount and ratings data at the given |
50 * coordinates. If amount exceeds 576 units, it is shown 'full', same |
52 * coordinates. If amount exceeds 576 units, it is shown 'full', same |
51 * goes for the rating: at above 90% orso (224) it is also 'full' |
53 * goes for the rating: at above 90% orso (224) it is also 'full' |
52 * Each cargo-bar is 16 pixels wide and 6 pixels high |
54 * Each cargo-bar is 16 pixels wide and 6 pixels high |
53 * Each rating 14 pixels wide and 1 pixel high and is 1 pixel below the cargo-bar |
55 * Each rating 14 pixels wide and 1 pixel high and is 1 pixel below the cargo-bar |
54 * @param x,y X/Y coordinate to draw the box at |
56 * @param x coordinate to draw the box at |
|
57 * @param y coordinate to draw the box at |
55 * @param type Cargo type |
58 * @param type Cargo type |
56 * @param amount Cargo amount |
59 * @param amount Cargo amount |
57 * @param rating ratings data for that particular cargo */ |
60 * @param rating ratings data for that particular cargo */ |
58 static void StationsWndShowStationRating(int x, int y, CargoID type, uint amount, byte rating) |
61 static void StationsWndShowStationRating(int x, int y, CargoID type, uint amount, byte rating) |
59 { |
62 { |
318 DoDrawString(sl->flags & SL_ORDER ? DOWNARROW : UPARROW, 69, 26, 0x10); |
321 DoDrawString(sl->flags & SL_ORDER ? DOWNARROW : UPARROW, 69, 26, 0x10); |
319 |
322 |
320 int cg_ofst; |
323 int cg_ofst; |
321 int x = 89; |
324 int x = 89; |
322 int y = 14; |
325 int y = 14; |
323 int xb = 2; // offset from left of widget |
326 int xb = 2; ///< offset from left of widget |
324 |
327 |
325 uint i = 0; |
328 uint i = 0; |
326 for (CargoID c = 0; c < NUM_CARGO; c++) { |
329 for (CargoID c = 0; c < NUM_CARGO; c++) { |
327 const CargoSpec *cs = GetCargo(c); |
330 const CargoSpec *cs = GetCargo(c); |
328 if (!cs->IsValid()) continue; |
331 if (!cs->IsValid()) continue; |
361 |
364 |
362 SetDParam(0, st->index); |
365 SetDParam(0, st->index); |
363 SetDParam(1, st->facilities); |
366 SetDParam(1, st->facilities); |
364 x = DrawString(xb, y, STR_3049_0, 0) + 5; |
367 x = DrawString(xb, y, STR_3049_0, 0) + 5; |
365 |
368 |
366 // show cargo waiting and station ratings |
369 /* show cargo waiting and station ratings */ |
367 for (CargoID j = 0; j < NUM_CARGO; j++) { |
370 for (CargoID j = 0; j < NUM_CARGO; j++) { |
368 uint amount = GB(st->goods[j].waiting_acceptance, 0, 12); |
371 uint amount = GB(st->goods[j].waiting_acceptance, 0, 12); |
369 if (amount != 0) { |
372 if (amount != 0) { |
370 StationsWndShowStationRating(x, y, j, amount, st->goods[j].rating); |
373 StationsWndShowStationRating(x, y, j, amount, st->goods[j].rating); |
371 x += 20; |
374 x += 20; |
508 } |
511 } |
509 break; |
512 break; |
510 |
513 |
511 case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */ |
514 case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */ |
512 if (sl->sort_type != e->we.dropdown.index) { |
515 if (sl->sort_type != e->we.dropdown.index) { |
513 // value has changed -> resort |
516 /* value has changed -> resort */ |
514 sl->sort_type = e->we.dropdown.index; |
517 sl->sort_type = e->we.dropdown.index; |
515 station_sort.criteria = sl->sort_type; |
518 station_sort.criteria = sl->sort_type; |
516 sl->flags |= SL_RESORT; |
519 sl->flags |= SL_RESORT; |
517 } |
520 } |
518 SetWindowDirty(w); |
521 SetWindowDirty(w); |