本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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!";
}
示例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;
}
示例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;
}
示例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;
}
示例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
示例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;
}
示例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;
}
示例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;
}
示例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;
}