fix board goal rendering bug if no target block exists or board has no win condition
This commit is contained in:
@ -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
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user