Пример #1
0
void routine_entries( rtinfo_t* rti, _event_t e ){
    switch(e.routine){
        HOOK_EVENT( gcd_expire );
        HOOK_EVENT( smackthat_land );
        HOOK_EVENT( livingbomb_execute );
        HOOK_EVENT( livingbomb_tick );
        HOOK_EVENT( livingbomb_expire );
        HOOK_EVENT( bsod_execute );
        HOOK_EVENT( bsod_cd );
        HOOK_EVENT( bsod_expire );
    default:
        assert( 0 );
    }
}
Пример #2
0
USERS *adduser(ape_socket *client, const char *host, const char *ip, USERS *allocated, acetables *g_ape)
{
	USERS *nuser = NULL;

	/* Calling module */
	if (allocated == NULL) {
		FIRE_EVENT(allocateuser, nuser, client, host, ip, g_ape);
		
		nuser = init_user(g_ape);
		strncpy(nuser->ip, ip, 16);
		
		nuser->pipe = init_pipe(nuser, USER_PIPE, g_ape);
		nuser->type = (client != NULL ? HUMAN : BOT);
		
		nuser->istmp = 1;
		
		hashtbl_append(g_ape->hSessid, nuser->sessid, (void *)nuser);

		addsubuser(client, host, nuser, g_ape);

		HOOK_EVENT(allocateuser, nuser, g_ape);
	} else {
		FIRE_EVENT(adduser, nuser, allocated, g_ape);
		
		nuser = allocated;
		nuser->istmp = 0;
		
		g_ape->nConnected++;

		HOOK_EVENT(adduser, nuser, g_ape);
		
		//alog_info("New user - (ip : %s)", nuser->ip);
	}

	return nuser;
	
}
Пример #3
0
void deluser(USERS *user, acetables *g_ape)
{

	if (user == NULL) {
		return;
	}

	FIRE_EVENT_NULL(deluser, user, user->istmp, g_ape);

	left_all(user, g_ape);

	char *uin = GET_UIN_FROM_USER(user);

	/* kill all users connections */
	
	clear_subusers(user, g_ape);

	hashtbl_erase(g_ape->hSessid, user->sessid);
	if (uin != NULL && GET_USER_TBL(g_ape) != NULL) {
		hashtbl_erase(GET_USER_TBL(g_ape), uin);
	}
	if (uin != NULL && GET_ONLINE_TBL(g_ape) != NULL) {
		hashtbl_erase(GET_ONLINE_TBL(g_ape), uin);
	}

	if (user->istmp == 0) g_ape->nConnected--;
	
	if (user->prev == NULL) {
		g_ape->uHead = user->next;
	} else {
		user->prev->next = user->next;
	}
	if (user->next != NULL) {
		user->next->prev = user->prev;
	}

	clear_sessions(user);
	clear_properties(&user->properties);

	destroy_pipe(user->pipe, g_ape);
	
	HOOK_EVENT(deluser, user, g_ape);

	/* TODO Add Event */
	free(user);

}
Пример #4
0
void delsubuser(subuser **current, acetables *g_ape)
{
	
	subuser *del = *current;
	USERS *user = (*current)->user;

	FIRE_EVENT_NULL(delsubuser, del, g_ape);
	((*current)->user->nsub)--;
	
	*current = (*current)->next;
	
	destroy_raw_pool(del->raw_pools.low.rawhead);
	destroy_raw_pool(del->raw_pools.high.rawhead);
	del->raw_pools.low.rawhead = del->raw_pools.low.rawfoot = NULL;
	del->raw_pools.high.rawhead = del->raw_pools.high.rawfoot = NULL;
	del->raw_pools.nraw = 0;
	del->client->attach = NULL;
	
	clear_properties(&del->properties);
	
	if (del->state == ALIVE) {
		del->wait_for_free = 1;
		do_died(del);
	} else {
		free(del);
	}

	/*
	 * If this is the last subuser, del the user 
	 */
	if (user->nsub <= 0) {
		user->idle = time(NULL) - (TIMEOUT_SEC - USRLEFT_SEC);
	}

	HOOK_EVENT(delsubuser, del, g_ape);
}
Пример #5
0
subuser *addsubuser(ape_socket *client, const char *channel, USERS *user, acetables *g_ape)
{
	subuser *sub = NULL;

	FIRE_EVENT(addsubuser, sub, g_ape);
	
	if (getsubuser(user, channel) != NULL || strlen(channel) > MAX_HOST_LENGTH) {
		return NULL;
	}

	sub = xmalloc(sizeof(*sub));
	sub->client = client;
	sub->state = ADIED;
	sub->user = user;
	
	memcpy(sub->channel, channel, strlen(channel)+1);
	sub->next = user->subuser;
	
	sub->nraw = 0;
	sub->wait_for_free = 0;
	
	sub->properties = NULL;
	
	sub->headers.sent = 0;
	sub->headers.content = NULL;
	
	sub->burn_after_writing = 0;
	
	sub->idle = time(NULL);
	sub->need_update = 0;
	sub->current_chl = 0;

	sub->raw_pools.nraw = 0;
	
	/* Pre-allocate a pool of raw to reduce the number of malloc calls */
	
	/* Low priority raws */
	sub->raw_pools.low.nraw = 0;
	sub->raw_pools.low.size = 32;
	sub->raw_pools.low.rawhead = init_raw_pool(sub->raw_pools.low.size);
	sub->raw_pools.low.rawfoot = sub->raw_pools.low.rawhead;
	
	/* High priority raws */
	sub->raw_pools.high.nraw = 0;
	sub->raw_pools.high.size = 8;
	sub->raw_pools.high.rawhead = init_raw_pool(sub->raw_pools.high.size);
	sub->raw_pools.high.rawfoot = sub->raw_pools.high.rawhead;
	
	(user->nsub)++;
	
	user->subuser = sub;
	
	/* if the previous subuser have some messages in queue, copy them to the new subuser */
	if (sub->next != NULL && sub->next->raw_pools.low.nraw) {
		struct _raw_pool *rTmp;
		for (rTmp = sub->next->raw_pools.low.rawhead; rTmp->raw != NULL; rTmp = rTmp->next) {
			post_raw_sub(rTmp->raw, sub, g_ape);
		}

	}
	
	HOOK_EVENT(addsubuser, sub, g_ape);
	
	return sub;
}
Пример #6
0
/*
======================
Game_HookEvents

Associate script file name with callback functions.  Callback's must be extern "C" so
 the engine doesn't get confused about name mangling stuff.  Note that the format is
 always the same.  Of course, a clever mod team could actually embed parameters, behavior
 into the actual .sc files and create a .sc file parser and hook their functionality through
 that.. i.e., a scripting system.

That was what we were going to do, but we ran out of time...oh well.
======================
*/
void Game_HookEvents( void )
{
	HOOK_EVENT( ak47, FireAK47 );
	HOOK_EVENT( aug, FireAUG );
	HOOK_EVENT( awp, FireAWP );
	HOOK_EVENT( createexplo, CreateExplo );
	HOOK_EVENT( createsmoke, CreateSmoke );
	HOOK_EVENT( deagle, FireDEAGLE );
	HOOK_EVENT( decal_reset, DecalReset );
	HOOK_EVENT( elite_left, FireEliteLeft );
	HOOK_EVENT( elite_right, FireEliteRight );
	HOOK_EVENT( famas, FireFAMAS );
	HOOK_EVENT( fiveseven, Fire57 );
	HOOK_EVENT( g3sg1, FireG3SG1 );
	HOOK_EVENT( galil, FireGALIL );
	HOOK_EVENT( glock18, Fireglock18 );
	HOOK_EVENT( knife, Knife );
	HOOK_EVENT( m249, FireM249 );
	HOOK_EVENT( m3, FireM3 );
	HOOK_EVENT( m4a1, FireM4A1 );
	HOOK_EVENT( mac10, FireMAC10 );
	HOOK_EVENT( mp5n, FireMP5 );
	HOOK_EVENT( p228, FireP228 );
	HOOK_EVENT( p90, FireP90 );
	HOOK_EVENT( scout, FireScout );
	HOOK_EVENT( sg550, FireSG550 );
	HOOK_EVENT( sg552, FireSG552 );
	HOOK_EVENT( tmp, FireTMP );
	HOOK_EVENT( ump45, FireUMP45 );
	HOOK_EVENT( usp, FireUSP );
	HOOK_EVENT( vehicle, Vehicle );
	HOOK_EVENT( xm1014, FireXM1014 );
}