Archived
1
Fork 0

Add [[nodiscard]] to some more methods

This commit is contained in:
Joshua Goins 2022-02-21 00:14:47 -05:00
parent 4d9a333781
commit b0d875832d
4 changed files with 9 additions and 9 deletions

View file

@ -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],

View file

@ -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);

View file

@ -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<Data>(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<prism::Object> children_of(const prism::Object obj, const bool recursive = false) const {
[[nodiscard]] std::vector<prism::Object> children_of(const prism::Object obj, const bool recursive = false) const {
std::vector<prism::Object> vec;
if(recursive) {
@ -114,7 +114,7 @@ public:
/// Checks whether or not an object has a certain component.
template<class Component>
bool has(const prism::Object object) const {
[[nodiscard]] bool has(const prism::Object object) const {
return Pool<Component>::count(object);
}
@ -141,7 +141,7 @@ public:
}
/// Returns all objects.
std::vector<prism::Object> get_objects() const {
[[nodiscard]] std::vector<prism::Object> get_objects() const {
return _objects;
}

View file

@ -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) {}