make scene change take a rvalue

This commit is contained in:
Green Sky 2020-10-14 13:35:27 +02:00
parent e4b256609a
commit 8c72f4cc36
3 changed files with 6 additions and 6 deletions

View File

@ -26,12 +26,12 @@ namespace MM::Services {
virtual ::MM::Scene& getScene(void) = 0;
// enques a new Scene to be put in place
virtual void changeScene(std::unique_ptr<::MM::Scene> new_scene) = 0;
virtual void changeScene(std::unique_ptr<::MM::Scene>&& new_scene) = 0;
// sets the new Scene to be provided.
// dont use, except for when you know what you are doing!
// be carefull of that one (lol)
virtual void changeSceneNow(std::unique_ptr<::MM::Scene> new_scene) = 0;
virtual void changeSceneNow(std::unique_ptr<::MM::Scene>&& new_scene) = 0;
// adds a System to current Scene.
// default impl. will use getScene() !

View File

@ -72,7 +72,7 @@ void SimpleSceneService::changeSceneFixedUpdate(Engine& engine) {
}
}
void SimpleSceneService::changeScene(std::unique_ptr<Scene> new_scene) {
void SimpleSceneService::changeScene(std::unique_ptr<Scene>&& new_scene) {
if (_next_scene) {
LOG_SSS("warn: already next scene enqueued! overwriting...");
}
@ -85,7 +85,7 @@ void SimpleSceneService::changeScene(std::unique_ptr<Scene> new_scene) {
//}
}
void SimpleSceneService::changeSceneNow(std::unique_ptr<Scene> new_scene) {
void SimpleSceneService::changeSceneNow(std::unique_ptr<Scene>&& new_scene) {
_scene = std::move(new_scene);
//_scene->set<MM::Engine*>(&engine); // make engine accessible from scene

View File

@ -25,10 +25,10 @@ namespace MM::Services {
public:
Scene& getScene(void) override { return *_scene; }
void changeScene(std::unique_ptr<Scene> new_scene) override;
void changeScene(std::unique_ptr<Scene>&& new_scene) override;
// be carefull of that one
void changeSceneNow(std::unique_ptr<Scene> new_scene) override;
void changeSceneNow(std::unique_ptr<Scene>&& new_scene) override;
};
} // MM::Services