aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-11-07 09:43:17 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-11-07 09:43:17 +0100
commite0db2fa06232e9f081df6dac2e360195becae17c (patch)
tree7b2e39c181ee4b4bc5dd55a3f9be7bcde9535e64
parentbc8f9c684cddbae8f185687b0f716f70d517858e (diff)
Added this->
-rw-r--r--src/crepe/ComponentManager.cpp2
-rw-r--r--src/crepe/ComponentManager.hpp28
2 files changed, 15 insertions, 15 deletions
diff --git a/src/crepe/ComponentManager.cpp b/src/crepe/ComponentManager.cpp
index 55bd82f..01bc8d7 100644
--- a/src/crepe/ComponentManager.cpp
+++ b/src/crepe/ComponentManager.cpp
@@ -11,7 +11,7 @@ ComponentManager & ComponentManager::get_instance() {
void ComponentManager::delete_all_components_of_id(uint32_t id) {
// Loop through all the types (in the unordered_map<>)
- for (auto & [type, componentArray] : components) {
+ for (auto & [type, componentArray] : this->components) {
// Make sure that the id (that we are looking for) is within the boundaries of the vector<>
if (id < componentArray.size()) {
// Clear the components at this specific id
diff --git a/src/crepe/ComponentManager.hpp b/src/crepe/ComponentManager.hpp
index 11c4d15..eac38fc 100644
--- a/src/crepe/ComponentManager.hpp
+++ b/src/crepe/ComponentManager.hpp
@@ -17,15 +17,15 @@ T & ComponentManager::add_component(uint32_t id, Args &&... args) {
type_index type = typeid(T);
// Check if this component type is already in the unordered_map<>
- if (components.find(type) == components.end()) {
+ if (this->components.find(type) == this->components.end()) {
//If not, create a new (empty) vector<> of vector<unique_ptr<Component>>
- components[type] = vector<vector<unique_ptr<Component>>>();
+ this->components[type] = vector<vector<unique_ptr<Component>>>();
}
// Resize the vector<> if the id is greater than the current size
- if (id >= components[type].size()) {
+ if (id >= this->components[type].size()) {
// Initialize new slots to nullptr (resize does automatically init to nullptr)
- components[type].resize(id + 1);
+ this->components[type].resize(id + 1);
}
// Create a new component of type T (arguments directly forwarded). The
@@ -35,14 +35,14 @@ T & ComponentManager::add_component(uint32_t id, Args &&... args) {
// Check if the vector size is not greater than get_instances_max
if (instance->get_instances_max() != -1
- && components[type][id].size() >= instance->get_instances_max()) {
+ && this->components[type][id].size() >= instance->get_instances_max()) {
// TODO: Exception
throw std::runtime_error(
"Exceeded maximum number of instances for this component type");
}
// store its unique_ptr in the vector<>
- components[type][id].push_back(std::move(instance));
+ this->components[type][id].push_back(std::move(instance));
return *instance;
}
@@ -55,10 +55,10 @@ void ComponentManager::delete_components_by_id(uint32_t id) {
type_index type = typeid(T);
// Find the type (in the unordered_map<>)
- if (components.find(type) != components.end()) {
+ if (this->components.find(type) != this->components.end()) {
// Get the correct vector<>
vector<vector<unique_ptr<Component>>> & component_array
- = components[type];
+ = this->components[type];
// Make sure that the id (that we are looking for) is within the boundaries of the vector<>
if (id < component_array.size()) {
@@ -73,9 +73,9 @@ void ComponentManager::delete_components() {
// Determine the type of T (this is used as the key of the unordered_map<>)
std::type_index type = typeid(T);
- if (components.find(type) == components.end()) return;
+ if (this->components.find(type) == this->components.end()) return;
- components[type].clear();
+ this->components[type].clear();
}
template <typename T>
@@ -89,11 +89,11 @@ ComponentManager::get_components_by_id(uint32_t id) const {
// Create an empty vector<>
vector<reference_wrapper<T>> component_vector;
- if (components.find(type) == components.end()) return component_vector;
+ if (this->components.find(type) == this->components.end()) return component_vector;
// Get the correct vector<>
const vector<vector<unique_ptr<Component>>> & component_array
- = components.at(type);
+ = this->components.at(type);
// Make sure that the id (that we are looking for) is within the boundaries of the vector<>
if (id >= component_array.size()) return component_vector;
@@ -124,11 +124,11 @@ ComponentManager::get_components_by_type() const {
vector<reference_wrapper<T>> component_vector;
// Find the type (in the unordered_map<>)
- if (components.find(type) == components.end()) return component_vector;
+ if (this->components.find(type) == this->components.end()) return component_vector;
// Get the correct vector<>
const vector<vector<unique_ptr<Component>>> & component_array
- = components.at(type);
+ = this->components.at(type);
// Loop through the whole vector<>
for (const vector<unique_ptr<Component>> & component : component_array) {