Skip to content

Commit

Permalink
chore: rename variables for clarity (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy authored Apr 4, 2024
1 parent 563af1a commit 08d7693
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ecsact_execution_options c_execution_options::c() {
entity_components.push_back(component);
}

create_entity_components_datas.push_back(entity_components.data());
create_entity_components_data.push_back(entity_components.data());
}

options.actions = actions.data();
Expand All @@ -67,7 +67,7 @@ ecsact_execution_options c_execution_options::c() {
options.remove_components_length = remove_ids.size();

options.create_entities = create_entity_placeholder_ids.data();
options.create_entities_components = create_entity_components_datas.data();
options.create_entities_components = create_entity_components_data.data();
options.create_entities_length = create_entities_components.size();
options.create_entities_components_length =
create_entity_components_length.data();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private:
std::vector<ecsact_component> adds;
std::vector<ecsact_component> updates;

std::vector<ecsact_component*> create_entity_components_datas;
std::vector<ecsact_component*> create_entity_components_data;
std::vector<std::vector<ecsact_component>> create_entity_components;
std::vector<int32_t> create_entity_components_length;
};
Expand Down
22 changes: 11 additions & 11 deletions serialize_reference/serialize_reference.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ecsact_restore_error ecsact_restore_as_execution_options(
) {
auto placeholder_ids = std::vector<ecsact_placeholder_entity_id>{};
auto component_ids_list = std::vector<std::vector<ecsact_component_id>>{};
auto component_datas_list =
auto entity_component_data_list =
std::vector<std::vector<std::vector<std::byte>>>{};

auto read_amount = int32_t{};
Expand All @@ -103,24 +103,24 @@ ecsact_restore_error ecsact_restore_as_execution_options(

placeholder_ids.reserve(ent_count);
component_ids_list.reserve(ent_count);
component_datas_list.reserve(ent_count);
entity_component_data_list.reserve(ent_count);

for(int32_t ent_idx = 0; ent_count > ent_idx; ++ent_idx) {
placeholder_ids.push_back(static_cast<ecsact_placeholder_entity_id>(ent_idx)
);

auto& component_ids = component_ids_list.emplace_back();
auto& component_datas = component_datas_list.emplace_back();
auto& component_data_list = entity_component_data_list.emplace_back();

auto components_count = int32_t{};
READ_CALLBACK_INTO_VAR(components_count);

component_ids.reserve(components_count);
component_datas.reserve(components_count);
component_data_list.reserve(components_count);

for(int i = 0; components_count > i; ++i) {
auto& component_id = component_ids.emplace_back();
auto& component_data = component_datas.emplace_back();
auto& component_data = component_data_list.emplace_back();
auto component_size = int32_t{};
READ_CALLBACK_INTO_VAR(component_id);
READ_CALLBACK_INTO_VAR(component_size);
Expand Down Expand Up @@ -161,8 +161,8 @@ ecsact_restore_error ecsact_restore_as_execution_options(
}

auto entity_components_owner = std::vector<std::vector<ecsact_component>>{};
for(auto i = 0; component_datas_list.size() > i; ++i) {
auto& comp_data = component_datas_list[i];
for(auto i = 0; entity_component_data_list.size() > i; ++i) {
auto& comp_data = entity_component_data_list[i];
auto& comp_ids = component_ids_list[i];

auto& comp_data_list = entity_components_owner.emplace_back();
Expand Down Expand Up @@ -217,23 +217,23 @@ void ecsact_dump_entities(
callback(&components_count, sizeof(components_count), callback_user_data);

auto component_ids = std::vector<ecsact_component_id>{};
auto component_datas = std::vector<const void*>{};
auto component_data_list = std::vector<const void*>{};

component_ids.resize(components_count);
component_datas.resize(components_count);
component_data_list.resize(components_count);

ecsact_get_components(
registry_id,
entity,
components_count,
component_ids.data(),
component_datas.data(),
component_data_list.data(),
nullptr
);

for(int i = 0; components_count > i; ++i) {
const auto component_id = component_ids[i];
const auto component_data = component_datas[i];
const auto component_data = component_data_list[i];
const auto component_size = ecsact_serialize_component_size(component_id);

auto serialized_component_data =
Expand Down
2 changes: 1 addition & 1 deletion test/async/async_ref_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void async_test::RemoveComponent::impl(context& ctx) {
}

void async_test::TryEntity::impl(context& ctx) {
// santity check
// sanity check
ctx.action();
}

Expand Down

0 comments on commit 08d7693

Please sign in to comment.