Ejemplo n.º 1
0
static void con_addvote(void *result, void *user_data)
{
	int len = strlen(console_arg_string(result, 0));
	
	if(!voteoption_heap)
		voteoption_heap = memheap_create();
	
	VOTEOPTION *option = (VOTEOPTION *)memheap_allocate(voteoption_heap, sizeof(VOTEOPTION) + len);
	option->next = 0;
	option->prev = voteoption_last;
	if(option->prev)
		option->prev->next = option;
	voteoption_last = option;
	if(!voteoption_first)
		voteoption_first = option;
	
	mem_copy(option->command, console_arg_string(result, 0), len+1);
	dbg_msg("server", "added option '%s'", option->command);
}
Ejemplo n.º 2
0
static void con_addvote(void *result, void *user_data, int cid)
{
       const char *string = console_arg_string(result, 0);
       VOTEOPTION *option = voteoption_first;
       while(option)
       {
               if(str_comp_nocase(string, option->command) == 0)
               {
                       dbg_msg("server", "option '%s' already exists", string);
                       return;
               }
               option = option->next;
       }

       int len = strlen(string);

	
	if(!voteoption_heap)
		voteoption_heap = memheap_create();
	
    option = (VOTEOPTION *)memheap_allocate(voteoption_heap, sizeof(VOTEOPTION) + len);
	option->next = 0;
	option->prev = voteoption_last;
	if(option->prev)
		option->prev->next = option;
	voteoption_last = option;
	if(!voteoption_first)
		voteoption_first = option;
	
    mem_copy(option->command, string, len+1);

	if(game.players[cid])
		dbg_msg("server", "added option '%s'", string);

 NETMSG_SV_VOTE_OPTION optionmsg;
 optionmsg.command = option->command;
 optionmsg.pack(MSGFLAG_VITAL);
 server_send_msg(-1);

}