Corrections dans le générateur pour le MakeDirty au bout du monde

This commit is contained in:
MarcEricMartel 2021-12-14 17:16:14 -05:00
parent cdc926bb39
commit 2ec9170fe3

View File

@ -54,7 +54,8 @@ void World::TransposeWorld(Player& player, Bullet* bullets[MAX_BULLETS]) {
if (ax - x >= 0) {
m_chunks.Set(ax - x, ay,
m_chunks.Remove(ax, ay));
if (ax == WORLD_SIZE_X - 1) m_chunks.Get(ax - x, ay)->MakeDirty();
if (ax == WORLD_SIZE_X - 1 && m_chunks.Get(ax - x, ay))
m_chunks.Get(ax - x, ay)->MakeDirty();
}
else if (m_chunks.Get(ax, ay)) m_tbDeleted.emplace_back(m_chunks.Remove(ax, ay));
}
@ -64,7 +65,8 @@ void World::TransposeWorld(Player& player, Bullet* bullets[MAX_BULLETS]) {
if (ax - x < WORLD_SIZE_X) {
m_chunks.Set(ax - x, ay,
m_chunks.Remove(ax, ay));
if (ax + x == 0) m_chunks.Get(ax + x, ay)->MakeDirty();
if (ax == 0 && m_chunks.Get(ax - x, ay))
m_chunks.Get(ax - x, ay)->MakeDirty();
}
else if (m_chunks.Get(ax, ay)) m_tbDeleted.emplace_back(m_chunks.Remove(ax, ay));
}
@ -75,7 +77,8 @@ void World::TransposeWorld(Player& player, Bullet* bullets[MAX_BULLETS]) {
if (ay - y >= 0) {
m_chunks.Set(ax, ay - y,
m_chunks.Remove(ax, ay));
if (ay == WORLD_SIZE_Y) m_chunks.Get(ax, ay - y)->MakeDirty();
if (ay == WORLD_SIZE_Y - 1 && m_chunks.Get(ax, ay - y))
m_chunks.Get(ax, ay - y)->MakeDirty();
}
else if (m_chunks.Get(ax, ay)) m_tbDeleted.emplace_back(m_chunks.Remove(ax, ay));
}
@ -85,7 +88,8 @@ void World::TransposeWorld(Player& player, Bullet* bullets[MAX_BULLETS]) {
if (ay - y < WORLD_SIZE_Y) {
m_chunks.Set(ax, ay - y,
m_chunks.Remove(ax, ay));
if (ay - x == 0) m_chunks.Get(ax, ay - y)->MakeDirty();
if (ay == 0 && m_chunks.Get(ax, ay - y))
m_chunks.Get(ax, ay - y)->MakeDirty();
}
else if (m_chunks.Get(ax, ay)) m_tbDeleted.emplace_back(m_chunks.Remove(ax, ay));
}
@ -361,7 +365,7 @@ void World::UpdateWorld(Player& player, Perlin& perlin, BlockInfo* blockinfo[BTY
for (int i = 0; i < threads; ++i) {
int x, y;
Chunk* chunk = genThList[i].get();
chunk->GetPosition(x,y);
chunk->GetPosition(x, y);
m_chunks.Set(x - m_center[0], y - m_center[1], chunk);
}
}