e_event_invdel.c
Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "../../../../client.h"
00026 #include "../../../cl_localentity.h"
00027 #include "e_event_invdel.h"
00028
00032 void CL_InvDel (const eventRegister_t *self, struct dbuffer *msg)
00033 {
00034 le_t *le;
00035 int number;
00036 int x, y;
00037 containerIndex_t container;
00038 invList_t *ic;
00039
00040 NET_ReadFormat(msg, self->formatString, &number, &container, &x, &y);
00041
00042 le = LE_Get(number);
00043 if (!le)
00044 Com_Error(ERR_DROP, "InvDel message ignored... LE not found\n");
00045
00046
00047 if (container == csi.idRight)
00048 le->right = NONE;
00049 else if (container == csi.idLeft)
00050 le->left = NONE;
00051 else if (container == csi.idExtension)
00052 le->extension = NONE;
00053 else if (container == csi.idHeadgear)
00054 le->headgear = NONE;
00055
00056 if (le->type == ET_ACTOR || le->type == ET_ACTOR2x2)
00057 LE_SetThink(le, LET_StartIdle);
00058
00059 ic = INVSH_SearchInInventory(&le->i, INVDEF(container), x, y);
00060
00061
00062 if (!ic)
00063 return;
00064
00065 if (!cls.i.RemoveFromInventory(&cls.i, &le->i, INVDEF(container), ic))
00066 Com_Error(ERR_DROP, "CL_InvDel: No item was removed from container %i", container);
00067
00068
00069 if (LE_IsItem(le))
00070 LE_PlaceItem(le);
00071 }
00072