当前位置: 首页>>代码示例>>C++>>正文


C++ can_see函数代码示例

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


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

示例1: spec_clan_guard

bool spec_clan_guard( CHAR_DATA * ch )
{
  CHAR_DATA *victim = NULL;
  CHAR_DATA *v_next = NULL;

  if( !IS_AWAKE( ch ) || ch->fighting || !ch->mob_clan )
    return FALSE;

  for( victim = ch->in_room->first_person; victim; victim = v_next )
  {
    v_next = victim->next_in_room;
    if( !can_see( ch, victim ) )
      continue;
    if( get_timer( victim, TIMER_RECENTFIGHT ) > 0 )
      continue;
    if( !IS_NPC( victim ) && victim->pcdata && victim->pcdata->clan
	&& IS_AWAKE( victim ) && victim->pcdata->clan != ch->mob_clan
	&& nifty_is_name( victim->pcdata->clan->name,
	  ch->mob_clan->atwar ) )
    {
      char buf[MAX_STRING_LENGTH];
      snprintf( buf, MAX_STRING_LENGTH, "%s",
		"Hey you're not allowed in here!" );
      do_yell( ch, buf );
      multi_hit( ch, victim, TYPE_UNDEFINED );
      return TRUE;
    }
  }

  return FALSE;
}
开发者ID:ccubed,项目名称:SWRCustom,代码行数:31,代码来源:special.c

示例2: spec_police_fine

bool spec_police_fine( CHAR_DATA * ch )
{
   CHAR_DATA *victim;
   CHAR_DATA *v_next;
   int vip;
   char buf[MAX_STRING_LENGTH];

   if( !IS_AWAKE( ch ) || ch->fighting )
      return FALSE;

   for( victim = ch->in_room->first_person; victim; victim = v_next )
   {
      v_next = victim->next_in_room;
      if( IS_NPC( victim ) )
         continue;
      if( !can_see( ch, victim ) )
         continue;
      if( number_bits( 1 ) == 0 )
         continue;
      for( vip = 0; vip <= 31; vip++ )
         if( IS_SET( ch->vip_flags, 1 << vip ) && IS_SET( victim->pcdata->wanted_flags, 1 << vip ) )
         {
            sprintf( buf, "Hey you're wanted on %s!", planet_flags[vip] );
            do_say( ch, buf );
            act( AT_ACTION, "$n fines $N an enormous amount of money.", ch, NULL, victim, TO_NOTVICT );
            act( AT_ACTION, "$n fines you an enourmous amount of money.", ch, NULL, victim, TO_VICT );
            victim->gold /= 2;
            REMOVE_BIT( victim->pcdata->wanted_flags, 1 << vip );
            return TRUE;
         }
   }
   return FALSE;
}
开发者ID:AndrewBudd,项目名称:swr-fuss-ace,代码行数:33,代码来源:special.c

示例3: do_finger

/* File read/write code redone using standard Smaug I/O routines - Samson 9-12-98 */
void do_finger( CHAR_DATA *ch, char *argument )
{
  CHAR_DATA *victim;

  if( IS_NPC(ch) )
  {
     send_to_char( "Mobs can't use the finger command.\n\r", ch );
     return;
  }

  if ( argument[0] == '\0' )
  {
      send_to_char("Finger whom?\n\r", ch );
      return;
  }

  victim = get_char_world(ch, argument);

  if ( ( victim == NULL ) || (!victim) )
  {
      read_finger( ch, argument );
      return;
  }

  if ( IS_IMMORTAL(victim) && !IS_IMMORTAL(ch) )
  {
	send_to_char( "Cannot finger an immortal.\n\r", ch );
	return;
  }
/*
  if ( ( ch->top_level < victim->top_level && ch->top_level < LEVEL_INFINITE ) && IS_IMMORTAL(ch) )
  {
	send_to_char( "Cannot finger an immortal above your own level.\n\r", ch );
	return;
  }
*/
  if ( IS_NPC( victim ) )
  {
      read_finger( ch, argument );
      return;
  }

  if ( !can_see( ch, victim ) )
  {
      send_to_char("They aren't here.\n\r", ch );
      return;
  }

  send_to_char("&w          Finger Info\n\r", ch);
  send_to_char("          -----------\n\r", ch);
  ch_printf(ch, "&wName : &G%-20s &wAge: &G%d\n\r", victim->name, victim->pcage );
  ch_printf(ch, "&wSex  : &G%-20s\n\r",
                victim->sex == SEX_MALE   ? "Male"   :
                victim->sex == SEX_FEMALE ? "Female" : "Neutral" );
  ch_printf(ch, "&wTitle: &G%s\n\r", victim->pcdata->title );
  ch_printf(ch, "&wHomepage: &G%s\n\r", victim->pcdata->homepage ? victim->pcdata->homepage : "None" );
//  ch_printf(ch, "&wClan: &G%s\n\r", victim->pcdata->clan ? victim->pcdata->clan->name : "Unclanned" );
  ch_printf(ch, "&wLast on: &G%s\n\r", (char *) ctime( &ch->logon ) );
  return;
}
开发者ID:bcass,项目名称:Cowboy-Bebop-Space-Cowboy,代码行数:61,代码来源:finger.c

示例4: compute_dlight

void compute_dlight(int xc,int yc)
{
        int xs,ys,xe,ye,x,y,v,d,best=0,m;
        unsigned long long prof;

        prof=prof_start();

        xs=max(0,xc-LIGHTDIST);
        ys=max(0,yc-LIGHTDIST);
        xe=min(MAPX-1,xc+1+LIGHTDIST);
        ye=min(MAPY-1,yc+1+LIGHTDIST);

        for (y=ys; y<ye; y++) {
                m=y*MAPX+xs;
                for (x=xs; x<xe; x++,m++) {
                        if ((xc-x)*(xc-x)+(yc-y)*(yc-y)>(LIGHTDIST*LIGHTDIST+1)) continue;
                        if (!(map[m].flags&MF_INDOORS)) {
                                if ((v=can_see(0,xc,yc,x,y,LIGHTDIST))==0) continue;
                                d=256/(v*(abs(xc-x)+abs(yc-y)));
                                if (d>best) best=d;
                        }
                }
        }
        if (best>256) best=256;
        map[xc+yc*MAPX].dlight=best;

        prof_stop(18,prof);
}
开发者ID:AstoniaDev,项目名称:openMerc,代码行数:28,代码来源:helper.c

示例5: number_argument

Character *get_char_world(Character *ch, const char *argument)
{
    char arg[BUF_SIZ];
    long number;
    Character *wch;
    int count;

    if ((wch = get_char_room(ch, argument)) != NULL) {
        return wch;
    }
    number = number_argument(argument, arg);
    count = 0;

    for (wch = first_character; wch != NULL; wch = wch->next)
    {

        if (wch->inRoom == NULL || !can_see(ch, wch)
                || !is_name(arg, wch->name)) {
            continue;
        }

        if (++count == number) {
            return wch;
        }
    }
    return NULL;
}
开发者ID:ryjen,项目名称:muddled,代码行数:27,代码来源:character.c

示例6: attitude

/* will_reach() is used for determining whether we'll get to stairs (and
 * potentially other locations of interest).  It is generally permissive.
 * TODO: Pathfinding;
         Make sure that non-smashing monsters won't "teleport" through windows
         Injure monsters if they're gonna be walking through pits or whatevs
 */
bool monster::will_reach(int x, int y)
{
    monster_attitude att = attitude(&(g->u));
    if (att != MATT_FOLLOW && att != MATT_ATTACK && att != MATT_FRIEND)
        return false;

    if (has_flag(MF_DIGS))
        return false;

    if (has_flag(MF_IMMOBILE) && (posx() != x || posy() != y))
        return false;

    std::vector<point> path = g->m.route(posx(), posy(), x, y, has_flag(MF_BASHES));
    if (path.size() == 0)
        return false;

    if (has_flag(MF_SMELLS) && g->scent(posx(), posy()) > 0 &&
            g->scent(x, y) > g->scent(posx(), posy()))
        return true;

    if (can_hear() && wandf > 0 && rl_dist(wandx, wandy, x, y) <= 2 &&
            rl_dist(posx(), posy(), wandx, wandy) <= wandf)
        return true;

    int t;
    if (can_see() && g->m.sees(posx(), posy(), x, y, g->light_level(), t))
        return true;

    return false;
}
开发者ID:Oddzball,项目名称:Cataclysm-DDA,代码行数:36,代码来源:monmove.cpp

示例7:

const char *char_data::get_name( CHAR_DATA *looker )
{
    if ( looker != NULL )
    {
        if ( can_see(looker, this) )
        {
            if ( IS_NPC(this) )
                return npcdata->short_descr;
            else
            {
                if ( IS_WOLF(this) && (IS_SHIFTED(this) || IS_RAGED(this)) )
                    return "A Large @@[email protected]@N";
                else
                    return name.c_str();
            }
        }
        else
        {
            if ( IS_IMMORTAL(this) )
                return "A Mystical Being";
            else
                return "Someone";
        }
    }
    else
    {
        if ( IS_NPC(this) )
            return npcdata->short_descr;
        else
            return name.c_str();
    }

    return "Unknown!";
}
开发者ID:Catcheeto,项目名称:ackfuss,代码行数:34,代码来源:mbr_fun.c

示例8: mp_greet_trigger

void mp_greet_trigger( CHAR_DATA *ch )
{
    CHAR_DATA *mob;

    for ( mob = ch->in_room->people; mob != NULL; mob = mob->next_in_room )
    {    
	if ( IS_NPC( mob )
	&& ( HAS_TRIGGER(mob, TRIG_GREET) || HAS_TRIGGER(mob,TRIG_GRALL) ) )
	{
	    /*
	     * Greet trigger works only if the mobile is not busy
	     * (fighting etc.). If you want to catch all players, use
	     * GrAll trigger
	     */
	    if ( HAS_TRIGGER( mob,TRIG_GREET )
	    &&   mob->position == mob->pIndexData->default_pos
	    &&   can_see( mob, ch ) )
		mp_percent_trigger( mob, ch, NULL, NULL, TRIG_GREET );
	    else                 
	    if ( HAS_TRIGGER( mob, TRIG_GRALL ) )
		mp_percent_trigger( mob, ch, NULL, NULL, TRIG_GRALL );
	}
    }
    return;
}
开发者ID:Firehed,项目名称:RotK,代码行数:25,代码来源:mob_prog.c

示例9: find_clear_spot

// Looks at all spaces within 2, looking for a spot which is clear of nastiness and beings
// returns {0,0} if none found
// THIS MAKES NO ADJUSTMENTS FOR BIG MONSTERS!!!
location find_clear_spot(location from_where,short mode)
//mode; // 0 - normal  1 - prefer adjacent space
{
	location loc,store_loc;
	short num_tries = 0,r1;
	
	while (num_tries < 75) {
		num_tries++;
		loc = from_where;
		r1 = get_ran(1,-2,2);
		loc.x = loc.x + r1;
		r1 = get_ran(1,-2,2);
		loc.y = loc.y + r1;
		if ((loc_off_act_area(loc) == false) && (is_blocked(loc) == false)
			&& (can_see(from_where,loc,1) == 0)
			&& (!(is_combat()) || (pc_there(loc) == 6))
			&& (!(is_town()) || (loc != univ.town.p_loc))
			 && (!(univ.town.misc_i(loc.x,loc.y) & 248)) && // check for crate, barrel, barrier, quickfire
			(!(univ.town.explored(loc.x,loc.y) & 254))) { // check for fields, clouds
				if ((mode == 0) || ((mode == 1) && (adjacent(from_where,loc) == true)))
					return loc;
					else store_loc = loc;			
				}
		}
	return store_loc;
}
开发者ID:PBrookfield,项目名称:cboe-msvc,代码行数:29,代码来源:boe.monster.cpp

示例10: ant_dodge

static int ant_dodge(game_object *o)
{
  if (o->lvars[ANT_need_to_dodge]==1)
  {
    o->lvars[ANT_need_to_dodge]=0;
    if ((jrand()%2)==0)
    {
      o->set_state(stopped);
      o->set_aistate(ANT_JUMP);
      if (!can_see(o,o->x,o->y,o->x,o->y-120))   // is there a roof above?
      {
    o->set_yvel(-17);
    o->set_xvel(0);
    o->set_aistate(ANT_JUMP_ROOF);
    ant_ai();
      } else
      {
    o->set_yvel(-12);
    if (o->direction>0)
      o->set_xvel(22);
    else o->set_xvel(-22);
    o->set_aistate(ANT_JUMP);
      }
    }
    return 1;
  } else return 0;
}
开发者ID:Xenoveritas,项目名称:abuse,代码行数:27,代码来源:ant.cpp

示例11: spell_mass_refresh

/*
 * Mass refresh will refresh every visible character in the room for only
 * 3 more mana than a normal refresh.  It also has an additional 1 to 10
 * movement random bonus on top of the normal refresh.
 */
void spell_mass_refresh(int sn, int level, CHAR_DATA * ch, void *vo, int target)
{
    CHAR_DATA *gch;
    char buf[MAX_STRING_LENGTH];

    for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
    {
        // If the character can't be seen they can't be refreshed, we don't
        // want this used to sniff out hidden characters.
        if (!can_see(ch, gch))
        {
            continue;
        }

        gch->move = UMIN(gch->move + level + number_range(1, 10), gch->max_move);

        if (gch->max_move == gch->move)
        {
            send_to_char("You feel fully refreshed!\r\n", gch);
        }
        else
        {
            send_to_char("You feel less tired.\r\n", gch);
        }

        if (gch != ch)
        {
            sprintf(buf, "%s has been refreshed.\r\n", gch->name);
            send_to_char(buf, ch);
        }

    }

} // end spell_mass_refresh
开发者ID:blakepell,项目名称:CrimsonSkies,代码行数:39,代码来源:class_healer.c

示例12: spec_clan_guard

bool spec_clan_guard(CHAR_DATA * ch)
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;

	if (!IS_AWAKE(ch) || ch->fighting)
		return FALSE;

	for (victim = ch->in_room->first_person; victim; victim = v_next) {
		v_next = victim->next_in_room;
		if (!can_see(ch, victim))
			continue;
		if (get_timer(victim, TIMER_RECENTFIGHT) > 0)
			continue;
		if (!IS_NPC(victim) && victim->pcdata && victim->pcdata->clan
		    && IS_AWAKE(victim)
		    && str_cmp(ch->name, victim->pcdata->clan->name)) {
			do_yell(ch, "Hey your not allowed in here!");
			multi_hit(ch, victim, TYPE_UNDEFINED);
			return TRUE;
		}
	}

	return FALSE;
}
开发者ID:danielkrainas,项目名称:ganadia,代码行数:25,代码来源:special.c

示例13: spec_new_republic_trooper

bool spec_new_republic_trooper(CHAR_DATA * ch)
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;

	if (!IS_AWAKE(ch) || ch->fighting)
		return FALSE;

	for (victim = ch->in_room->first_person; victim; victim = v_next) {
		v_next = victim->next_in_room;
		if (!can_see(ch, victim))
			continue;
		if (get_timer(victim, TIMER_RECENTFIGHT) > 0)
			continue;
		if ((IS_NPC(victim) && nifty_is_name("imperial", victim->name)
		     && victim->fighting && who_fighting(victim) != ch) ||
		    (!IS_NPC(victim) && victim->pcdata && victim->pcdata->clan
		     && IS_AWAKE(victim)
		     && nifty_is_name("empire", victim->pcdata->clan->name))) {
			do_yell(ch, "Long live the New Republic!");
			multi_hit(ch, victim, TYPE_UNDEFINED);
			return TRUE;
		}

	}

	return FALSE;

}
开发者ID:danielkrainas,项目名称:ganadia,代码行数:29,代码来源:special.c

示例14: spec_police_attack

bool spec_police_attack(CHAR_DATA * ch)
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	int vip;
	char buf[MAX_STRING_LENGTH];

	if (!IS_AWAKE(ch) || ch->fighting)
		return FALSE;

	for (victim = ch->in_room->first_person; victim; victim = v_next) {
		v_next = victim->next_in_room;
		if (IS_NPC(victim))
			continue;
		if (!can_see(ch, victim))
			continue;
		if (number_bits(1) == 0)
			continue;
		for (vip = 0; vip < 32; vip++)
			if (IS_SET(ch->vip_flags, 1 << vip)
			    && IS_SET(victim->pcdata->wanted_flags, 1 << vip)) {
				sprintf(buf, "Hey you're wanted on %s!",
					planet_flags[vip]);
				do_say(ch, buf);
				REMOVE_BIT(victim->pcdata->wanted_flags,
					   1 << vip);
				multi_hit(ch, victim, TYPE_UNDEFINED);
				return TRUE;
			}

	}

	return FALSE;

}
开发者ID:danielkrainas,项目名称:ganadia,代码行数:35,代码来源:special.c

示例15: attitude

/* will_reach() is used for determining whether we'll get to stairs (and
 * potentially other locations of interest).  It is generally permissive.
 * TODO: Pathfinding;
         Make sure that non-smashing monsters won't "teleport" through windows
         Injure monsters if they're gonna be walking through pits or whatevs
 */
bool monster::will_reach(game *g, int x, int y)
{
 monster_attitude att = attitude(&(g->u));
 if (att != MATT_FOLLOW && att != MATT_ATTACK && att != MATT_FRIEND)
  return false;

 if (has_flag(MF_DIGS))
  return false;

 if (has_flag(MF_IMMOBILE) && (posx != x || posy != y))
  return false;

 if (has_flag(MF_SMELLS) && g->scent(posx, posy) > 0 &&
     g->scent(x, y) > g->scent(posx, posy))
  return true;

 if (can_hear() && wandf > 0 && rl_dist(wandx, wandy, x, y) <= 2 &&
     rl_dist(posx, posy, wandx, wandy) <= wandf)
  return true;

 int t;
 if (can_see() && g->m.sees(posx, posy, x, y, g->light_level(), t))
  return true;

 return false;
}
开发者ID:AkrionXxarr,项目名称:Cataclysm-DDA,代码行数:32,代码来源:monmove.cpp


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