game: fix research placement ordering, and add missing rd postfix

This commit is contained in:
Crypto City 2020-02-17 14:05:30 +00:00
parent 9599bb6958
commit b9520cbffb

View File

@ -24,10 +24,10 @@ using namespace tb;
static String get_place_string(size_t n)
{
++n;
String postfix;
if (n % 10 == 1 && n != 11) postfix = "st";
else if (n % 10 == 2 && n != 12) postfix = "nd";
else if (n % 10 == 3 && n != 13) postfix = "rd";
else postfix = "th";
return String(n) + postfix;
}
@ -222,7 +222,7 @@ void UIResearchDialog::Refresh(const std::shared_ptr<GameWallet> &w)
}
String s = String(numDiscovered[game->playerState.id]) + "/" + String(totalDiscovered);
if (numDiscovered[game->playerState.id] > 0)
s += " (" + get_place_string(std::distance(numDiscovered.begin(), numDiscovered.find(game->playerState.id))) + " place)";
s += " (" + get_place_string(std::distance(numDiscovered.find(game->playerState.id), numDiscovered.end())) + " place)";
numDiscoveriesWidget->SetText(s.CString());
FilterDiscoveries();