]> git.tdb.fi Git - libs/game.git/blobdiff - source/game/stage.h
Adjust some things to make header dependencies easier to manage
[libs/game.git] / source / game / stage.h
index 060759696914264ce5c177c0d1674a154b253e52..47ca47d9a572b6c5742e5a5279877d5af983584c 100644 (file)
@@ -4,17 +4,19 @@
 #include <memory>
 #include <msp/time/timedelta.h>
 #include "handle.h"
-#include "root.h"
 
 namespace Msp::Game {
 
+class Root;
 class System;
 
 class Stage
 {
 private:
        PoolPool pools;
-       Root root;
+       /* Use unique_ptr because there's only one root per stage so it's pointless
+       to put it in a pool. */
+       std::unique_ptr<Root> root;
        std::vector<std::unique_ptr<System>> systems;
 
 public:
@@ -22,7 +24,7 @@ public:
        ~Stage();
 
        PoolPool &get_pools() { return pools; }
-       Handle<Root> get_root() { return Handle<Root>::from_object(&root); }
+       Handle<Root> get_root() { return Handle<Root>::from_object(root.get()); }
 
        template<typename T, typename F>
        void iterate_objects(const F &);