• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ HAS_BIT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中HAS_BIT函数的典型用法代码示例。如果您正苦于以下问题:C++ HAS_BIT函数的具体用法?C++ HAS_BIT怎么用?C++ HAS_BIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了HAS_BIT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: spec_janitor

SPEC_RET spec_janitor( CHAR_DATA *ch )
{
	OBJ_DATA *trash;
	OBJ_DATA *trash_next;

	if ( !is_awake(ch) )
		return FALSE;

	for ( trash = ch->in_room->first_content;  trash;  trash = trash_next )
	{
		trash_next = trash->next_content;

		if ( !HAS_BIT(trash->wear_flags, OBJWEAR_TAKE) )	continue;
		if ( HAS_BIT(trash->extra_flags, OBJFLAG_BURIED) )	continue;

		if ( trash->type == OBJTYPE_DRINK_CON
		  || trash->type == OBJTYPE_TRASH
		  || trash->cost < 10
		  || (trash->pObjProto->vnum == VNUM_OBJ_SHOPPING_BAG && !trash->first_content) )
		{
			act( AT_ACTION, "$n raccoglie della spazzatura.", ch, NULL, NULL, TO_ROOM );
			obj_from_room( trash );
			obj_to_char( trash, ch );
			return TRUE;
		}
	}

	return FALSE;
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:29,代码来源:special.c


示例2: abort_handler

void abort_handler(int signal)
{
	static char crashed = FALSE;

	if (crashed)
	{
		exit(-1);
	}
	crashed = TRUE;

	restore_terminal();

	clean_screen(gtd->ses);

	dump_stack();

	fflush(NULL);

	exit(-1);

	if (gtd->ses->connect_retry > utime())
	{
		gtd->ses->connect_retry = 0;
	}
	else if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_SGA) && !HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
	{
		socket_printf(gtd->ses, 1, "%c", 3);
	}
	else
	{
		do_zap(gtd->ses, "");
	}
}
开发者ID:SlySven,项目名称:tintin,代码行数:33,代码来源:main.c


示例3: write_mud

void write_mud(struct session *ses, char *command, int flags)
{
	char output[BUFFER_SIZE];
	int size;

	size = substitute(ses, command, output, flags);

	if (HAS_BIT(ses->flags, SES_FLAG_MAPPING))
	{
		if (ses->map == NULL || ses->map->nofollow == 0)
		{
			check_insert_path(command, ses);
		}
	}

	if (ses->map && ses->map->in_room && ses->map->nofollow == 0)
	{
		if (!HAS_BIT(ses->map->flags, MAP_FLAG_NOFOLLOW))
		{
			if (follow_map(ses, command))
			{
				return;
			}
		}
	}

	write_line_mud(ses, output, size);
}
开发者ID:skout23,项目名称:snowy,代码行数:28,代码来源:parse.c


示例4: process_input

void process_input(void)
{
	if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_SGA) && !HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
	{
		read_key();
	}
	else
	{
		read_line();
	}

	if (!HAS_BIT(gtd->flags, TINTIN_FLAG_PROCESSINPUT))
	{
		return;
	}

	DEL_BIT(gtd->flags, TINTIN_FLAG_PROCESSINPUT);

	if (gtd->chat && gtd->chat->paste_time)
	{
		chat_paste(gtd->input_buf, NULL);

		return;
	}

	if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
	{
		add_line_history(gtd->ses, gtd->input_buf);
	}

	if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
	{
		echo_command(gtd->ses, gtd->input_buf);
	}
	else
	{
		echo_command(gtd->ses, "");
	}

	if (gtd->ses->scroll_line != -1)
	{
		buffer_end(gtd->ses, "");
	}

	check_all_events(gtd->ses, SUB_ARG|SUB_SEC, 0, 1, "RECEIVED INPUT", gtd->input_buf);

	gtd->ses = script_driver(gtd->ses, LIST_COMMAND, gtd->input_buf);

	if (IS_SPLIT(gtd->ses))
	{
		erase_toeol();
	}

	gtd->input_buf[0] = 0;
}
开发者ID:LokiChaos,项目名称:tintin,代码行数:55,代码来源:input.c


示例5: echo_command

void echo_command(struct session *ses, char *line)
{
	char buffer[STRING_SIZE], result[STRING_SIZE];

	if (HAS_BIT(ses->flags, SES_FLAG_SPLIT))
	{
		sprintf(buffer, "%s%s\033[0m", ses->cmd_color, line);
	}
	else
	{
		sprintf(buffer, "%s", line);
	}

	/*
		Deal with pending output
	*/

	if (ses->more_output[0])
	{
		if (ses->check_output)
		{
			strcpy(result, ses->more_output);
			ses->more_output[0] = 0;

			process_mud_output(ses, result, FALSE);
		}
	}

	DEL_BIT(ses->telopts, TELOPT_FLAG_PROMPT);

	if (HAS_BIT(ses->flags, SES_FLAG_SPLIT))
	{
		if (!HAS_BIT(ses->flags, SES_FLAG_ECHOCOMMAND))
		{
			sprintf(result, "\033[0;37m");
		}
		else
		{
			sprintf(result, "%s%s", ses->more_output, buffer);
		}
		add_line_buffer(ses, buffer, -1);

		SET_BIT(ses->flags, SES_FLAG_SCROLLSTOP);

		tintin_printf2(ses, "%s", result);

		DEL_BIT(ses->flags, SES_FLAG_SCROLLSTOP);
	}
	else
	{
		add_line_buffer(ses, buffer, -1);
	}
}
开发者ID:LokiChaos,项目名称:tintin,代码行数:53,代码来源:input.c


示例6: space_out

char *get_arg_stop_spaces(struct session *ses, char *string, char *result, int flag)
{
	char *pto, *pti;
	int nest = 0;

	pti = space_out(string);
	pto = result;

	while (*pti)
	{
		if (HAS_BIT(ses->flags, SES_FLAG_BIG5) && *pti & 128 && pti[1] != 0)
		{
			*pto++ = *pti++;
			*pto++ = *pti++;
			continue;
		}

		if (*pti == '\\' && pti[1] == COMMAND_SEPARATOR)
		{
			*pto++ = *pti++;
		}
		else if (*pti == COMMAND_SEPARATOR && nest == 0)
		{
			break;
		}
		else if (isspace((int) *pti) && nest == 0)
		{
			pti++;
			break;
		}
		else if (*pti == DEFAULT_OPEN)
		{
			nest++;
		}
		else if (*pti == '[' && HAS_BIT(flag, GET_NST))
		{
			nest++;
		}
		else if (*pti == DEFAULT_CLOSE)
		{
			nest--;
		}
		else if (*pti == ']' && HAS_BIT(flag, GET_NST))
		{
			nest--;
		}
		*pto++ = *pti++;
	}
	*pto = '\0';

	return pti;
}
开发者ID:skout23,项目名称:snowy,代码行数:52,代码来源:parse.c


示例7: printline

void printline(struct session *ses, char **str, int prompt)
{
	char *out;

	push_call("printline(%p,%p,%d)",ses,*str,prompt);

	if (ses->scroll_line != -1 && HAS_BIT(ses->flags, SES_FLAG_SCROLLLOCK))
	{
		pop_call();
		return;
	}

	if (HAS_BIT(ses->flags, SES_FLAG_SCAN) && !HAS_BIT(ses->flags, SES_FLAG_VERBOSE))
	{
		pop_call();
		return;
	}

	out = str_alloc(strlen(*str) * 2);

	if (HAS_BIT(ses->flags, SES_FLAG_CONVERTMETA))
	{
		convert_meta(*str, out);
		str_cpy(str, out);
	}

	if (HAS_BIT(ses->flags, SES_FLAG_WORDWRAP))
	{
		word_wrap(ses, *str, out, TRUE);
	}
	else
	{
		strcpy(out, *str);
	}

	if (prompt)
	{
		printf("%s", out);
	}
	else
	{
		printf("%s\n", out);
	}

	str_free(out);

	pop_call();
	return;
}
开发者ID:LokiChaos,项目名称:tintin,代码行数:49,代码来源:text.c


示例8: interrupt_handler

void interrupt_handler(int signal)
{
	if (gtd->ses->connect_retry > utime())
	{
		gtd->ses->connect_retry = 0;
	}
	else if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_SGA) && !HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
	{
		socket_printf(gtd->ses, 1, "%c", 4);
	}
	else
	{
		cursor_delete_or_exit(gtd->ses, "");
	}
}
开发者ID:LokiChaos,项目名称:tintin,代码行数:15,代码来源:main.c


示例9: space_out

char *get_arg_to_brackets(struct session *ses, char *string, char *result)
{
	char *pti, *pto, *ptii, *ptoo;
	int nest1 = 0, nest2 = 0, nest3 = 0;

	pti = space_out(string);
	pto = result;
	ptii = ptoo = NULL;

	while (*pti)
	{
		if (HAS_BIT(ses->flags, SES_FLAG_BIG5) && *pti & 128 && pti[1] != 0)
		{
			*pto++ = *pti++;
			*pto++ = *pti++;
			continue;
		}

		if (*pti == '[')
		{
			nest2++;

			if (nest1 == 0 && ptii == NULL)
			{
				ptii = pti;
				ptoo = pto;
			}
		}
		else if (*pti == ']')
		{
			if (nest2)
			{
				nest2--;
			}
			else
			{
				nest3 = 1;
			}

			if (*(pti+1) == 0 && ptii && nest1 == 0 && nest2 == 0 && nest3 == 0)
			{
				*ptoo = 0;

				return ptii;
			}
		}
		else if (*pti == DEFAULT_OPEN)
		{
			nest1++;
		}
		else if (*pti == DEFAULT_CLOSE)
		{
			nest1--;
		}
		*pto++ = *pti++;
	}
	*pto = 0;

	return pti;
}
开发者ID:tintinplusplus,项目名称:tintin,代码行数:60,代码来源:parse.c


示例10: add_line_history

void add_line_history(struct session *ses, char *line)
{
	struct listroot *root;

	root = ses->list[LIST_HISTORY];

	if (*line == 0)
	{
		if (root->used && HAS_BIT(ses->flags, SES_FLAG_REPEATENTER))
		{
			strcpy(line, root->list[root->used - 1]->left);
		}
		return;
	}

	if (*line == gtd->repeat_char)
	{
		search_line_history(ses, line);
	}

	update_node_list(ses->list[LIST_HISTORY], line, "", "");

	while (root->used > gtd->history_size)
	{
		delete_index_list(ses->list[LIST_HISTORY], 0);
	}

	return;
}
开发者ID:SlySven,项目名称:tintin,代码行数:29,代码来源:history.c


示例11: strip_vt102_strlen

int strip_vt102_strlen(struct session *ses, char *str)
{
	char *pti;
	int i = 0;

	pti = str;

	while (*pti)
	{
		if (skip_vt102_codes(pti))
		{
			pti += skip_vt102_codes(pti);

			continue;
		}

		if (HAS_BIT(ses->flags, SES_FLAG_UTF8) && (*pti & 192) == 192)
		{
			pti++;

			while ((*pti & 192) == 128)
			{
				pti++;
			}
		}
		else
		{
			pti++;
		}
		i++;
	}
	return i;
}
开发者ID:LokiChaos,项目名称:tintin,代码行数:33,代码来源:vt102.c


示例12: winch_handler

void winch_handler(int signal)
{
	struct session *ses;

	init_screen_size(gts);

	for (ses = gts->next ; ses ; ses = ses->next)
	{
		init_screen_size(ses);

		if (HAS_BIT(ses->telopts, TELOPT_FLAG_NAWS))
		{
			send_sb_naws(ses, 0, NULL);
		}
	}

	/*
		we have to reinitialize the signals for sysv machines

	if (signal(SIGWINCH, winch_handler) == BADSIG)
	{
		syserr("signal SIGWINCH");
	}
	*/
}
开发者ID:SlySven,项目名称:tintin,代码行数:25,代码来源:main.c


示例13: check_one_regexp

int check_one_regexp(struct session *ses, struct listnode *node, char *line, char *original, int option)
{
	char *exp, *str;

	if (node->regex == NULL)
	{
		char result[BUFFER_SIZE];

		substitute(ses, node->left, result, SUB_VAR|SUB_FUN);

		exp = result;
	}
	else
	{
		exp = node->left;
	}

	if (HAS_BIT(node->flags, NODE_FLAG_META))
	{
		exp++;
		str = original;
	}
	else
	{
		str = line;
	}	

	return tintin_regexp(ses, node->regex, str, exp, option, SUB_ARG);
}
开发者ID:skout23,项目名称:snowy,代码行数:29,代码来源:tinexp.c


示例14: DoExtDiskSpace

void DoExtDiskSpace(tBuffer *bIn, tBuffer *bOut, u_int32_t id)
{
	struct STATFS stfs;
	tFSPath	*realPath;
	char *path;

	path = convertFromUtf8(BufferGetString(bIn), 1);
	realPath = FSCheckPath(path);
	DEBUG((MYLOG_DEBUG, "[DoExtDiskSpaceOpenSSH]Path: %s", path));
	if (realPath != NULL && !HAS_BIT(gl_var->flagsDisable, SFTP_DISABLE_STATSFS))
	{
		DEBUG((MYLOG_DEBUG, "[DoExtDiskSpaceOpenSSH]Realpath: %s", realPath->realPath));
		if (STATFS(realPath->realPath, &stfs) == 0)
		{
			tBuffer *b;

			b = BufferNew();
			BufferPutInt8(b, SSH2_FXP_EXTENDED_REPLY);
			BufferPutInt32(b, id);
			BufferPutInt64(b, (u_int64_t) stfs.f_blocks * (u_int64_t) stfs.f_bsize);
			BufferPutInt64(b, (u_int64_t) stfs.f_bfree * (u_int64_t) stfs.f_bsize);
			BufferPutInt64(b, 0);
			BufferPutInt64(b, (u_int64_t) stfs.f_bavail * (u_int64_t) stfs.f_bsize);
			BufferPutInt32(b, stfs.f_bsize);
			BufferPutPacket(bOut, b);
		}
		else
			SendStatus(bOut, id, errnoToPortable(errno));
	}
	else
		SendStatus(bOut, id, SSH2_FX_PERMISSION_DENIED);
	FSDestroyPath(realPath);
	free(path);
}
开发者ID:Orea1234,项目名称:mysecureshell,代码行数:34,代码来源:SftpExt.c


示例15: show_session

void show_session(struct session *ses, struct session *ptr)
{
	char temp[BUFFER_SIZE];

	sprintf(temp, "%3d %-12s %20s:%-5s", ptr->socket, ptr->name, ptr->host, ptr->port);

	if (ptr == gtd->ses)
	{
		strcat(temp, " (active)");
	}
	else
	{
		strcat(temp, "         ");
	}

	if (ptr->mccp)
	{
		strcat(temp, " (mccp)   ");
	}

	if (HAS_BIT(ptr->flags, SES_FLAG_SNOOP))
	{
		strcat(temp, " (snooped)");
	}

	if (ptr->logfile)
	{
		strcat(temp, " (logging)");
	}

	tintin_puts2(ses, temp);
}
开发者ID:SlySven,项目名称:tintin,代码行数:32,代码来源:session.c


示例16: check_all_prompts

void check_all_prompts(struct session *ses, char *original, char *line)
{
	struct listroot *root = ses->list[LIST_PROMPT];
	struct listnode *node;

	if (!HAS_BIT(ses->flags, SES_FLAG_SPLIT))
	{
		return;
	}

	for (root->update = 0 ; root->update < root->used ; root->update++)
	{
		if (check_one_regexp(ses, root->list[root->update], line, original, 0))
		{
			node = root->list[root->update];

			if (*node->right)
			{
				substitute(ses, node->right, original, SUB_ARG);
				substitute(ses, original, original, SUB_VAR|SUB_FUN|SUB_COL|SUB_ESC);
			}

			show_debug(ses, LIST_PROMPT, "#DEBUG PROMPT {%s}", node->left);

			do_one_prompt(ses, original, atoi(node->pr));

			SET_BIT(ses->flags, SES_FLAG_GAG);
		}
	}
}
开发者ID:SlySven,项目名称:tintin,代码行数:30,代码来源:prompt.c


示例17: summon_if_hating

/*
 * Se un mob conosce la magia e odia qualcuno allora prova a evocarlo.
 */
void summon_if_hating( CHAR_DATA *ch )
{
	CHAR_DATA *victim;
	char	   buf[MSL];
	char	   name[MIL];
	bool	   found = FALSE;

	if ( ch->position <= POSITION_SLEEP )			return;
	if ( ch->fighting ) 							return;
	if ( ch->fearing )								return;
	if ( !ch->hating )								return;
	if ( HAS_BIT(ch->in_room->flags, ROOM_SAFE) )	return;
	if ( ch->hunting )								return;	/* Non evoca se un pg è vicino abbastanza da poterlo cacciare */

	one_argument( ch->hating->name, name );

	/* Si assicura che il giocatore esista, funziona anche se il pg esce dal gioco */
	for ( victim = first_char;  victim;  victim = victim->next )
	{
		if ( !str_cmp(victim->name, ch->hating->name) )
		{
			found = TRUE;
			break;
		}
	}

	if ( !found )
		return;

	if ( victim->in_room == ch->in_room )
		return;

	sprintf( buf, "cast summon %s", name );
	send_command( ch, buf, CO );
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:38,代码来源:special.c


示例18: redit_disp_exit_flag_menu

/* For exit flags */
void redit_disp_exit_flag_menu( DESCRIPTOR_DATA *d )
{
	EXIT_DATA		   *pexit = d->character->spare_ptr;
	char				buf[MSL];
	int					x;

	write_to_buffer( d, "50\x1B[;H\x1B[2J", 0 );

	for ( x = 0;  x < MAX_EXIT;  x++ )
	{
		if ( (x == EXIT_RES1) || (x == EXIT_RES2) || (x == EXIT_PORTAL) )
			continue;
		ch_printf( d->character, "&g%2d&w) %-20.20s\r\n", x+1, code_name(NULL, x, CODE_EXIT) );
	}

	buf[0] = '\0';
	for ( x = 0;  x < MAX_EXIT;  x++ )
	{
		if ( HAS_BIT(pexit->flags, x) )
		{
			strcat( buf, code_name(NULL, x, CODE_EXIT) );
			strcat( buf, " " );
		}
	}

	ch_printf( d->character, "\r\nExit flags: &c%s&w\r\n"
		"Enter room flags, 0 to quit: ", buf );
	OLC_MODE(d) = REDIT_EXIT_FLAGS;
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:30,代码来源:olc_redit.c


示例19: redit_disp_exit_edit

void redit_disp_exit_edit( DESCRIPTOR_DATA *d )
{
	char				flags[MSL];
	EXIT_DATA		   *pexit = d->character->spare_ptr;
	int					x;

	flags[0] = '\0';
	for ( x = 0;  x < MAX_EXIT;  x++ )
	{
		if ( pexit->flags && HAS_BIT(pexit->flags, x) )
		{
			strcat( flags, code_name(NULL, x, CODE_EXIT) );
			strcat( flags, " " );
		}
	}

	OLC_MODE(d) = REDIT_EXIT_EDIT;
	write_to_buffer( d, "50\x1B[;H\x1B[2J", 0 );

	ch_printf( d->character, "&g1&w) Direction  : &c%s\r\n",	code_name(NULL, pexit->vdir, CODE_DIR) );
	ch_printf( d->character, "&g2&w) To Vnum	: &c%d\r\n",	(pexit->to_room)  ?  pexit->to_room->vnum  :  -1 );
	ch_printf( d->character, "&g3&w) Key		: &c%d\r\n",	pexit->key );
	ch_printf( d->character, "&g4&w) Keyword	: &c%s\r\n",	(VALID_STR(pexit->keyword))  ?  pexit->keyword  :  "(none)" );
	ch_printf( d->character, "&g5&w) Flags      : &c%s\r\n",	(VALID_STR(flags))  ?  flags  :  "(none)" );
	ch_printf( d->character, "&g6&w) Description: &c%s\r\n",	(VALID_STR(pexit->description))  ?  pexit->description  :  "(none)" );
	send_to_char( d->character, "&gQ&w) Quit\r\n" );
	send_to_char( d->character, "\r\nEnter choice: " );
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:28,代码来源:olc_redit.c


示例20: spec_executioner

SPEC_RET spec_executioner( CHAR_DATA *ch )
{
	MOB_PROTO_DATA *cityguard;
	CHAR_DATA	   *victim;
	CHAR_DATA	   *v_next;
	char		   *crime;
	char			buf[MSL];

	if ( !is_awake(ch) )	return FALSE;
	if ( ch->fighting )		return FALSE;

	crime = "";
	for ( victim = ch->in_room->first_person;  victim;  victim = v_next )
	{
		v_next = victim->next_in_room;

		if ( IS_PG(victim) && HAS_BIT_PLR(victim, PLAYER_KILLER) )
		{
			crime = "assassino";
			break;
		}

		if ( IS_PG(victim) && HAS_BIT_PLR(victim, PLAYER_THIEF) )
		{
			crime = "ladro";
			break;
		}
	}

	if ( !victim )
		return FALSE;

	if ( HAS_BIT(ch->in_room->flags, ROOM_SAFE) )
	{
		sprintf( buf, "yell codardo di un %s!", crime );	/* (GR) articolo */
		send_command( ch, buf, CO );
		return TRUE;
	}

	sprintf( buf, "yell Proteggiamo l'innocente dal %s!!", crime );	/* (GR) articolo dal dall' */
	send_command( ch, buf, CO );
	multi_hit( ch, victim, TYPE_UNDEFINED );

	if ( char_died(ch) )
		return TRUE;

	/* Aggiunto il log nel caso che venga a mancare la guardia cittadina */
	cityguard = get_mob_index( NULL, VNUM_MOB_CITYGUARD );

	if ( !cityguard )
	{
		send_log( NULL, LOG_BUG, "spec_executioner: Guardia cittadina mancante - Vnum:[%d]", VNUM_MOB_CITYGUARD );
		return TRUE;
	}

	char_to_room( make_mobile(cityguard), ch->in_room );
	char_to_room( make_mobile(cityguard), ch->in_room );
	return TRUE;
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:59,代码来源:special.c



注:本文中的HAS_BIT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HAS_PCH_SPLIT函数代码示例发布时间:2022-05-30
下一篇:
C++ HASH_OF函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap