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

Method populateInventoryItemsBattle

game/ui/general/aequipscreen.cpp:872–895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

870}
871
872void AEquipScreen::populateInventoryItemsBattle()
873{
874 // Expecting to have an agent
875 auto currentAgent = selectedAgents.front();
876
877 // The gap between the end of one inventory image and the start of the next
878 static const int INVENTORY_IMAGE_X_GAP = 4;
879 Vec2<int> inventoryPosition = inventoryControl->Location + formMain->Location;
880
881 auto itemsOnGround = currentAgent->unit->tileObject->getOwningTile()->getItems();
882
883 for (auto &item : itemsOnGround)
884 {
885 auto &equipmentImage = item->item->type->equipscreen_sprite;
886 Vec2<int> inventoryEndPosition = inventoryPosition;
887 inventoryEndPosition.x += equipmentImage->size.x;
888 inventoryEndPosition.y += equipmentImage->size.y;
889
890 inventoryItems.push_back(
891 std::make_tuple(Rect<int>{inventoryPosition, inventoryEndPosition}, 0, item->item));
892
893 inventoryPosition.x += INVENTORY_IMAGE_X_GAP + equipmentImage->size.x;
894 }
895}
896
897void AEquipScreen::populateInventoryItemsBase()
898{

Callers

nothing calls this directly

Calls 2

getItemsMethod · 0.80
getOwningTileMethod · 0.80

Tested by

no test coverage detected