fix board goal rendering bug if no target block exists or board has no win condition

This commit is contained in:
2026-03-01 00:30:01 +01:00
parent 846ff72d1f
commit c7361fe47e
2 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ auto puzzle::block::hash() const -> size_t
auto puzzle::block::valid() const -> bool auto puzzle::block::valid() const -> bool
{ {
return width > 0 && height > 0 && x >= 0 && x + width <= 9 && y >= 0 && y + height <= 9; return width > 0 && height > 0 && x >= 0 && x + width <= MAX_WIDTH && y >= 0 && y + height <= MAX_HEIGHT;
} }
auto puzzle::block::string() const -> std::string auto puzzle::block::string() const -> std::string

View File

@ -832,7 +832,7 @@ auto user_interface::draw_puzzle_board() -> void
} }
// Draw goal boundaries when editing // Draw goal boundaries when editing
if (input.editing) { if (input.editing && current.has_win_condition() && target_block) {
DrawRectangleLinesEx(board_grid.square_bounds(target_x, target_y, target_block->width, target_block->height), 2.0, TARGET_BLOCK_COLOR); DrawRectangleLinesEx(board_grid.square_bounds(target_x, target_y, target_block->width, target_block->height), 2.0, TARGET_BLOCK_COLOR);
} }
} }