1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-03 11:17:56 +00:00

Qualify calls to format

C++20 introduces `std::format` and we `using namespace std`,
so some of these would be ambiguous in C++20.
This commit is contained in:
Arthur O'Dwyer
2023-08-21 10:02:25 -07:00
parent a250a4d430
commit ced3bbcad4
41 changed files with 101 additions and 101 deletions

View File

@@ -103,11 +103,11 @@ void init() {
for(int a=0; a<100; a++) {
ld nq7 = q7 + q8;
ld nq8 = q7 * 5 + q8 * 6;
println(hlog, format("%.20f", val = (nq7 + nq8) / (q7 + q8)));
println(hlog, hr::format("%.20f", val = (nq7 + nq8) / (q7 + q8)));
q7 = nq7; q8 = nq8;
}
val = sqrt(val);
println(hlog, "root: ", format("%.20f", val));
println(hlog, "root: ", hr::format("%.20f", val));
for(int a=-50; a<50; a++)
for(int b=1; b<50; b++)
for(int c=-50; c<50; c++)
@@ -283,7 +283,7 @@ string matcode(transmatrix T) {
swap(h[1], h[2]); swap(h[0], h[1]);
// return lalign(0, h);
return format("R%dA%03dL%.3f", ialpha/60, hangle, hypot_d(2, h));
return hr::format("R%dA%03dL%.3f", ialpha/60, hangle, hypot_d(2, h));
}
int ghatid(string s) {
@@ -431,7 +431,7 @@ void hatframe() {
}
string writematrix(transmatrix T) {
return format("mt(%.10f,%.10f,%.10f, %.10f,%.10f,%.10f, %.10f,%.10f,%.10f)",
return hr::format("mt(%.10f,%.10f,%.10f, %.10f,%.10f,%.10f, %.10f,%.10f,%.10f)",
T[0][0],
T[0][1],
T[0][2],
@@ -456,7 +456,7 @@ void hatter() {
dialog::add_key_action('a', [] {
hatcorners_add.push_back(sh);
println(hlog, "hatcorners = {");
for(auto h: hatcorners_add) println(hlog, format(" pt(%.10f,%.10f),", h[0], h[1]));
for(auto h: hatcorners_add) println(hlog, hr::format(" pt(%.10f,%.10f),", h[0], h[1]));
println(hlog, " }");
});

View File

@@ -379,7 +379,7 @@ void do_recording() {
ticks = i * 1000 / mrec_fps;
if(i >= mrec_first && i < mrec_last) {
string s = format(mrec_file.c_str(), i);
string s = hr::format(mrec_file.c_str(), i);
println(hlog, "recording frame ", i, "/", isize(saved), " to ", s);
shot::take(s);
}

View File

@@ -1079,7 +1079,7 @@ void test_current(string tesname) {
case 'O': Out("overts;oedges", lalign(0, count_vertex_orbits(), ";", count_edge_orbits()));
case 'U': Out("vshapes;vverts;vedges;ushapes;uverts;uedges;xea;xeb;xec", count_uniform());
case 'L': Out("mirror_rules", arb::current.mirror_rules);
case 'B': Out("listshape;listvalence", format("%lld;%lld", get_shapelist(), get_valence_list()));
case 'B': Out("listshape;listvalence", hr::format("%lld;%lld", get_shapelist(), get_valence_list()));
case 'F': Out("maxdist", max_dist());
case 'f': Out("file", tesname);
@@ -1091,7 +1091,7 @@ void test_current(string tesname) {
case '1': Out("single", single_live_branches);
case '2': Out("double", double_live_branches);
case 'p': Out("premini", states_premini);
case 'K': Out("movecount", format("%ld", rulegen::movecount));
case 'K': Out("movecount", hr::format("%ld", rulegen::movecount));
}
println(*test_out);
test_out->flush();

View File

@@ -235,11 +235,11 @@ void build_sols(int PRECX, int PRECY, int PRECZ) {
auto xerr = solerror(v, nisot::numerical_exp(cand));
if(cand == fail) {
println(hlog, format("[%2d %2d %2d] FAIL", iz, iy, ix));
println(hlog, hr::format("[%2d %2d %2d] FAIL", iz, iy, ix));
}
else if(xerr > 1e-3) {
println(hlog, format("[%2d %2d %2d] ", iz, iy, ix));
println(hlog, hr::format("[%2d %2d %2d] ", iz, iy, ix));
println(hlog, "f(?) = ", v);
println(hlog, "f(", cand, ") = ", nisot::numerical_exp(cand));
println(hlog, "error = ", xerr);
@@ -265,7 +265,7 @@ void build_sols(int PRECX, int PRECY, int PRECZ) {
}
if(it < last_x && it < last_y) solve_at(it, it);
std::lock_guard<std::mutex> fm(file_mutex);
if(0) println(hlog, format("%2d: %2d", iz, it));
if(0) println(hlog, hr::format("%2d: %2d", iz, it));
}
};
@@ -469,7 +469,7 @@ void visualize_table(sn::tabled_inverses& tab, const string& s) {
for(int i=0; i<3; i++)
part(p, i) = 0x80 + 0x70 * tab.get_int(ix, iy, iz)[i];
}
SDL_SavePNG(rb.srf, format(s.c_str(), iz).c_str());
SDL_SavePNG(rb.srf, hr::format(s.c_str(), iz).c_str());
}
}