equal
deleted
inserted
replaced
16 #include "newgrf_callbacks.h" |
16 #include "newgrf_callbacks.h" |
17 #include "newgrf_station.h" |
17 #include "newgrf_station.h" |
18 #include "newgrf_spritegroup.h" |
18 #include "newgrf_spritegroup.h" |
19 #include "date.h" |
19 #include "date.h" |
20 #include "helpers.hpp" |
20 #include "helpers.hpp" |
|
21 #include "cargotype.h" |
21 |
22 |
22 static StationClass station_classes[STAT_CLASS_MAX]; |
23 static StationClass station_classes[STAT_CLASS_MAX]; |
23 |
24 |
24 enum { |
25 enum { |
25 MAX_SPECLIST = 255, |
26 MAX_SPECLIST = 255, |
457 cargo += GB(st->goods[cargo_type].waiting_acceptance, 0, 12); |
458 cargo += GB(st->goods[cargo_type].waiting_acceptance, 0, 12); |
458 } |
459 } |
459 break; |
460 break; |
460 |
461 |
461 default: |
462 default: |
462 cargo = GB(st->goods[_local_cargo_id_ctype[cargo_type]].waiting_acceptance, 0, 12); |
463 cargo = GB(st->goods[GetCargoIDByBitnum(cargo_type)].waiting_acceptance, 0, 12); |
463 break; |
464 break; |
464 } |
465 } |
465 |
466 |
466 if (HASBIT(statspec->flags, 1)) cargo /= (st->trainst_w + st->trainst_h); |
467 if (HASBIT(statspec->flags, 1)) cargo /= (st->trainst_w + st->trainst_h); |
467 cargo = min(0xfff, cargo); |
468 cargo = min(0xfff, cargo); |
509 |
510 |
510 if (object->u.station.st == NULL) { |
511 if (object->u.station.st == NULL) { |
511 /* No station, so we are in a purchase list */ |
512 /* No station, so we are in a purchase list */ |
512 ctype = GC_PURCHASE; |
513 ctype = GC_PURCHASE; |
513 } else { |
514 } else { |
514 CargoID cargo; |
|
515 |
|
516 /* Pick the first cargo that we have waiting */ |
515 /* Pick the first cargo that we have waiting */ |
517 for (cargo = 0; cargo < NUM_GLOBAL_CID; cargo++) { |
516 for (CargoID cargo = 0; cargo < NUM_CARGO; cargo++) { |
518 CargoID lcid = _local_cargo_id_ctype[cargo]; |
517 const CargoSpec *cs = GetCargo(cargo); |
519 if (lcid != CT_INVALID && |
518 if (cs->bitnum != 0xFF && object->u.station.statspec->spritegroup[cs->bitnum] != NULL && |
520 object->u.station.statspec->spritegroup[cargo] != NULL && |
519 GB(object->u.station.st->goods[cargo].waiting_acceptance, 0, 12) != 0) { |
521 GB(object->u.station.st->goods[lcid].waiting_acceptance, 0, 12) != 0) { |
520 ctype = cs->bitnum; |
522 ctype = cargo; |
|
523 break; |
521 break; |
524 } |
522 } |
525 } |
523 } |
526 } |
524 } |
527 |
525 |