621 |
621 |
622 cargo = -1; |
622 cargo = -1; |
623 x = 6; |
623 x = 6; |
624 y = 25; |
624 y = 25; |
625 sel = WP(w,refit_d).sel; |
625 sel = WP(w,refit_d).sel; |
626 b = _rail_vehicle_refit_types[_opt.landscape]; |
626 |
627 do { |
627 #define show_cargo(ctype) { \ |
628 color = 16; |
628 color = 16; \ |
629 if (sel == 0) { |
629 if (sel == 0) { \ |
630 cargo = *b; |
630 cargo = ctype; \ |
631 color = 12; |
631 color = 12; \ |
|
632 } \ |
|
633 sel--; \ |
|
634 DrawString(x, y, _cargoc.names_s[ctype], color); \ |
|
635 y += 10; \ |
|
636 } |
|
637 |
|
638 if (_engine_refit_masks[v->engine_type]) { |
|
639 uint32 mask = _engine_refit_masks[v->engine_type]; |
|
640 int cid = 0; |
|
641 |
|
642 for (; mask; mask >>= 1, cid++) { |
|
643 if (!(mask & 1)) // not this cid |
|
644 continue; |
|
645 if (!(_local_cargo_id_landscape[cid] & (1 << _opt.landscape))) // not in this landscape |
|
646 continue; |
|
647 |
|
648 show_cargo(_local_cargo_id_ctype[cid]); |
632 } |
649 } |
633 sel--; |
650 |
634 DrawString(x,y,_cargoc.names_s[*b], color); |
651 } else { // generic refit list |
635 y += 10; |
652 b = _rail_vehicle_refit_types[_opt.landscape]; |
636 } while (*++b != 255); |
653 do { |
|
654 show_cargo(*b); |
|
655 } while (*++b != 255); |
|
656 } |
|
657 |
|
658 #undef show_cargo |
637 |
659 |
638 WP(w,refit_d).cargo = cargo; |
660 WP(w,refit_d).cargo = cargo; |
639 |
661 |
640 if (cargo != -1) { |
662 if (cargo != -1) { |
641 int32 cost = DoCommandByTile(v->tile, v->index, cargo, 0, CMD_REFIT_RAIL_VEHICLE); |
663 int32 cost = DoCommandByTile(v->tile, v->index, cargo, 0, CMD_REFIT_RAIL_VEHICLE); |