Exemplo n.º 1
0
void update_selectables(){
	int pos,i;
	hash_entry *he;

	i=0;
	pos=vscrollbar_get_pos(emotes_win, EMOTES_SCROLLBAR_ITEMS);
	memset(selectables,0,sizeof(emote_data*)*EMOTES_SHOWN);
	hash_start_iterator(emotes);
	while((he=hash_get_next(emotes))&&i<EMOTES_SHOWN){
		emote_data *emote;

		emote=((emote_data *)he->item);
		if(!cur_cat&&emote->pose>EMOTE_STANDING) {
			//emotes
			pos--;
			if(pos>=0) continue;
			selectables[i]=emote;
			i++;
		} else if(cur_cat&&emote->pose==(cur_cat-1)){
			//poses
			pos--;
			if(pos>=0) continue;
			selectables[i]=emote;
			i++;
		}
	}

	emote_str1[1]=emote_str2[0]=emote_str2[1]=0;
	if(emote_sel[cur_cat]){
		emote_dict *emd;

		emote_str1[0]=127+c_orange2;
		safe_strcat((char*)emote_str1,(char*)emote_sel[cur_cat]->desc,/*sizeof(emote_str1)*/23);
		hash_start_iterator(emote_cmds);
		while((he=hash_get_next(emote_cmds))){
			emd = (emote_dict*)he->item;
			if (emd->emote==emote_sel[cur_cat]){
				int ll;
				//draw command
				if(!emote_str2[0]) {
					emote_str2[0]=127+c_grey1;
					safe_strcat((char*)emote_str2,"Trigger:",10);
				}
				ll=strlen((char*)emote_str2);
				emote_str2[ll]=127+c_green3;
				emote_str2[ll+1]=emote_str2[ll+2]=' ';
				emote_str2[ll+3]=0;
				safe_strcat((char*)emote_str2,emd->command,/*sizeof(emote_str2)*/23);
				break; //just one command
			}
		}
	}
	
}
Exemplo n.º 2
0
void save_server_markings(){
	char fname[128];
	FILE *fp;
	server_mark *sm;
	hash_entry *he;
	
	if(!server_marks) return;

	//open server markings file
	safe_snprintf(fname, sizeof(fname), "servermarks_%s.dat",get_lowercase_username());
	fp = open_file_config(fname,"w");
	if(fp == NULL){
		LOG_ERROR("%s: %s \"%s\": %s\n", reg_error_str, cant_open_file, fname, strerror(errno));
		return;
	}

	hash_start_iterator(server_marks);
	
	while((he=hash_get_next(server_marks))){		
		sm = (server_mark *) he->item;
		fprintf(fp,"%d %d %d %s %s\n",sm->id, sm->x, sm->y, sm->map_name, sm->text);
	}
	
	fclose (fp);	

	LOG_DEBUG("Wrote server markings to file '%s'", fname);
}
Exemplo n.º 3
0
void add_server_markers(){

	hash_entry *he;
	server_mark *sm;
	int i,l;
	char *mapname = map_file_name;

	//find the slot to add server marks
	for(i=0;i<max_mark;i++)
		if(marks[i].server_side) break;
	l=i;
	
	if(!server_marks) init_server_markers();
	if(server_marks) {
		hash_start_iterator(server_marks);
		while((he=hash_get_next(server_marks))){
			sm = (server_mark *) he->item;
			//is it in this map?
			if(strcmp(mapname,sm->map_name)) continue;
			//find the next slot. If not there, add 1
			for(i=l;i<MAX_MARKINGS;i++) 
				if(marks[i].server_side||i>=max_mark) {l=i; if(l>=max_mark) max_mark=l+1; break;}
			//add the marker
			marks[l].x=sm->x;
			marks[l].y=sm->y;
			marks[l].server_side=1;
			marks[l].server_side_id=sm->id;
			safe_strncpy(marks[l].text, sm->text, sizeof(marks[l].text));
			l++;
		}
		//remove server side markings if necessary
		for(i=l+1;i<max_mark;i++)
			if(marks[i].server_side) {marks[i].server_side=0;marks[i].server_side_id=marks[i].x=marks[i].y=-1;}
	}
}
Exemplo n.º 4
0
int print_emotes(char *text, int len){

	hash_entry *he;;
	LOG_TO_CONSOLE(c_orange1,"EMOTES");
	LOG_TO_CONSOLE(c_orange1,"--------------------");
	hash_start_iterator(emote_cmds);
	while((he=hash_get_next(emote_cmds)))
		LOG_TO_CONSOLE(c_orange1,((emote_dict *)he->item)->command);
	return 1;
}