1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-06 04:17:58 +00:00

Eliminate calls to sprintf

Apple Xcode has started giving `-Wdeprecated-declarations` warnings
for `sprintf`, and suggesting that people migrate to `snprintf` instead.
This is silly, but the warnings are spam and need to be silenced
somehow. Migrating to `snprintf` and/or `hr::format` is the path of
least resistance.
This commit is contained in:
Arthur O'Dwyer
2023-08-21 10:14:19 -07:00
parent ced3bbcad4
commit 10d0ed8900
11 changed files with 22 additions and 39 deletions

View File

@@ -29,13 +29,12 @@ void show_likelihood() {
for(int i=0; i<MAXDIST; i++) bonus_tally[i] = 0;
for(int u=0; u<MAXDIST; u++) if(tally[u] || bonus_tally[u]) {
char buf[20];
sprintf(buf, "%.6lf", lc_type == 'R' ? current_logistic.yes(u) : double(edgetally[u] * 1. / tally[u]));
string value = hr::format("%.6lf", lc_type == 'R' ? current_logistic.yes(u) : double(edgetally[u] * 1. / tally[u]));
string s = its(u);
if(isize(s) == 1) s = "0" + s;
s += ": " + its(edgetally[u]) + " / " + its(tally[u]);
if(bonus_tally[u]) s += " [" + its(bonus_edgetally[u]) + "/" + its(bonus_tally[u]) + "]";
dialog::addSelItem(s, buf, 0);
dialog::addSelItem(s, value, 0);
}
char letters[3] = {'O', 'R', 'M'};