MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / AddAcceptedCargo_Object

Function AddAcceptedCargo_Object

src/object_cmd.cpp:621–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

619}
620
621static void AddAcceptedCargo_Object(TileIndex tile, CargoArray &acceptance, CargoTypes &always_accepted)
622{
623 if (!IsObjectType(tile, OBJECT_HQ)) return;
624
625 /* HQ accepts passenger and mail; but we have to divide the values
626 * between 4 tiles it occupies! */
627
628 /* HQ level (depends on company performance) in the range 1..5. */
629 uint level = GetCompanyHQSize(tile) + 1;
630
631 /* Top town building generates 10, so to make HQ interesting, the top
632 * type makes 20. */
633 CargoType pass = GetCargoTypeByLabel(CT_PASSENGERS);
634 if (IsValidCargoType(pass)) {
635 acceptance[pass] += std::max(1U, level);
636 SetBit(always_accepted, pass);
637 }
638
639 /* Top town building generates 4, HQ can make up to 8. The
640 * proportion passengers:mail is different because such a huge
641 * commercial building generates unusually high amount of mail
642 * correspondence per physical visitor. */
643 CargoType mail = GetCargoTypeByLabel(CT_MAIL);
644 if (IsValidCargoType(mail)) {
645 acceptance[mail] += std::max(1U, level / 2);
646 SetBit(always_accepted, mail);
647 }
648}
649
650static void AddProducedCargo_Object(TileIndex tile, CargoArray &produced)
651{

Callers

nothing calls this directly

Calls 5

IsObjectTypeFunction · 0.85
GetCompanyHQSizeFunction · 0.85
GetCargoTypeByLabelFunction · 0.85
IsValidCargoTypeFunction · 0.85
SetBitFunction · 0.85

Tested by

no test coverage detected