@@ -82,7 +82,9 @@ helper::expected<TetrionSnapshot, std::string> TetrionSnapshot::from_istream(std
8282 };
8383 }
8484
85- mino_stack.set (grid::GridPoint (x_coord.value (), y_coord.value ()), maybe_type.value ());
85+ auto mino_pos = shapes::AbstractPoint<Coordinate>(x_coord.value (), y_coord.value ());
86+
87+ mino_stack.set (mino_pos.cast <i8 >(), maybe_type.value ());
8688 }
8789
8890
@@ -148,12 +150,17 @@ TetrionSnapshot::TetrionSnapshot(
148150
149151 for (const auto & mino : m_mino_stack.minos ()) {
150152 static_assert (sizeof (Coordinate) == 1 );
153+ static_assert (not std::is_signed_v<Coordinate>);
154+
155+ auto mino_pos = mino.position ().cast <u8 >();
151156
152- static_assert (sizeof (decltype (mino.position ().x )) == 1 );
153- helper::writer::append_value (bytes, mino.position ().x );
157+ static_assert (sizeof (decltype (mino_pos.x )) == 1 );
158+ static_assert (not std::is_signed_v<decltype (mino_pos.x )>);
159+ helper::writer::append_value (bytes, mino_pos.x );
154160
155- static_assert (sizeof (decltype (mino.position ().y )) == 1 );
156- helper::writer::append_value (bytes, mino.position ().y );
161+ static_assert (sizeof (decltype (mino_pos.y )) == 1 );
162+ static_assert (not std::is_signed_v<decltype (mino_pos.y )>);
163+ helper::writer::append_value (bytes, mino_pos.y );
157164
158165 static_assert (sizeof (std::underlying_type_t <helper::TetrominoType>) == 1 );
159166 helper::writer::append_value (bytes, std::to_underlying (mino.type ()));
0 commit comments