Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent auto attacking allies #37257

Merged
merged 2 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6379,7 +6379,7 @@ std::vector<Creature *> player::get_visible_creatures( const int range ) const
std::vector<Creature *> player::get_targetable_creatures( const int range ) const
{
return g->get_creatures_if( [this, range]( const Creature & critter ) -> bool {
return this != &critter && pos() != critter.pos() && // TODO: get rid of fake npcs (pos() check)
return this != &critter && pos() != critter.pos() && attitude_to( critter ) != Creature::Attitude::A_FRIENDLY &&// TODO: get rid of fake npcs (pos() check)
Ramza13 marked this conversation as resolved.
Show resolved Hide resolved
round( rl_dist_exact( pos(), critter.pos() ) ) <= range &&
( sees( critter ) || sees_with_infrared( critter ) );
} );
Expand Down
4 changes: 0 additions & 4 deletions src/ranged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,10 +1189,6 @@ static void update_targets( player &pc, int range, std::vector<Creature *> &targ
}
}

targets.erase( std::remove_if( targets.begin(), targets.end(), [&]( const Creature * e ) {
return pc.attitude_to( *e ) == Creature::Attitude::A_FRIENDLY;
} ), targets.end() );

if( targets.empty() ) {
idx = -1;

Expand Down