Browse Source

Initialize raw pointers as nullptr

master
Riyyi 4 years ago
parent
commit
7401936016
  1. 2
      inferno/src/inferno/component/luascriptcomponent.h
  2. 2
      inferno/src/inferno/component/nativescriptcomponent.h
  3. 2
      inferno/src/inferno/io/log.h
  4. 2
      inferno/src/inferno/render/context.h
  5. 12
      inferno/src/inferno/render/renderer.h
  6. 2
      inferno/src/inferno/script/cameracontroller.h
  7. 6
      inferno/src/inferno/script/luascript.h
  8. 6
      inferno/src/inferno/script/nativescript.h
  9. 2
      inferno/src/inferno/system/scriptsystem.h

2
inferno/src/inferno/component/luascriptcomponent.h

@ -9,7 +9,7 @@ namespace Inferno {
class LuaScript; class LuaScript;
struct LuaScriptComponent { struct LuaScriptComponent {
LuaScript* instance = nullptr; LuaScript* instance { nullptr };
std::string path; std::string path;
// Dont allow manually setting instance during construction // Dont allow manually setting instance during construction

2
inferno/src/inferno/component/nativescriptcomponent.h

@ -7,7 +7,7 @@
namespace Inferno { namespace Inferno {
struct NativeScriptComponent { struct NativeScriptComponent {
NativeScript* instance = nullptr; NativeScript* instance { nullptr };
NativeScript* (*initialize)(); NativeScript* (*initialize)();

2
inferno/src/inferno/io/log.h

@ -111,7 +111,7 @@ namespace Inferno {
virtual ~StringLogStream() override; virtual ~StringLogStream() override;
private: private:
std::string* m_fill; std::string* m_fill { nullptr };
}; };
// ----------------------------------------- // -----------------------------------------

2
inferno/src/inferno/render/context.h

@ -16,7 +16,7 @@ namespace Inferno {
void setCurrent(); void setCurrent();
private: private:
GLFWwindow* m_window; GLFWwindow* m_window { nullptr };
}; };
} }

12
inferno/src/inferno/render/renderer.h

@ -88,8 +88,8 @@ namespace Inferno {
std::array<std::shared_ptr<Texture>, textureUnitPerBatch> m_textureUnits; std::array<std::shared_ptr<Texture>, textureUnitPerBatch> m_textureUnits;
// GPU objects // GPU objects
std::shared_ptr<Shader> m_shader = nullptr; std::shared_ptr<Shader> m_shader;
std::shared_ptr<VertexArray> m_vertexArray = nullptr; std::shared_ptr<VertexArray> m_vertexArray;
}; };
// ----------------------------------------- // -----------------------------------------
@ -122,8 +122,8 @@ namespace Inferno {
void nextBatch() override; void nextBatch() override;
// CPU quad vertices // CPU quad vertices
std::unique_ptr<QuadVertex[]> m_vertexBufferBase = nullptr; std::unique_ptr<QuadVertex[]> m_vertexBufferBase;
QuadVertex* m_vertexBufferPtr = nullptr; QuadVertex* m_vertexBufferPtr { nullptr };
// Default quad vertex positions // Default quad vertex positions
glm::vec4 m_vertexPositions[vertexPerQuad]; glm::vec4 m_vertexPositions[vertexPerQuad];
@ -156,8 +156,8 @@ namespace Inferno {
void nextBatch() override; void nextBatch() override;
// CPU quad vertices // CPU quad vertices
std::unique_ptr<CharacterVertex[]> m_vertexBufferBase = nullptr; std::unique_ptr<CharacterVertex[]> m_vertexBufferBase;
CharacterVertex* m_vertexBufferPtr = nullptr; CharacterVertex* m_vertexBufferPtr { nullptr };
}; };
} }

2
inferno/src/inferno/script/cameracontroller.h

@ -31,7 +31,7 @@ namespace Inferno {
void updatePerspective(float deltaTime); void updatePerspective(float deltaTime);
private: private:
CameraComponent* m_camera; CameraComponent* m_camera { nullptr };
}; };
} }

6
inferno/src/inferno/script/luascript.h

@ -45,9 +45,9 @@ namespace Inferno {
sol::state m_state; sol::state m_state;
std::string m_path = ""; std::string m_path = "";
Scene* m_scene = nullptr; Scene* m_scene { nullptr };
uint32_t m_entity = 0; uint32_t m_entity { 0 };
TransformComponent* transform = nullptr; TransformComponent* transform { nullptr };
friend class ScriptSystem; friend class ScriptSystem;
}; };

6
inferno/src/inferno/script/nativescript.h

@ -22,11 +22,11 @@ namespace Inferno {
return m_scene->getComponent<T>(m_entity); return m_scene->getComponent<T>(m_entity);
} }
TransformComponent* transform = nullptr; TransformComponent* transform { nullptr };
private: private:
Scene* m_scene = nullptr; Scene* m_scene { nullptr };
uint32_t m_entity = 0; uint32_t m_entity { 0 };
friend class ScriptSystem; friend class ScriptSystem;
}; };

2
inferno/src/inferno/system/scriptsystem.h

@ -26,7 +26,7 @@ namespace Inferno {
void setScene(Scene* scene) { m_scene = scene; } void setScene(Scene* scene) { m_scene = scene; }
private: private:
Scene* m_scene; Scene* m_scene { nullptr };
}; };
} }

Loading…
Cancel
Save