Fixed up dbc.cpp so now just use it everywhere. I next need to find a way to pass that to format automatically.

master
Zed A. Shaw 2 weeks ago
parent 2baa044695
commit a6d83db20c
  1. 5
      autowalker.cpp
  2. 10
      boss_fight_ui.cpp
  3. 2
      gui_fsm.cpp
  4. 4
      inventory.cpp
  5. 2
      lel_parser.cpp
  6. 2
      lel_parser.rl
  7. 8
      raycaster.cpp
  8. 5
      stats.cpp
  9. 6
      systems.cpp
  10. 2
      worldbuilder.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));
}
}

@ -67,7 +67,9 @@ namespace gui {
auto button = $status.entity(name);
$status.set<Rectangle>(button, {});
$status.set<Clickable>(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<Textual>(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<Clickable>(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)) {

@ -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() {

@ -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();
}

@ -252,7 +252,7 @@ _again:
if(good) {
finalize();
} else {
fmt::println("error at");
dbc::log("error at:");
std::cout << p;
}
return good;

@ -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;

@ -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);

@ -1,10 +1,11 @@
#include "stats.hpp"
#include <fmt/core.h>
#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()));
}

@ -293,7 +293,7 @@ void System::collision(GameLevel &level) {
} else if(world.has<Device>(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<Device>(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>(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) {

@ -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);
}

Loading…
Cancel
Save