From b0d875832d3ea1135e9c0b6f21fb09e96fd647e0 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 21 Feb 2022 00:14:47 -0500 Subject: [PATCH] Add [[nodiscard]] to some more methods --- engine/core/include/components.hpp | 2 +- engine/core/include/engine.hpp | 2 +- engine/core/include/scene.hpp | 12 ++++++------ engine/renderer/include/pass.hpp | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engine/core/include/components.hpp b/engine/core/include/components.hpp index aef9939..976cb19 100755 --- a/engine/core/include/components.hpp +++ b/engine/core/include/components.hpp @@ -62,7 +62,7 @@ struct Transform { Matrix4x4 model; - prism::float3 get_world_position() const { + [[nodiscard]] prism::float3 get_world_position() const { return { model[3][0], model[3][1], diff --git a/engine/core/include/engine.hpp b/engine/core/include/engine.hpp index 8e4b6d5..2999d3c 100755 --- a/engine/core/include/engine.hpp +++ b/engine/core/include/engine.hpp @@ -337,7 +337,7 @@ namespace prism { void calculate_bone(Mesh& mesh, const Mesh::Part& part, Bone& bone, const Bone* parent_bone = nullptr); void calculate_object(Scene& scene, Object object, Object parent_object = NullObject); - Shot* get_shot(float time) const; + [[nodiscard]] Shot* get_shot(float time) const; void update_animation(const Animation& anim, float time); void update_cutscene(float time); diff --git a/engine/core/include/scene.hpp b/engine/core/include/scene.hpp index d309a73..e9b05a7 100755 --- a/engine/core/include/scene.hpp +++ b/engine/core/include/scene.hpp @@ -45,7 +45,7 @@ public: } /// Find an object by name. - prism::Object find_object(const std::string_view name) const { + [[nodiscard]] prism::Object find_object(const std::string_view name) const { for(auto& obj : _objects) { if(get(obj).name == name) return obj; @@ -55,12 +55,12 @@ public: } /// Check whether or not an object exists. - bool object_exists(const std::string_view name) const { + [[nodiscard]] bool object_exists(const std::string_view name) const { return find_object(name) != prism::NullObject; } /// Check if the object originated from a prefab. This works even on children of a root prefab object. - bool is_object_prefab(const prism::Object obj) const { + [[nodiscard]] bool is_object_prefab(const prism::Object obj) const { bool is_prefab = false; check_prefab_parent(obj, is_prefab); @@ -79,7 +79,7 @@ public: } /// Returns all of the children of an object, with optional recursion. - std::vector children_of(const prism::Object obj, const bool recursive = false) const { + [[nodiscard]] std::vector children_of(const prism::Object obj, const bool recursive = false) const { std::vector vec; if(recursive) { @@ -114,7 +114,7 @@ public: /// Checks whether or not an object has a certain component. template - bool has(const prism::Object object) const { + [[nodiscard]] bool has(const prism::Object object) const { return Pool::count(object); } @@ -141,7 +141,7 @@ public: } /// Returns all objects. - std::vector get_objects() const { + [[nodiscard]] std::vector get_objects() const { return _objects; } diff --git a/engine/renderer/include/pass.hpp b/engine/renderer/include/pass.hpp index 721bb08..351d79a 100755 --- a/engine/renderer/include/pass.hpp +++ b/engine/renderer/include/pass.hpp @@ -19,7 +19,7 @@ public: virtual void initialize() {} - virtual void create_render_target_resources([[maybe_used]] RenderTarget& target) {} + virtual void create_render_target_resources([[maybe_unused]] RenderTarget& target) {} virtual void render_scene([[maybe_unused]] Scene& scene, [[maybe_unused]] GFXCommandBuffer* commandBuffer) {}