MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / findFirstSlotByType

Method findFirstSlotByType

game/state/shared/agent.cpp:553–567  ·  view source on GitHub ↗

If type is null we look for any slot, if type is not null we look for slot that can fit the type

Source from the content-addressed store, hash-verified

551
552// If type is null we look for any slot, if type is not null we look for slot that can fit the type
553Vec2<int> Agent::findFirstSlotByType(EquipmentSlotType slotType,
554 StateRef<AEquipmentType> equipmentType)
555{
556 Vec2<int> pos = {-1, 0};
557 for (auto &slot : type->equipment_layout->slots)
558 {
559 if (slot.type == slotType &&
560 (!equipmentType || canAddEquipment(slot.bounds.p0, equipmentType)))
561 {
562 pos = slot.bounds.p0;
563 break;
564 }
565 }
566 return pos;
567}
568
569Vec2<int> Agent::findFirstSlot(StateRef<AEquipmentType> equipmentType)
570{

Callers 1

tryPlaceItemMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected