only output when changes are made

avoids spamming the console when `orders sort` is run on repeat
develop
myk002 2021-09-01 16:52:11 -07:00
parent 2249b42506
commit bd0a2e3877
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 9 additions and 4 deletions

@ -945,10 +945,15 @@ static command_result orders_sort_command(color_ostream & out)
{
CoreSuspender suspend;
std::stable_sort(world->manager_orders.begin(), world->manager_orders.end(),
compare_freq);
out << "Sorted " << world->manager_orders.size() << " manager orders." << std::endl;
if (!std::is_sorted(world->manager_orders.begin(),
world->manager_orders.end(),
compare_freq))
{
std::stable_sort(world->manager_orders.begin(),
world->manager_orders.end(),
compare_freq);
out << "Fixed priority of manager orders." << std::endl;
}
return CR_OK;
}