Skip to content

Commit

Permalink
Convert a few more comparisons to localized ones
Browse files Browse the repository at this point in the history
  • Loading branch information
jbytheway committed May 7, 2020
1 parent 83e66bb commit 44ca15b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/crafting_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ std::string peek_related_recipe( const recipe *current, const recipe_subset &ava
}
std::stable_sort( related_results.begin(), related_results.end(),
[]( const std::pair<std::string, std::string> &a, const std::pair<std::string, std::string> &b ) {
return a.second < b.second;
return localized_compare( a.second, b.second );
} );

uilist rel_menu;
Expand Down
2 changes: 1 addition & 1 deletion src/dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ bool game::dump_stats( const std::string &what, dump_mode mode,
if( scol >= 0 ) {
std::sort( rows.begin(), rows.end(), [&scol]( const std::vector<std::string> &lhs,
const std::vector<std::string> &rhs ) {
return lhs[ scol ] < rhs[ scol ];
return localized_compare( lhs[ scol ], rhs[ scol ] );
} );
}

Expand Down
4 changes: 2 additions & 2 deletions src/newcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1797,8 +1797,8 @@ tab_direction set_skills( avatar &u, points_left &points )
std::sort( elem.second.begin(), elem.second.end(),
[]( const std::pair<std::string, int> &lhs,
const std::pair<std::string, int> &rhs ) {
return lhs.second < rhs.second ||
( lhs.second == rhs.second && lhs.first < rhs.first );
return localized_compare( std::make_pair( lhs.second, lhs.first ),
std::make_pair( rhs.second, rhs.first ) );
} );

const std::string rec_temp = enumerate_as_string( elem.second.begin(), elem.second.end(),
Expand Down
2 changes: 1 addition & 1 deletion src/scores_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static std::string get_achievements_text( const achievements_tracker &achievemen
achievement_completion comp = achievements.is_completed( ach->id );
return std::make_tuple( comp, ach->name().translated(), ach );
} );
std::sort( sortable_achievements.begin(), sortable_achievements.end() );
std::sort( sortable_achievements.begin(), sortable_achievements.end(), localized_compare );
for( const sortable_achievement &ach : sortable_achievements ) {
os += achievements.ui_text_for( std::get<const achievement *>( ach ) ) + "\n";
}
Expand Down

0 comments on commit 44ca15b

Please sign in to comment.