Example #1
0
/**
 * @sa gi.AddEvent
 * @param[in] mask The player bitmask to send the events to. Use @c PM_ALL to send to every connected player.
 */
static void SV_AddEvent (unsigned int mask, int eType, int entnum)
{
	pending_event_t *p = &sv->pendingEvent;
	const int rawType = eType &~ EVENT_INSTANTLY;

	if (rawType >= EV_NUM_EVENTS || rawType < 0)
		Com_Error(ERR_DROP, "SV_AddEvent: invalid event %i", rawType);

	const char *eventName = eventNames[rawType].name;
	Com_DPrintf(DEBUG_EVENTSYS, "Event type: %s (%i - %i) (mask %s) (entnum: %i)\n", eventName,
			rawType, eType, Com_UnsignedIntToBinary(mask), entnum);

	/* finish the last event */
	if (p->pending)
		SV_EndEvents();

	/* start the new event */
	p->pending = true;
	p->playerMask = mask;
	p->type = eType;
	p->entnum = entnum;
	p->buf = new dbuffer();

	/* write header */
	NET_WriteByte(p->buf, svc_event);
	NET_WriteByte(p->buf, eType);
	if (entnum != -1)
		NET_WriteShort(p->buf, entnum);
}
Example #2
0
/**
 * @sa gi.AddEvent
 * @param[in] mask The player bitmask to send the events to. Use @c PM_ALL to send to every connected player.
 */
static void SV_AddEvent (unsigned int mask, int eType)
{
	pending_event_t *p = &sv->pendingEvent;
	Com_DPrintf(DEBUG_EVENTSYS, "Event type: %i (mask %i)\n", eType, mask);

	/* finish the last event */
	if (p->pending)
		SV_EndEvents();

	/* start the new event */
	p->pending = qtrue;
	p->playerMask = mask;
	p->type = eType;
	p->buf = new_dbuffer();

	/* write header */
	NET_WriteByte(p->buf, svc_event);
	NET_WriteByte(p->buf, eType);
}