Best I can do to simplify the check(fmt::format)crap is to make a little macro to do the format part.

This commit is contained in:
Zed A. Shaw 2026-03-05 12:39:22 -05:00
parent 6710469ee1
commit f0b04107ab
28 changed files with 108 additions and 108 deletions

View file

@ -69,8 +69,8 @@ namespace DinkyECS
for(auto [eid, is_set] : $constants) {
dbc::check(is_set == true, "is_set was not true? WHAT?!");
dbc::check(eid <= entity_count, fmt::format(
"eid {} is not less than entity_count {}", eid, entity_count));
dbc::check(eid <= entity_count,
$F("eid {} is not less than entity_count {}", eid, entity_count));
for(const auto &[tid, eid_map] : $components) {
auto &their_map = to_world.$components[tid];
@ -146,8 +146,7 @@ namespace DinkyECS
Comp &get_the() {
auto comp_id = std::type_index(typeid(Comp));
dbc::check($facts->contains(comp_id),
fmt::format("!!!! ATTEMPT to access world fact that hasn't "
"been set yet: {}",
$F("!!!! ATTEMPT to access world fact that hasn't been set yet: {}",
typeid(Comp).name()));
// use .at to get std::out_of_range if fact not set

View file

@ -17,10 +17,10 @@ inline void add_neighbors(PointList &neighbors, Matrix &closed, size_t y, size_t
void Pathing::compute_paths(Matrix &walls) {
INVARIANT();
dbc::check(walls[0].size() == $width,
fmt::format("Pathing::compute_paths called with walls.width={} but paths $width={}", walls[0].size(), $width));
$F("Pathing::compute_paths called with walls.width={} but paths $width={}", walls[0].size(), $width));
dbc::check(walls.size() == $height,
fmt::format("Pathing::compute_paths called with walls.height={} but paths $height={}", walls[0].size(), $height));
$F("Pathing::compute_paths called with walls.height={} but paths $height={}", walls[0].size(), $height));
// Initialize the new array with every pixel at limit distance
matrix::assign($paths, WALL_PATH_LIMIT);

View file

@ -4,7 +4,7 @@
void Stats::dump(std::string msg)
{
dbc::log(fmt::format("{}: sum: {}, sumsq: {}, n: {}, "
dbc::log($F("{}: sum: {}, sumsq: {}, n: {}, "
"min: {}, max: {}, mean: {}, stddev: {}",
msg, sum, sumsq, n, min, max, mean(),
stddev()));