feat(entity-manager): reload del nivell + PaintLayer::clear

This commit is contained in:
JailDesigner committed 2026-04-26 10:26:07 +02:00
1 parent 28e55a0615
commit 59cd9b524c
4 files changed
+43

No files matched your search

+7
View File
@@ -82,6 +82,13 @@ auto PaintLayer::isPainted(int col, int row) const -> bool {
return painted_[static_cast<std::size_t>(row)][static_cast<std::size_t>(col)] >= 0;
}
void PaintLayer::clear() {
// Mateixa geometria que al ctor: matriu de tiles a -1 (no pintat) i
// buffer ARGB a zero (alpha=0 = transparent → render no escriu res).
painted_.assign(static_cast<std::size_t>(rows_), std::vector<int>(static_cast<std::size_t>(cols_), -1));
std::ranges::fill(pixels_, 0U);
}
auto PaintLayer::tryPaint(int col, int row, int tile_index, int player_id) -> bool {
if (col < 0 || col >= cols_ || row < 0 || row >= rows_) { return false; }
if (tile_index < 0) { return false; }