X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fitems%2Finventory.qh;h=ba824f40b41c14c470a214c33eeb0bd6e9064c4d;hb=791f300d2660d6b75a51c6e7f302d6fa6b64861a;hp=8520075019b97c616107cabf94420ef9a27d58d6;hpb=1a02dfa42534cfd8697e6c4d0e1181e5ec6c1fc7;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/items/inventory.qh b/qcsrc/common/items/inventory.qh index 852007501..ba824f40b 100644 --- a/qcsrc/common/items/inventory.qh +++ b/qcsrc/common/items/inventory.qh @@ -21,9 +21,11 @@ const int Inventory_groups_minor = 8; // ceil(Items_MAX / Inventory_groups_major #define G_MINOR(id) ((id) % Inventory_groups_minor) #ifdef CSQC +Inventory g_inventory; NET_HANDLE(ENT_CLIENT_INVENTORY, bool isnew) { make_pure(this); + g_inventory = this; const int majorBits = ReadShort(); for (int i = 0; i < Inventory_groups_major; ++i) { if (!(majorBits & BIT(i))) { @@ -105,7 +107,7 @@ bool Inventory_Send(Inventory this, Client to, int sf) TC(Inventory, this); WriteHeader(MSG_ENTITY, ENT_CLIENT_INVENTORY); entity e = this.owner; - if (IS_SPEC(e)) e = e.enemy; + if (IS_SPEC(e)) e = PS(e.enemy); // TODO: how can this *ever* be the case? TC(Player, e); Inventory data = e.inventory; Inventory_Write(data); @@ -116,7 +118,7 @@ void Inventory_new(entity e) { Inventory inv = NEW(Inventory), bak = NEW(Inventory); inv.inventory = bak; - inv.drawonlytoclient = e; + inv.drawonlytoclient = IS_CLIENT(e) ? e : e.m_client; Net_LinkEntity((inv.owner = e).inventory = inv, false, 0, Inventory_Send); } void Inventory_delete(entity e) { delete(e.inventory.inventory); delete(e.inventory); }