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 { |
317 DoDrawString(sl->flags & SL_ORDER ? DOWNARROW : UPARROW, 69, 26, 0x10); |
320 DoDrawString(sl->flags & SL_ORDER ? DOWNARROW : UPARROW, 69, 26, 0x10); |
318 |
321 |
319 int cg_ofst; |
322 int cg_ofst; |
320 int x = 89; |
323 int x = 89; |
321 int y = 14; |
324 int y = 14; |
322 int xb = 2; // offset from left of widget |
325 int xb = 2; ///< offset from left of widget |
323 |
326 |
324 uint i = 0; |
327 uint i = 0; |
325 for (CargoID c = 0; c < NUM_CARGO; c++) { |
328 for (CargoID c = 0; c < NUM_CARGO; c++) { |
326 const CargoSpec *cs = GetCargo(c); |
329 const CargoSpec *cs = GetCargo(c); |
327 if (!cs->IsValid()) continue; |
330 if (!cs->IsValid()) continue; |
360 |
363 |
361 SetDParam(0, st->index); |
364 SetDParam(0, st->index); |
362 SetDParam(1, st->facilities); |
365 SetDParam(1, st->facilities); |
363 x = DrawString(xb, y, STR_3049_0, 0) + 5; |
366 x = DrawString(xb, y, STR_3049_0, 0) + 5; |
364 |
367 |
365 // show cargo waiting and station ratings |
368 /* show cargo waiting and station ratings */ |
366 for (CargoID j = 0; j < NUM_CARGO; j++) { |
369 for (CargoID j = 0; j < NUM_CARGO; j++) { |
367 uint amount = GB(st->goods[j].waiting_acceptance, 0, 12); |
370 uint amount = GB(st->goods[j].waiting_acceptance, 0, 12); |
368 if (amount != 0) { |
371 if (amount != 0) { |
369 StationsWndShowStationRating(x, y, j, amount, st->goods[j].rating); |
372 StationsWndShowStationRating(x, y, j, amount, st->goods[j].rating); |
370 x += 20; |
373 x += 20; |
507 } |
510 } |
508 break; |
511 break; |
509 |
512 |
510 case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */ |
513 case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */ |
511 if (sl->sort_type != e->we.dropdown.index) { |
514 if (sl->sort_type != e->we.dropdown.index) { |
512 // value has changed -> resort |
515 /* value has changed -> resort */ |
513 sl->sort_type = e->we.dropdown.index; |
516 sl->sort_type = e->we.dropdown.index; |
514 station_sort.criteria = sl->sort_type; |
517 station_sort.criteria = sl->sort_type; |
515 sl->flags |= SL_RESORT; |
518 sl->flags |= SL_RESORT; |
516 } |
519 } |
517 w->SetDirty(); |
520 w->SetDirty(); |