TETRIS: make copySelf actually copy everything

This commit is contained in:
zv0n 2020-12-18 16:02:23 +01:00
parent 20c30712b9
commit d4f3e07ae4

View File

@ -33,7 +33,12 @@ public:
pieces_bag[_index]++; pieces_bag[_index]++;
} }
virtual std::shared_ptr< RenderObject > copySelf() override { virtual std::shared_ptr< RenderObject > copySelf() override {
return std::make_shared< TetrisBlock >( *this ); auto ret = std::make_shared< TetrisBlock >( *this );
copyTo(ret);
return ret;
}
virtual void copyTo(std::shared_ptr<RenderObject> other) override {
RectangleRender::copyTo(other);
} }
std::shared_ptr< TetrisBlock > copyInScene() { std::shared_ptr< TetrisBlock > copyInScene() {
auto ret = std::shared_ptr< TetrisBlock >( new TetrisBlock( *this ) ); auto ret = std::shared_ptr< TetrisBlock >( new TetrisBlock( *this ) );