Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/libs/recordings/utility/tetrion_snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ helper::expected<TetrionSnapshot, std::string> TetrionSnapshot::from_istream(std
};
}

mino_stack.set(grid::GridPoint(x_coord.value(), y_coord.value()), maybe_type.value());
auto mino_pos = shapes::AbstractPoint<Coordinate>(x_coord.value(), y_coord.value());

mino_stack.set(mino_pos.cast<i8>(), maybe_type.value());
}


Expand Down Expand Up @@ -148,12 +150,17 @@ TetrionSnapshot::TetrionSnapshot(

for (const auto& mino : m_mino_stack.minos()) {
static_assert(sizeof(Coordinate) == 1);
static_assert(not std::is_signed_v<Coordinate>);

auto mino_pos = mino.position().cast<u8>();

static_assert(sizeof(decltype(mino.position().x)) == 1);
helper::writer::append_value(bytes, mino.position().x);
static_assert(sizeof(decltype(mino_pos.x)) == 1);
static_assert(not std::is_signed_v<decltype(mino_pos.x)>);
helper::writer::append_value(bytes, mino_pos.x);

static_assert(sizeof(decltype(mino.position().y)) == 1);
helper::writer::append_value(bytes, mino.position().y);
static_assert(sizeof(decltype(mino_pos.y)) == 1);
static_assert(not std::is_signed_v<decltype(mino_pos.y)>);
helper::writer::append_value(bytes, mino_pos.y);

static_assert(sizeof(std::underlying_type_t<helper::TetrominoType>) == 1);
helper::writer::append_value(bytes, std::to_underlying(mino.type()));
Expand Down
2 changes: 1 addition & 1 deletion src/libs/recordings/utility/tetrion_snapshot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct TetrionSnapshot final {

public:
using MinoCount = u64;
using Coordinate = i8;
using Coordinate = u8;

OOPETRIS_RECORDINGS_EXPORTED TetrionSnapshot(
u8 tetrion_index,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/layouts/grid_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void ui::GridLayout::render(const ServiceProvider& service_provider) const {
x_pos += margin_x + total_width;
} else {
const u32 total_margin = this->m_size <= 1 ? 0 : (this->m_size - 1) * m_gap.get_margin();
assert(layout().get_rect().height() > (total_margin - (m_margin.second * 2))
assert(layout().get_rect().height() > (total_margin + (m_margin.second * 2))
&& "height has to be greater than the margins");
height = (layout().get_rect().height() - total_margin - (m_margin.second * 2)) / this->m_size;

Expand Down
Loading