summaryrefslogtreecommitdiffstats
path: root/src/RendererWorld.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/RendererWorld.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/RendererWorld.cpp b/src/RendererWorld.cpp
index 78519f3..d798343 100644
--- a/src/RendererWorld.cpp
+++ b/src/RendererWorld.cpp
@@ -36,6 +36,8 @@ void RendererWorld::WorkerFunction(size_t workerId) {
}
void RendererWorld::ParseQueueUpdate() {
+ World world = gs->GetWorld();
+
while (!parseQueue.empty()) {
size_t id = 0;
for (; id < RendererWorld::parsingBufferSize && parsing[id].parsing; ++id) {}
@@ -52,13 +54,13 @@ void RendererWorld::ParseQueueUpdate() {
vec.y -= 4500;
}
- parsing[id].data.section = gs->GetWorld().GetSection(vec);
- parsing[id].data.north = gs->GetWorld().GetSection(vec + Vector(0, 0, 1));
- parsing[id].data.south = gs->GetWorld().GetSection(vec + Vector(0, 0, -1));
- parsing[id].data.west = gs->GetWorld().GetSection(vec + Vector(1, 0, 0));
- parsing[id].data.east = gs->GetWorld().GetSection(vec + Vector(-1, 0, 0));
- parsing[id].data.bottom = gs->GetWorld().GetSection(vec + Vector(0, -1, 0));
- parsing[id].data.top = gs->GetWorld().GetSection(vec + Vector(0, 1, 0));
+ parsing[id].data.section = world.GetSection(vec);
+ parsing[id].data.north = world.GetSection(vec + Vector(0, 0, 1));
+ parsing[id].data.south = world.GetSection(vec + Vector(0, 0, -1));
+ parsing[id].data.west = world.GetSection(vec + Vector(1, 0, 0));
+ parsing[id].data.east = world.GetSection(vec + Vector(-1, 0, 0));
+ parsing[id].data.bottom = world.GetSection(vec + Vector(0, -1, 0));
+ parsing[id].data.top = world.GetSection(vec + Vector(0, 1, 0));
parsing[id].parsing = true;
@@ -74,6 +76,8 @@ void RendererWorld::ParseQeueueRemoveUnnecessary() {
elements.clear();
elements.reserve(size);
+ World world = gs->GetWorld();
+
for (size_t i = 0; i < size; i++) {
Vector vec = parseQueue.front();
parseQueue.pop();
@@ -86,7 +90,7 @@ void RendererWorld::ParseQeueueRemoveUnnecessary() {
if (std::find(elements.begin(), elements.end(), vec) != elements.end())
continue;
- const Section& section = gs->GetWorld().GetSection(vec);
+ const Section& section = world.GetSection(vec);
bool skip = false;
@@ -186,7 +190,7 @@ RendererWorld::RendererWorld(GameState* ptr) {
auto data = eventData.get<unsigned int>();
for (unsigned int entityId : gs->GetWorld().GetEntitiesList()) {
if (entityId == data) {
- entities.push_back(RendererEntity(&gs->GetWorld(), entityId));
+ entities.push_back(RendererEntity(entityId));
}
}
});