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

Trivial: minor speedup of monster->Character attitude calculation #45421

Merged
Merged
Changes from all commits
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
17 changes: 9 additions & 8 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1132,19 +1132,20 @@ monster_attitude monster::attitude( const Character *u ) const
}

for( const trait_id &mut : u->get_mutations() ) {
for( const std::pair<const species_id, int> &elem : mut.obj().anger_relations ) {
if( type->in_species( elem.first ) ) {
effective_anger += elem.second;
}
const mutation_branch &branch = *mut;
if( branch.ignored_by.empty() && branch.anger_relations.empty() ) {
continue;
}
}

for( const trait_id &mut : u->get_mutations() ) {
for( const species_id &spe : mut.obj().ignored_by ) {
for( const species_id &spe : branch.ignored_by ) {
if( type->in_species( spe ) ) {
return MATT_IGNORE;
}
}
for( const std::pair<const species_id, int> &elem : branch.anger_relations ) {
if( type->in_species( elem.first ) ) {
effective_anger += elem.second;
}
}
}
}

Expand Down