Fixed all my pointers
This commit is contained in:
@ -11,14 +11,12 @@ namespace Dawn {
|
||||
|
||||
class Scene;
|
||||
|
||||
class SceneItem :
|
||||
public std::enable_shared_from_this<SceneItem>
|
||||
{
|
||||
class SceneItem {
|
||||
private:
|
||||
std::vector<std::shared_ptr<SceneItemComponent>> components;
|
||||
|
||||
public:
|
||||
std::weak_ptr<Scene> scene;
|
||||
Scene &scene;
|
||||
sceneitemid_t id;
|
||||
|
||||
/**
|
||||
@ -28,7 +26,7 @@ namespace Dawn {
|
||||
* @param scene Weak pointer to the Scene that this SceneItem belongs to.
|
||||
* @param id Scene Item ID that the Scene assigned this SceneItem.
|
||||
*/
|
||||
SceneItem(std::weak_ptr<Scene> scene, sceneitemid_t id);
|
||||
SceneItem(Scene &scene, sceneitemid_t id);
|
||||
|
||||
/**
|
||||
* Called by the Scene the frame after we were constructed so we can begin
|
||||
@ -48,7 +46,7 @@ namespace Dawn {
|
||||
*/
|
||||
template<class T>
|
||||
std::shared_ptr<T> addComponent() {
|
||||
auto component = std::make_shared<T>(weak_from_this());
|
||||
auto component = std::make_shared<T>(*this);
|
||||
this->components.push_back(component);
|
||||
return component;
|
||||
}
|
||||
|
Reference in New Issue
Block a user