src/newgrf_station.cpp
changeset 6448 a749c78812a7
parent 6443 b8f06d8eb7be
child 6474 24e7ceeb25f5
equal deleted inserted replaced
6447:3b71e57fd22b 6448:a749c78812a7
   513 		ctype = GC_PURCHASE;
   513 		ctype = GC_PURCHASE;
   514 	} else {
   514 	} else {
   515 		/* Pick the first cargo that we have waiting */
   515 		/* Pick the first cargo that we have waiting */
   516 		for (CargoID cargo = 0; cargo < NUM_CARGO; cargo++) {
   516 		for (CargoID cargo = 0; cargo < NUM_CARGO; cargo++) {
   517 			const CargoSpec *cs = GetCargo(cargo);
   517 			const CargoSpec *cs = GetCargo(cargo);
   518 			if (cs->bitnum != 0xFF && object->u.station.statspec->spritegroup[cs->bitnum] != NULL &&
   518 			if (cs->IsValid() && object->u.station.statspec->spritegroup[cs->bitnum] != NULL &&
   519 					GB(object->u.station.st->goods[cargo].waiting_acceptance, 0, 12) != 0) {
   519 					GB(object->u.station.st->goods[cargo].waiting_acceptance, 0, 12) != 0) {
   520 				ctype = cs->bitnum;
   520 				ctype = cs->bitnum;
   521 				break;
   521 				break;
   522 			}
   522 			}
   523 		}
   523 		}