e_event_invammo.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_invammo.h"
00028
00029 void CL_InvAmmo (const eventRegister_t *self, struct dbuffer *msg)
00030 {
00031 invList_t *ic;
00032 le_t *le;
00033 int number;
00034 int ammo, type, x, y;
00035 containerIndex_t container;
00036
00037 NET_ReadFormat(msg, self->formatString, &number, &ammo, &type, &container, &x, &y);
00038
00039 le = LE_Get(number);
00040 if (!le) {
00041 Com_DPrintf(DEBUG_CLIENT, "InvAmmo message ignored... LE not found\n");
00042 return;
00043 }
00044
00045 if (le->team != cls.team)
00046 return;
00047
00048 assert(container >= 0);
00049 assert(container < MAX_INVDEFS);
00050 ic = INVSH_SearchInInventory(&le->i, INVDEF(container), x, y);
00051 if (!ic)
00052 return;
00053
00054
00055 ic->item.a = ammo;
00056 ic->item.m = INVSH_GetItemByIDX(type);
00057 }