summary refs log tree commit diff stats
path: root/src/game.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2022-03-15 11:32:14 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2022-03-15 11:32:14 -0400
commit1e84e2d6ef9370a3443fcd8472779184f6319594 (patch)
tree246e555279b1f80a1f1321a60c04d4f1ca23f40c /src/game.cpp
parent5ab72bf802e7a79d6eacded4e985740324c4faa7 (diff)
downloadether-1e84e2d6ef9370a3443fcd8472779184f6319594.tar.gz
ether-1e84e2d6ef9370a3443fcd8472779184f6319594.tar.bz2
ether-1e84e2d6ef9370a3443fcd8472779184f6319594.zip
maybe made the slowdown when zoomed out much better
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/game.cpp b/src/game.cpp index fc57acc..e9a9fbe 100644 --- a/src/game.cpp +++ b/src/game.cpp
@@ -55,7 +55,7 @@ void Game::tick(
55 bool invert, 55 bool invert,
56 bool onlyDark) 56 bool onlyDark)
57{ 57{
58 std::vector<MapData> temp(map.data()); 58 mapDoubleBuffer = map.data();
59 59
60 for (int y = map.getTop(); y < map.getBottom(); y++) 60 for (int y = map.getTop(); y < map.getBottom(); y++)
61 { 61 {
@@ -91,19 +91,19 @@ void Game::tick(
91 int tempIndex = map.getTrueX(x) + map.getTrueY(y) * map.getWidth(); 91 int tempIndex = map.getTrueX(x) + map.getTrueY(y) * map.getWidth();
92 if (count >= 5) 92 if (count >= 5)
93 { 93 {
94 temp[tempIndex].tile = Tile::Wall; 94 mapDoubleBuffer[tempIndex].tile = Tile::Wall;
95 } else { 95 } else {
96 temp[tempIndex].tile = Tile::Floor; 96 mapDoubleBuffer[tempIndex].tile = Tile::Floor;
97 } 97 }
98 98
99 if (temp[tempIndex].tile != map.at(x,y).tile) { 99 if (mapDoubleBuffer[tempIndex].tile != map.at(x,y).tile) {
100 temp[tempIndex].dirtyRender = true; 100 mapDoubleBuffer[tempIndex].dirtyRender = true;
101 dirtyRender = true; 101 dirtyRender = true;
102 } 102 }
103 } 103 }
104 } 104 }
105 105
106 map.data() = std::move(temp); 106 std::swap(map.data(), mapDoubleBuffer);
107} 107}
108 108
109void Game::tick(bool onlyDark) 109void Game::tick(bool onlyDark)