![]() |
OpenXcom
1.0
Open-source clone of the original X-Com
|
Represents a specific section of the inventory, containing information like available slots and screen position. More...
#include <RuleInventory.h>
Public Member Functions | |
| RuleInventory (const std::string &id) | |
| Creates a blank inventory ruleset. More... | |
| ~RuleInventory () | |
| Cleans up the inventory ruleset. | |
| void | load (const YAML::Node &node, int listOrder) |
| Loads inventory data from YAML. More... | |
| std::string | getId () const |
| Gets the inventory's id. More... | |
| int | getX () const |
| Gets the X position of the inventory. More... | |
| int | getY () const |
| Gets the Y position of the inventory. More... | |
| InventoryType | getType () const |
| Gets the inventory type. More... | |
| std::vector< struct RuleSlot > * | getSlots () |
| Gets all the slots in the inventory. More... | |
| bool | checkSlotInPosition (int *x, int *y) const |
| Checks for a slot in a certain position. More... | |
| bool | fitItemInSlot (RuleItem *item, int x, int y) const |
| Checks if an item fits in a slot. More... | |
| int | getCost (RuleInventory *slot) const |
| Gets a certain cost in the inventory. More... | |
Represents a specific section of the inventory, containing information like available slots and screen position.
| OpenXcom::RuleInventory::RuleInventory | ( | const std::string & | id | ) |
Creates a blank inventory ruleset.
Creates a blank ruleset for a certain type of inventory section.
| id | String defining the id. |
| bool OpenXcom::RuleInventory::checkSlotInPosition | ( | int * | x, |
| int * | y | ||
| ) | const |
Checks for a slot in a certain position.
Gets the slot located in the specified mouse position.
| x | Mouse X position. Returns the slot's X position. |
| y | Mouse Y position. Returns the slot's Y position. |
| bool OpenXcom::RuleInventory::fitItemInSlot | ( | RuleItem * | item, |
| int | x, | ||
| int | y | ||
| ) | const |
Checks if an item fits in a slot.
Checks if an item completely fits when placed in a certain slot.
| item | Pointer to item ruleset. |
| x | Slot X position. |
| y | Slot Y position. |
| int OpenXcom::RuleInventory::getCost | ( | RuleInventory * | slot | ) | const |
Gets a certain cost in the inventory.
Gets the time unit cost to place an item in another section.
| slot | The new section id. |
| std::string OpenXcom::RuleInventory::getId | ( | ) | const |
Gets the inventory's id.
Gets the language string that names this inventory section.
Each section has a unique name.
| std::vector< struct RuleSlot > * OpenXcom::RuleInventory::getSlots | ( | ) |
Gets all the slots in the inventory.
Gets all the slots in the inventory section.
| InventoryType OpenXcom::RuleInventory::getType | ( | ) | const |
Gets the inventory type.
Gets the type of the inventory section.
Slot-based contain a limited number of slots. Hands only contain one slot but can hold any item. Ground can hold infinite items but don't attach to soldiers.
| int OpenXcom::RuleInventory::getX | ( | ) | const |
Gets the X position of the inventory.
Gets the X position of the inventory section on the screen.
| int OpenXcom::RuleInventory::getY | ( | ) | const |
Gets the Y position of the inventory.
Gets the Y position of the inventory section on the screen.
| void OpenXcom::RuleInventory::load | ( | const YAML::Node & | node, |
| int | listOrder | ||
| ) |
Loads inventory data from YAML.
Loads the inventory from a YAML file.
| node | YAML node. |
| listOrder | The list weight for this inventory. |
1.8.14