35 for (
int i = 0;
i <
gi.csi->numEDs;
i++, ed++)
39 gi.DPrintf(
"Could not find the equipment with the id: '%s'\n", equipID);
85 if (item !=
nullptr &&
Q_streq(item->
id, itemID)) {
88 gi.Error(
"Could not remove item '%s' from inventory %i",
89 ic->
def()->
id, container);
123 gi.Error(
"Could not remove virtual item '%s' from inventory %i",
124 ic->
def()->
id, container);
144 gi.DPrintf(
"Could not find item '%s'\n", itemID);
163static bool G_InventoryPlaceItemAdjacent (
Edict* ent)
169 Edict* floorAdjacent =
nullptr;
179 if (!floorAdjacent) {
259 for (ic = ent->
getContainer(container); ic; ic = next) {
269 gi.Error(
"Could not remove item '%s' from inventory %i of entity %i",
273 gi.Error(
"Could not add item '%s' from inventory %i of entity %i to floor container",
276 G_InventoryPlaceItemAdjacent(ent);
304 gi.ReadFormat(
"sbsbbbbs", &t, &ammoleft, &
m, &containerID, x, y, &item->
rotated, &amount);
308 if (t < 0 || t >=
gi.csi->numODs)
309 gi.Error(
"Item index out of bounds: %i", t);
314 gi.Error(
"Ammo index out of bounds: %i",
m);
321 *container =
INVDEF(containerID);
323 gi.Error(
"container id is out of bounds: %i", containerID);
371 const Item* item =
nullptr;
#define INVDEF(containerID)
int countItems() const
Count the number of items in the Container.
Item * getNextItem(const Item *prev) const
void setFloor(const Edict *other)
void resetContainer(const containerIndex_t idx)
Item * getContainer(const containerIndex_t idx) const
void findSpace(const invDef_t *container, const Item *item, int *const px, int *const py, const Item *ignoredItem) const
Finds space for item in inv at container.
void setFloorContainer(Item *cont)
const Container * getNextCont(const Container *prev, bool inclTemp=false) const
item instance data, with linked list capability
const objDef_t * ammoDef(void) const
void setAmount(int value)
void setAmmoDef(const objDef_t *od)
void setDef(const objDef_t *objDef)
const objDef_t * def(void) const
void setAmmoLeft(int value)
playermask_t G_VisToPM(teammask_t teamMask)
Converts vis mask to player mask.
Interface for g_client.cpp.
void G_EventInventoryDelete(const Edict &ent, playermask_t playerMask, const containerIndex_t containerId, int x, int y)
Tell the client to remove the item from the container.
void G_EventInventoryAdd(const Edict &ent, playermask_t playerMask, int itemAmount)
Tell the client to add the item from the container.
void G_EventPerish(const Edict &ent)
Send an event to all clients that are seeing the given edict, that it just has disappeared.
unsigned int playermask_t
void G_InventoryToFloor(Edict *ent)
Move items to adjacent locations if the containers on the current floor edict are full.
bool G_InventoryRemoveItemByID(const char *itemID, Edict *ent, containerIndex_t container)
Removes one particular item from a given container.
static bool G_InventoryDropToFloorCheck(Edict *ent, containerIndex_t container)
Checks whether the given container contains items that should be dropped to the floor....
Edict * G_GetFloorItems(Edict *ent)
Prepares a list of items on the floor at given entity position.
bool G_AddItemToFloor(const pos3_t pos, const char *itemID)
Adds a new item to an existing or new floor container edict at the given grid location.
Edict * G_GetFloorItemFromPos(const pos3_t pos)
Callback to G_GetEdictFromPos() for given position, used to get items from position.
void G_WriteItem(const Item &item, const containerIndex_t contId, int x, int y)
Write an item to the network buffer.
const equipDef_t * G_GetEquipDefByID(const char *equipID)
void G_SendInventory(playermask_t playerMask, const Edict &ent)
Sends whole inventory through the network buffer.
void G_ReadItem(Item *item, const invDef_t **container, int *x, int *y)
Read item from the network buffer.
Edict * G_SpawnFloor(const pos3_t pos)
Spawns a new entity at the floor.
Brings new objects into the world.
Edict * G_GetEdictFromPos(const pos3_t pos, const entity_type_t type)
Searches an edict of the given type at the given grid location.
Misc utility functions for game module.
void G_VisFlagsReset(Edict &ent)
void G_CheckVis(Edict *check, const vischeckflags_t visFlags)
Check if the edict appears/perishes for the other teams. If they appear for other teams,...
const objDef_t * INVSH_GetItemByIDSilent(const char *id)
Returns the item that belongs to the given id or nullptr if it wasn't found.
bool isValidContId(const containerIndex_t id)
const vec4_t dvecs[PATHFINDING_DIRECTIONS]
#define DIRECTIONS
Number of angles from a position (2-dimensional).
inventory definition for our menus
Defines all attributes of objects used in the inventory.
#define Vector2Set(v, x, y)
#define Vector2Copy(src, dest)