您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ tf_has函数代码示例

51自学网 2021-06-03 08:47:31
  C++
这篇教程C++ tf_has函数代码示例写得很实用,希望能帮到您。

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

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

示例1: is_valid_pf

bool is_valid_pf(int y, int x){    feature_type *f_ptr = NULL;    int feat = cave_feat[y][x];    /* Hack -- assume unvisited is permitted */    if (!(cave_info[y][x] & (CAVE_MARK)))	return (TRUE);    /* Get mimiced feat */    f_ptr = &f_info[f_info[feat].mimic];    /* Optionally alter known traps/doors on movement */    if (OPT(easy_alter) && (tf_has(f_ptr->flags, TF_DOOR_CLOSED)			    || tf_has(f_ptr->flags, TF_TRAP))) {	return (TRUE);    }    /* Require moveable space */    if (tf_has(f_ptr->flags, TF_WALL))	return (FALSE);    /* Don't move over lava, web or void */    if ((feat == FEAT_LAVA) || (feat == FEAT_WEB) || (feat == FEAT_VOID))	return (FALSE);    /* Otherwise good */    return (TRUE);}
开发者ID:artes-liberales,项目名称:FAangband,代码行数:29,


示例2: square_isbrokendoor

bool square_isbrokendoor(struct chunk *c, int y, int x){	int feat = c->squares[y][x].feat;    return (tf_has(f_info[feat].flags, TF_DOOR_ANY) &&			tf_has(f_info[feat].flags, TF_PASSABLE) &&			!tf_has(f_info[feat].flags, TF_CLOSABLE));}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:7,


示例3: pick_trap

/** * Instantiate a player trap */static int pick_trap(int feat, int trap_level){    int trap_index = 0;    feature_type *f_ptr = &f_info[feat];	    struct trap_kind *kind;    bool trap_is_okay = FALSE;	    /* Paranoia */    if (!tf_has(f_ptr->flags, TF_TRAP))		return -1;	    /* Try to create a trap appropriate to the level.  Make certain that at     * least one trap type can be made on any possible level. -LM- */    while (!trap_is_okay) {		/* Pick at random. */		trap_index = randint0(z_info->trap_max);		/* Get this trap */		kind = &trap_info[trap_index];		/* Ensure that this is a player trap */		if (!kind->name) continue;		if (!trf_has(kind->flags, TRF_TRAP)) continue;			/* Require that trap_level not be too low */		if (kind->min_depth > trap_level) continue;		/* Assume legal until proven otherwise. */		trap_is_okay = TRUE;		/* Floor? */		if (tf_has(f_ptr->flags, TF_FLOOR) && !trf_has(kind->flags, TRF_FLOOR))			trap_is_okay = FALSE;		/* Check legality of trapdoors. */		if (trf_has(kind->flags, TRF_DOWN)) {			/* No trap doors on quest levels */			if (is_quest(player->depth)) trap_is_okay = FALSE;			/* No trap doors on the deepest level */			if (player->depth >= z_info->max_depth - 1)				trap_is_okay = FALSE;	    }    }    /* Return our chosen trap */    return (trap_index);}
开发者ID:Daedelus01,项目名称:angband,代码行数:53,


示例4: see_wall

/** * Hack -- Check for a "known wall" (see below) */static int see_wall(int dir, int y, int x){    feature_type *f_ptr;    /* Get the new location */    y += ddy[dir];    x += ddx[dir];    /* Illegal grids are not known walls XXX XXX XXX */    if (!in_bounds(y, x))	return (FALSE);    f_ptr = &f_info[cave_feat[y][x]];    /* Non-wall grids are not known walls */    if (!tf_has(f_ptr->flags, TF_WALL))	return (FALSE);    /* Unknown walls are not known walls */    if (!cave_has(cave_info[y][x], CAVE_MARK))	return (FALSE);    /* Default */    return (TRUE);}
开发者ID:mjdrinen,项目名称:FAangband,代码行数:28,


示例5: fall_off_cliff

/** * Handle falling off cliffs  */void fall_off_cliff(int levels){	int dam;	msg("You fall into the darkness!");	/* New chunk */	chunk_change(1, 0, 0);	/* Hit the ground... */	if (!tf_has(f_info[cave_feat[p_ptr->py][p_ptr->px]].flags, TF_FALL)) {		if (p_ptr->state.ffall) {			notice_obj(OF_FEATHER, 0);			dam = damroll(2 * levels, 8);			(void) inc_timed(TMD_STUN, damroll(2 * levels, 8), TRUE);			(void) inc_timed(TMD_CUT, damroll(2 * levels, 8), TRUE);		} else {			dam = damroll(4 * levels, 8);			(void) inc_timed(TMD_STUN, damroll(4 * levels, 8), TRUE);			(void) inc_timed(TMD_CUT, damroll(4 * levels, 8), TRUE);		}		take_hit(dam, "falling off a precipice");	}	/* ...or not */	else		fall_off_cliff(levels + 1);}
开发者ID:NickMcConnell,项目名称:Beleriand,代码行数:31,


示例6: do_cmd_wiz_bamf

/** * Hack -- Teleport to the target.  Oangband asks for a target after  * the command. */static void do_cmd_wiz_bamf(void){	feature_type *f_ptr;	/* target starts at player. */	s16b ny = 0;	s16b nx = 0;	/* Use the targeting function. */	if (!target_set_interactive(TARGET_LOOK, -1, -1))		return;	/* grab the target coords. */	target_get(&nx, &ny);	/* Test for passable terrain. */	f_ptr = &f_info[cave_feat[ny][nx]];	if (!tf_has(f_ptr->flags, TF_PASSABLE)) {		msg("The square you are aiming for is impassable.");	}	/* The simple act of controlled teleport. */	else		teleport_player_to(ny, nx, TRUE);}
开发者ID:NickMcConnell,项目名称:Beleriand,代码行数:29,


示例7: cave_illuminate

/** * Light or Darken the town */void cave_illuminate(struct chunk *c, bool daytime){	int y, x, i;	/* Apply light or darkness */	for (y = 0; y < c->height; y++)		for (x = 0; x < c->width; x++) {			int d;			bool light = FALSE;			feature_type *f_ptr = &f_info[c->squares[y][x].feat];						/* Skip grids with no surrounding floors or stairs */			for (d = 0; d < 9; d++) {				/* Extract adjacent (legal) location */				int yy = y + ddy_ddd[d];				int xx = x + ddx_ddd[d];				/* Paranoia */				if (!square_in_bounds_fully(c, yy, xx)) continue;				/* Test */				if (square_isfloor(c, yy, xx) || square_isstairs(c, yy, xx))					light = TRUE;			}			if (!light) continue;			/* Only interesting grids at night */			if (daytime || !tf_has(f_ptr->flags, TF_FLOOR)) {				sqinfo_on(c->squares[y][x].info, SQUARE_GLOW);				sqinfo_on(c->squares[y][x].info, SQUARE_MARK);			} else {				sqinfo_off(c->squares[y][x].info, SQUARE_GLOW);				sqinfo_off(c->squares[y][x].info, SQUARE_MARK);			}		}							/* Light shop doorways */	for (y = 0; y < c->height; y++) {		for (x = 0; x < c->width; x++) {			if (!square_isshop(c, y, x))				continue;			for (i = 0; i < 8; i++) {				int yy = y + ddy_ddd[i];				int xx = x + ddx_ddd[i];				sqinfo_on(c->squares[yy][xx].info, SQUARE_GLOW);				sqinfo_on(c->squares[yy][xx].info, SQUARE_MARK);			}		}	}	/* Fully update the visuals */	player->upkeep->update |= (PU_FORGET_VIEW | PU_UPDATE_VIEW | PU_MONSTERS);	/* Redraw map, monster list */	player->upkeep->redraw |= (PR_MAP | PR_MONLIST | PR_ITEMLIST);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:62,


示例8: next_to_walls

/** * Count the number of walls adjacent to the given grid. * * Note -- Assumes "in_bounds_fully(y, x)" */int next_to_walls(int y, int x){    int i, k = 0;    feature_type *f_ptr;    /* Count the adjacent wall grids */    for (i = 0; i < 4; i++)     {	/* Extract the terrain info */	f_ptr = &f_info[cave_feat[y + ddy_ddd[i]][x + ddx_ddd[i]]];	if (tf_has(f_ptr->flags, TF_WALL) &&	    !tf_has(f_ptr->flags, TF_DOOR_ANY))	    k++;    }    return (k);}
开发者ID:mtadd,项目名称:FAangband,代码行数:23,


示例9: grid_get_attr

/** * Apply text lighting effects */static void grid_get_attr(grid_data *g, int *a){    feature_type *f_ptr = &f_info[g->f_idx];	/* Save the high-bit, since it's used for attr inversion in GCU */	int a0 = *a & 0x80;	/* Remove the high bit so we can add it back again at the end */	*a = (*a & 0x7F);	/* Never play with fg colours for treasure */	if (!feat_is_treasure(g->f_idx)) {		/* Tint trap detection borders */		if (g->trapborder)			*a = (g->in_view ? COLOUR_L_GREEN : COLOUR_GREEN);		/* Only apply lighting effects when the attr is white --		 * this is to stop e.g. doors going grey when out of LOS */		if (*a == COLOUR_WHITE) {			/* If it's a floor tile then we'll tint based on lighting. */			if (tf_has(f_ptr->flags, TF_TORCH))				switch (g->lighting) {					case LIGHTING_TORCH: *a = COLOUR_YELLOW; break;					case LIGHTING_LIT: *a = COLOUR_L_DARK; break;					case LIGHTING_DARK: *a = COLOUR_L_DARK; break;					default: break;				}			/* If it's another kind of tile, only tint when unlit. */			else if (g->lighting == LIGHTING_DARK ||					 g->lighting == LIGHTING_LIT)				*a = COLOUR_L_DARK;		} else if (feat_is_magma(g->f_idx) || feat_is_quartz(g->f_idx)) {			if (!g->in_view) {				*a = COLOUR_L_DARK;			}		}	}	/* Hybrid or block walls -- for GCU, then for everyone else */	if (a0) {		*a = a0 | *a;	} else if (use_graphics == GRAPHICS_NONE && feat_is_wall(g->f_idx)) {		if (OPT(hybrid_walls))			*a = *a + (MAX_COLORS * BG_DARK);		else if (OPT(solid_walls))			*a = *a + (MAX_COLORS * BG_SAME);	}}
开发者ID:pnd10,项目名称:angband,代码行数:53,


示例10: square_player_trap_allowed

/** * Determine if a cave grid is allowed to have player traps in it. */bool square_player_trap_allowed(struct chunk *c, int y, int x){    /*     * We currently forbid multiple traps in a grid under normal conditions.     * If this changes, various bits of code elsewhere will have to change too.     */    if (square_istrap(c, y, x))		return FALSE;    /* We currently forbid traps in a grid with objects. */    if (square_object(c, y, x))		return FALSE;    /* Check the feature trap flag */    return (tf_has(f_info[c->squares[y][x].feat].flags, TF_TRAP));}
开发者ID:Daedelus01,项目名称:angband,代码行数:19,


示例11: place_trap

/** * Places a random trap at the given location. * * The location must be a legal, naked, floor grid. * * Note that all traps start out as "invisible" and "untyped", and then * when they are "discovered" (by detecting them or setting them off), * the trap is "instantiated" as a visible, "typed", trap. */extern void place_trap(int y, int x){    int d, grass = 0, floor = 0;    feature_type *f_ptr = &f_info[cave_feat[y][x]];    /* Paranoia */    if (!in_bounds(y, x))        return;    /* Hack - handle trees */    if ((tf_has(f_ptr->flags, TF_TREE)) && (cave_o_idx[y][x] == 0)            && (cave_m_idx[y][x] >= 0)) {        if (cave_feat[y][x] == FEAT_TREE)            cave_set_feat(y, x, FEAT_TREE_INVIS);        else if (cave_feat[y][x] == FEAT_TREE2)            cave_set_feat(y, x, FEAT_TREE2_INVIS);        return;    }    /* Require empty, clean, floor grid */    if (!cave_naked_bold(y, x))        return;    /* Adjacent grids vote for grass or floor */    for (d = 0; d < 8; d++) {        if (cave_feat[y + ddy_ddd[d]][x + ddx_ddd[d]] == FEAT_FLOOR)            floor++;        else if (cave_feat[y + ddy_ddd[d]][x + ddx_ddd[d]] == FEAT_GRASS)            grass++;    }    /* Place an invisible trap */    if (grass > floor)        cave_set_feat(y, x, FEAT_GRASS_INVIS);    else        cave_set_feat(y, x, FEAT_INVIS);}
开发者ID:artes-liberales,项目名称:FAangband,代码行数:48,


示例12: square_isopendoor

/** * True if the square is an open door. */bool square_isopendoor(struct chunk *c, int y, int x){    return (tf_has(f_info[c->squares[y][x].feat].flags, TF_CLOSABLE));}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:7,


示例13: feat_is_passable

/** * True if the feature is passable by the player. */bool feat_is_passable(int feat){	return tf_has(f_info[feat].flags, TF_PASSABLE);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:7,


示例14: feat_is_monster_walkable

/** * True if a monster can walk through the feature. */bool feat_is_monster_walkable(int feat){	return tf_has(f_info[feat].flags, TF_PASSABLE);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:7,


示例15: square_isinteresting

bool square_isinteresting(struct chunk *c, int y, int x){	int f = c->squares[y][x].feat;	return tf_has(f_info[f].flags, TF_INTERESTING);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:5,


示例16: feat_is_treasure

/** * True if the square is a mineral wall with treasure (magma/quartz). */bool feat_is_treasure(int feat){	return (tf_has(f_info[feat].flags, TF_GOLD));}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:7,


示例17: feat_is_magma

/** * True if the square is a magma wall. */bool feat_is_magma(int feat){	return tf_has(f_info[feat].flags, TF_MAGMA);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:7,


示例18: square_isdoor

/** * True if the square is a door. * * This includes open, closed, and hidden doors. */bool square_isdoor(struct chunk *c, int y, int x){	int feat = c->squares[y][x].feat;	return tf_has(f_info[feat].flags, TF_DOOR_ANY);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:10,


示例19: square_isdownstairs

/** * True if square is a down stair. */bool square_isdownstairs(struct chunk *c, int y, int x){	int feat = c->squares[y][x].feat;	return tf_has(f_info[feat].flags, TF_DOWNSTAIR);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:8,


示例20: square_isfloor

/** * True if the square is normal open floor. */bool square_isfloor(struct chunk *c, int y, int x){	return tf_has(f_info[c->squares[y][x].feat].flags, TF_FLOOR);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:7,


示例21: feat_is_quartz

/** * True if the square is a quartz wall. */bool feat_is_quartz(int feat){	return tf_has(f_info[feat].flags, TF_QUARTZ);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:7,


示例22: square_isrock

/** * True if the square is a normal granite rock wall. */bool square_isrock(struct chunk *c, int y, int x){	return (tf_has(f_info[c->squares[y][x].feat].flags, TF_GRANITE) &&			!tf_has(f_info[c->squares[y][x].feat].flags, TF_DOOR_ANY));}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:8,


示例23: square_seemslikewall

bool square_seemslikewall(struct chunk *c, int y, int x){	return tf_has(f_info[c->squares[y][x].feat].flags, TF_ROCK);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:4,


示例24: square_isperm

/** * True if the square is a permanent wall. */bool square_isperm(struct chunk *c, int y, int x){	return (tf_has(f_info[c->squares[y][x].feat].flags, TF_PERMANENT) &&			tf_has(f_info[c->squares[y][x].feat].flags, TF_ROCK));}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:8,


示例25: feat_is_wall

/** * True is the feature is a solid wall (not rubble). */bool feat_is_wall(int feat){	return tf_has(f_info[feat].flags, TF_WALL);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:7,


示例26: square_hasgoldvein

bool square_hasgoldvein(struct chunk *c, int y, int x){	return tf_has(f_info[c->squares[y][x].feat].flags, TF_GOLD);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:4,


示例27: feat_is_shop

/** * True if the feature is a shop entrance. */bool feat_is_shop(int feat){	return tf_has(f_info[feat].flags, TF_SHOP);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:7,


示例28: square_isrubble

/** * True if the square is rubble. */bool square_isrubble(struct chunk *c, int y, int x){    return (!tf_has(f_info[c->squares[y][x].feat].flags, TF_WALL) &&			tf_has(f_info[c->squares[y][x].feat].flags, TF_ROCK));}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:8,


示例29: feat_is_projectable

/** * True if any projectable can pass through the feature. */bool feat_is_projectable(int feat){	return tf_has(f_info[feat].flags, TF_PROJECT);}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:7,


示例30: square_issecretdoor

/** * True if the square is a hidden secret door. * * These squares appear as if they were granite--when detected a secret door * is replaced by a closed door. */bool square_issecretdoor(struct chunk *c, int y, int x){    return (tf_has(f_info[c->squares[y][x].feat].flags, TF_DOOR_ANY) &&			tf_has(f_info[c->squares[y][x].feat].flags, TF_ROCK));}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:11,



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


C++ tfind函数代码示例
C++ tf函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。