/** * @brief Call this if you want to skip some actor netchannel data * @note The fieldsize is not skipped * @sa G_ClientTeamInfo */ static void G_ClientSkipActorInfo (void) { int i, n; edict_t ent; invDef_t container; item_t item; int x, y; const invDef_t *c = &container; G_ClientReadCharacter(&ent); /* skip inventory */ n = gi.ReadShort(); for (i = 0; i < n; i++) { G_ReadItem(&item, &c, &x, &y); } }
/** * @brief Read the inventory from the clients team data * @param ent The actor's entity that should receive the items. */ static void G_ClientReadInventory (edict_t *ent) { /* inventory */ int nr = gi.ReadShort(); for (; nr-- > 0;) { const invDef_t *container; item_t item; int x, y; G_ReadItem(&item, &container, &x, &y); if (container->temp) gi.Error("G_ClientReadInventory failed, tried to add '%s' to a temp container %i", item.t->id, container->id); if (!level.noEquipment && game.i.AddToInventory(&game.i, &ent->chr.i, &item, container, x, y, 1) == NULL) gi.Error("G_ClientReadInventory failed, could not add item '%s' to container %i (x:%i,y:%i)", item.t->id, container->id, x, y); } }
/** * @brief Read the inventory from the clients team data * @param ent The actor's entity that should receive the items. */ static void G_ClientReadInventory (edict_t *ent) { /* inventory */ int nr = gi.ReadShort(); for (; nr-- > 0;) { const invDef_t *container; item_t item; int x, y; G_ReadItem(&item, &container, &x, &y); if (container->temp) gi.Error("G_ClientReadInventory failed, tried to add '%s' to a temp container %i", item.item->id, container->id); /* ignore the overload for now */ if (!INVSH_CheckAddingItemToInventory(&ent->chr.i, gi.csi->idEquip, container->id, item, ent->chr.score.skills[ABILITY_POWER])) Com_Printf("G_ClientReadInventory: Item %s exceeds ent %i weight capacity\n", item.item->id, ent->number); if (!level.noEquipment && game.i.AddToInventory(&game.i, &ent->chr.i, &item, container, x, y, 1) == NULL) gi.Error("G_ClientReadInventory failed, could not add item '%s' to container %i (x:%i,y:%i)", item.item->id, container->id, x, y); } }