aboutsummaryrefslogtreecommitdiffstats
path: root/src/world.cpp
diff options
context:
space:
mode:
authorAndy Belle-Isle <drumsetmonkey@gmail.com>2019-09-11 01:46:14 -0400
committerAndy Belle-Isle <drumsetmonkey@gmail.com>2019-09-11 01:46:14 -0400
commit8f0db67c5fdbc1e7b8759f44b45ad64caf336cb5 (patch)
tree0333263e39e51eab9fdb83fc1f6046159d91b0e4 /src/world.cpp
parent1d9c67f5719b3c55b1f2f2537e796e2ad95e1ac1 (diff)
World system now has a pointer to the current world, and worlds created in Lua are returned to Lua as pointers
Diffstat (limited to 'src/world.cpp')
-rw-r--r--src/world.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/world.cpp b/src/world.cpp
index 8b71316..63769a9 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -38,10 +38,12 @@ World::World(sol::object ref)
* WORLD SYSTEM *
******************/
-unsigned int WorldSystem::addWorld(sol::object t)
+World* WorldSystem::addWorld(sol::object t)
{
worlds.push_back(World(t));
- return worlds.size()-1;
+ if (currentWorld == nullptr)
+ currentWorld = &(worlds.back());
+ return &(worlds.back());
}
void WorldSystem::configure([[maybe_unused]]entityx::EntityManager& entities,