diff --git a/autowalker.cpp b/autowalker.cpp index 8ce8c66..ed3e4aa 100644 --- a/autowalker.cpp +++ b/autowalker.cpp @@ -41,7 +41,7 @@ Pathing compute_paths(gui::FSM& fsm) { } void Autowalker::log(std::string msg) { - fmt::println(">>> AUTOWALK: {}", msg); + dbc::log(fmt::format(">>> AUTOWALK: {}", msg)); fsm.$status_ui.log(msg); } @@ -254,8 +254,7 @@ void Autowalker::handle_player_walk(ai::State& start, ai::State& goal) { send_event(gui::Event::STAIRS_DOWN); } else { close_status(); - log("Autowalk has a bug. Unknown action."); - fmt::println("Unknown action: {}", action.name); + dbc::log(fmt::format("Unknown action: {}", action.name)); } } diff --git a/boss_fight_ui.cpp b/boss_fight_ui.cpp index e92bcc8..e2b0f2e 100644 --- a/boss_fight_ui.cpp +++ b/boss_fight_ui.cpp @@ -67,7 +67,9 @@ namespace gui { auto button = $status.entity(name); $status.set(button, {}); $status.set(button, { - [this, name](auto, auto){ fmt::println("STATUS: {}", name); } + [this, name](auto, auto){ + dbc::log(fmt::format("STATUS: {}", name)); + } }); if(name == "main_status") { $status.set(button, {fmt::format("HP: {}", $combat.hp)}); @@ -80,7 +82,9 @@ namespace gui { for(auto& [name, cell] : $overlay.cells()) { auto region = $overlay.entity(name); $overlay.set(region, { - [this, name](auto, auto){ fmt::println("OVERLAY: {}", name); } + [this, name](auto, auto){ + dbc::log(fmt::format("OVERLAY: {}", name)); + } }); } @@ -136,7 +140,7 @@ namespace gui { bool BossFightUI::mouse(float x, float y) { if($status.mouse(x, y)) { - fmt::println("STATUS"); + dbc::log("STATUS button pressed"); } if($overlay.mouse(x, y)) { diff --git a/gui_fsm.cpp b/gui_fsm.cpp index 7ccba73..e0617ec 100644 --- a/gui_fsm.cpp +++ b/gui_fsm.cpp @@ -230,7 +230,7 @@ namespace gui { } void FSM::END(Event ev) { - fmt::println("END: received event after done: {}", int(ev)); + dbc::log(fmt::format("END: received event after done: {}", int(ev))); } void FSM::keyboard_mouse() { diff --git a/inventory.cpp b/inventory.cpp index 5f0003f..e9e5620 100644 --- a/inventory.cpp +++ b/inventory.cpp @@ -15,7 +15,9 @@ namespace components { } bool Inventory::has_item(size_t at) { - fmt::println(">>> INVENTORY: requesting item at {}, have {} items in stock", at, items.size()); + dbc::log( + fmt::format("requesting item at {}, have {} items in stock", + at, items.size())); return at < items.size(); } diff --git a/lel_parser.cpp b/lel_parser.cpp index 0d0efac..3af72bc 100644 --- a/lel_parser.cpp +++ b/lel_parser.cpp @@ -252,7 +252,7 @@ _again: if(good) { finalize(); } else { - fmt::println("error at"); + dbc::log("error at:"); std::cout << p; } return good; diff --git a/lel_parser.rl b/lel_parser.rl index a41c5ea..784d639 100644 --- a/lel_parser.rl +++ b/lel_parser.rl @@ -57,7 +57,7 @@ bool Parser::parse(std::string input) { if(good) { finalize(); } else { - fmt::println("error at"); + dbc::log("error at:"); std::cout << p; } return good; diff --git a/raycaster.cpp b/raycaster.cpp index 3c4828e..284ea3c 100644 --- a/raycaster.cpp +++ b/raycaster.cpp @@ -140,10 +140,10 @@ void Raycaster::sprite_casting(sf::RenderTarget &target) { float x = float(draw_start_x + $screen_pos_x); float y = float(draw_start_y + $screen_pos_y); - if(x < $screen_pos_x) fmt::println("X < rayview left bounds"); - if(y < $screen_pos_y) fmt::println("Y < rayview top bounds"); - if(x >= SCREEN_WIDTH) fmt::println("OUT OF BOUNDS X"); - if(y >= $height) fmt::println("OUT OF BOUNDS Y"); + if(x < $screen_pos_x) dbc::log("X < rayview left bounds"); + if(y < $screen_pos_y) dbc::log("Y < rayview top bounds"); + if(x >= SCREEN_WIDTH) dbc::log("OUT OF BOUNDS X"); + if(y >= $height) dbc::log("OUT OF BOUNDS Y"); float sprite_scale_w = float(sprite_width) / float(texture_width); float sprite_scale_h = float(sprite_height) / float(texture_height); diff --git a/stats.cpp b/stats.cpp index 5d26c83..36f5a6e 100644 --- a/stats.cpp +++ b/stats.cpp @@ -1,10 +1,11 @@ #include "stats.hpp" #include +#include "dbc.hpp" void Stats::dump(std::string msg) { - fmt::println("{}: sum: {}, sumsq: {}, n: {}, " + dbc::log(fmt::format("{}: sum: {}, sumsq: {}, n: {}, " "min: {}, max: {}, mean: {}, stddev: {}", msg, sum, sumsq, n, min, max, mean(), - stddev()); + stddev())); } diff --git a/systems.cpp b/systems.cpp index c7be574..b40a54c 100644 --- a/systems.cpp +++ b/systems.cpp @@ -293,7 +293,7 @@ void System::collision(GameLevel &level) { } else if(world.has(entity)) { System::device(world, player.entity, entity); } else { - println("UNKNOWN COLLISION TYPE {}", entity); + dbc::log(fmt::format("UNKNOWN COLLISION TYPE {}", entity)); } } @@ -308,7 +308,7 @@ void System::device(DinkyECS::World &world, DinkyECS::Entity actor, DinkyECS::En auto& device = world.get(item); for(auto event : device.events) { - fmt::println("Device event received {}", event); + dbc::log(fmt::format("Device event received {}", event)); if(event == "Events::GUI::STAIRS_DOWN") { world.send(Events::GUI::STAIRS_DOWN, actor, device); @@ -317,7 +317,7 @@ void System::device(DinkyECS::World &world, DinkyECS::Entity actor, DinkyECS::En } } - println("entity {} INTERACTED WITH DEVICE {}", actor, item); + dbc::log(fmt::format("entity {} INTERACTED WITH DEVICE {}", actor, item)); } void System::plan_motion(DinkyECS::World& world, Point move_to) { diff --git a/worldbuilder.cpp b/worldbuilder.cpp index e7f36a3..78fb64a 100644 --- a/worldbuilder.cpp +++ b/worldbuilder.cpp @@ -295,8 +295,6 @@ void WorldBuilder::make_room(size_t origin_x, size_t origin_y, size_t w, size_t void WorldBuilder::place_rooms() { for(auto &cur : $map.$rooms) { - // println("ROOM x/y={},{}; w/h={},{}; map={},{}", - // cur.x, cur.y, cur.width, cur.height, $map.$width, $map.$height); add_door(cur); make_room(cur.x, cur.y, cur.width, cur.height); }