Removed dbc and replaced with plain asserts everywhere.

This commit is contained in:
Zed A. Shaw 2025-05-10 10:53:53 -04:00
parent 767147c301
commit adc192c6dc
17 changed files with 69 additions and 185 deletions

View file

@ -1,7 +1,7 @@
#include "guecs/lel.hpp"
#include <fmt/core.h>
#include "guecs/dbc.hpp"
#include <numeric>
#include <cassert>
#include "./lel_parser.cpp"
@ -27,8 +27,7 @@ namespace lel {
void Parser::id(std::string name) {
if(name != "_") {
dbc::check(!cells.contains(name),
fmt::format("duplicate cell name {}", name));
assert(!cells.contains(name) && "duplicate cell name");
cells.insert_or_assign(name, cur);
}
@ -44,8 +43,8 @@ namespace lel {
for(auto& row : grid) {
size_t columns = row.size();
int cell_width = grid_w / columns;
dbc::check(cell_width > 0, "invalid cell width calc");
dbc::check(cell_height > 0, "invalid cell height calc");
assert(cell_width > 0 && "invalid cell width calc");
assert(cell_height > 0 && "invalid cell height calc");
for(auto& name : row) {
if(name == "_") continue;
@ -66,8 +65,8 @@ namespace lel {
cell.w = cell.expand ? std::min(cell.max_w, grid_w) : std::min(cell_width, cell.max_w);
cell.h = cell.expand ? std::min(cell.max_h, grid_h) : std::min(cell_height, cell.max_h);
dbc::check(cell.h > 0, fmt::format("invalid height cell {}", name));
dbc::check(cell.w > 0, fmt::format("invalid width cell {}", name));
assert(cell.h > 0 && "invalid height cell is <= 0");
assert(cell.w > 0 && "invalid width cell is <= 0");
cell.x = grid_x + (cell.col * cell_width);
cell.y = grid_y + (cell.row * cell_height);