Skip to content

Commit 0416b8f

Browse files
Revert unnecessary variable renames from MSVC warning fixes
Restore original variable names that were renamed to avoid shadowing warnings (C4456/C4458). These warnings are already suppressed via /wd4456 and /wd4458 in CMakeLists.txt, making the renames unnecessary. Keeps all legitimate fixes intact (static_cast, [[maybe_unused]], default initialization, unnamed parameters, literal suffixes, etc.).
1 parent 695778d commit 0416b8f

23 files changed

+156
-156
lines changed

include/edyn/core/entity_graph.hpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ void entity_graph::visit_edges(index_type node_index0, index_type node_index1, F
219219
} else {
220220
func(edge_index);
221221
}
222-
auto &current_edge = m_edges[edge_index];
223-
EDYN_ASSERT(current_edge.next != edge_index);
224-
edge_index = current_edge.next;
222+
auto &edge = m_edges[edge_index];
223+
EDYN_ASSERT(edge.next != edge_index);
224+
edge_index = edge.next;
225225
}
226226
break;
227227
}
@@ -241,9 +241,9 @@ void entity_graph::visit_edges(index_type node_index, Func func) const {
241241
auto edge_index = adj.edge_index;
242242

243243
while (edge_index != null_index) {
244-
auto &current_edge = m_edges[edge_index];
245-
EDYN_ASSERT(current_edge.next != edge_index);
246-
auto next_edge_index = current_edge.next;
244+
auto &edge = m_edges[edge_index];
245+
EDYN_ASSERT(edge.next != edge_index);
246+
auto next_edge_index = edge.next;
247247
if constexpr(std::is_invocable_r_v<bool, Func, index_type>) {
248248
if (!func(edge_index)) {
249249
return;
@@ -296,33 +296,33 @@ void entity_graph::reach(It first, It last, VisitNodeFunc visit_node_func,
296296

297297
visited[node_index] = true;
298298

299-
const auto &current_node = m_nodes[node_index];
300-
EDYN_ASSERT(current_node.entity != entt::null);
301-
visit_node_func(current_node.entity);
299+
const auto &node = m_nodes[node_index];
300+
EDYN_ASSERT(node.entity != entt::null);
301+
visit_node_func(node.entity);
302302

303303
// Stop here for non-connecting nodes. Do not visit edges.
304-
if (current_node.non_connecting) {
304+
if (node.non_connecting) {
305305
non_connecting_indices.push_back(node_index);
306306
continue;
307307
}
308308

309309
// Visit all edges in all adjacencies.
310-
auto adj_index = current_node.adjacency_index;
310+
auto adj_index = node.adjacency_index;
311311

312312
while (adj_index != null_index) {
313313
auto &adj = m_adjacencies[adj_index];
314314
auto edge_index = adj.edge_index;
315315

316316
while (edge_index != null_index) {
317-
auto &current_edge = m_edges[edge_index];
317+
auto &edge = m_edges[edge_index];
318318

319319
if (!visited_edges[edge_index]) {
320-
EDYN_ASSERT(current_edge.entity != entt::null);
321-
visit_edge_func(current_edge.entity);
320+
EDYN_ASSERT(edge.entity != entt::null);
321+
visit_edge_func(edge.entity);
322322
visited_edges[edge_index] = true;
323323
}
324324

325-
edge_index = current_edge.next;
325+
edge_index = edge.next;
326326
}
327327

328328
// Perhaps visit neighboring node and its edges next.
@@ -375,18 +375,18 @@ void entity_graph::traverse(index_type start_node_index,
375375
to_visit.pop_back();
376376

377377
visited[node_index] = true;
378-
const auto &current_node = m_nodes[node_index];
379-
EDYN_ASSERT(current_node.entity != entt::null);
378+
const auto &node = m_nodes[node_index];
379+
EDYN_ASSERT(node.entity != entt::null);
380380

381381
visit_node_func(node_index);
382382

383383
// Do not visit neighbors of non-connecting nodes.
384-
if (current_node.non_connecting) {
384+
if (node.non_connecting) {
385385
continue;
386386
}
387387

388388
// Add neighbors to be visited.
389-
auto adj_index = current_node.adjacency_index;
389+
auto adj_index = node.adjacency_index;
390390

391391
while (adj_index != null_index) {
392392
auto &adj = m_adjacencies[adj_index];
@@ -395,15 +395,15 @@ void entity_graph::traverse(index_type start_node_index,
395395
auto edge_index = adj.edge_index;
396396

397397
while (edge_index != null_index) {
398-
auto &current_edge = m_edges[edge_index];
398+
auto &edge = m_edges[edge_index];
399399

400400
if (!visited_edges[edge_index]) {
401-
EDYN_ASSERT(current_edge.entity != entt::null);
401+
EDYN_ASSERT(edge.entity != entt::null);
402402
visit_edge_func(edge_index);
403403
visited_edges[edge_index] = true;
404404
}
405405

406-
edge_index = current_edge.next;
406+
edge_index = edge.next;
407407
}
408408
}
409409

include/edyn/core/unordered_pair.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ struct unordered_pair {
1414
T second;
1515

1616
unordered_pair() = default;
17-
unordered_pair(T f, T s)
18-
: first(f)
19-
, second(s)
17+
unordered_pair(T first, T second)
18+
: first(first)
19+
, second(second)
2020
{}
2121

2222
auto operator[](unsigned idx) const {

include/edyn/networking/comp/action_history.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ struct action_history {
2121
std::vector<uint8_t> data; // Serialized action list binary data.
2222

2323
entry() = default;
24-
entry(double t, action_index_type idx, std::vector<uint8_t> &&d)
25-
: timestamp(t)
26-
, action_index(idx)
27-
, data(std::move(d))
24+
entry(double timestamp, action_index_type action_index, std::vector<uint8_t> &&data)
25+
: timestamp(timestamp)
26+
, action_index(action_index)
27+
, data(std::move(data))
2828
{}
2929
};
3030

@@ -37,7 +37,7 @@ struct action_history {
3737

3838
void erase_until(double timestamp) {
3939
auto it = std::find_if(entries.begin(), entries.end(),
40-
[timestamp](auto &&e) { return e.timestamp >= timestamp; });
40+
[timestamp](auto &&entry) { return entry.timestamp >= timestamp; });
4141
entries.erase(entries.begin(), it);
4242
}
4343

@@ -46,7 +46,7 @@ struct action_history {
4646

4747
// Only append newer entries.
4848
auto other_begin = std::find_if(other.entries.begin(), other.entries.end(),
49-
[&](auto &&e) { return e.timestamp > last_timestamp; });
49+
[&](auto &&entry) { return entry.timestamp > last_timestamp; });
5050
entries.insert(entries.end(), other_begin, other.entries.end());
5151

5252
if (!entries.empty()) {

include/edyn/networking/networking_external.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ void register_networked_components(entt::registry &registry, std::tuple<Actions.
4141
std::shared_ptr<std::remove_pointer_t<decltype(input_history)>>(input_history);
4242
ctx->input_history.reset(new input_state_history_writer_impl(input_history_ptr));
4343

44-
ctx->make_extrapolation_modified_comp = [](entt::registry &reg) {
45-
auto ext = std::tuple<Components...>{};
46-
auto comps = std::tuple_cat(networked_components, ext);
44+
ctx->make_extrapolation_modified_comp = [](entt::registry &registry) {
45+
auto external = std::tuple<Components...>{};
46+
auto all = std::tuple_cat(networked_components, external);
4747
return std::unique_ptr<extrapolation_modified_comp>(
48-
new extrapolation_modified_comp_impl(reg, comps));
48+
new extrapolation_modified_comp_impl(registry, all));
4949
};
5050

5151
auto input_history_reader = new input_state_history_reader_impl(input_history_ptr, actions);

include/edyn/networking/packet/registry_snapshot.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ namespace edyn::internal {
4848
using pool_snapshot_data_t = pool_snapshot_data_impl<Component>;
4949

5050
auto pool = std::find_if(pools.begin(), pools.end(),
51-
[component_index](auto &&p) {
52-
return p.component_index == component_index;
51+
[component_index](auto &&pool) {
52+
return pool.component_index == component_index;
5353
});
5454

5555
if (pool == pools.end()) {

include/edyn/networking/packet/server_settings.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ struct server_settings {
1818

1919
server_settings() = default;
2020

21-
server_settings(settings &settings, bool allow_full_ownership_)
21+
server_settings(settings &settings, bool allow_full_ownership)
2222
: fixed_dt(settings.fixed_dt)
2323
, gravity(settings.gravity)
2424
, num_solver_velocity_iterations(static_cast<uint8_t>(settings.num_solver_velocity_iterations))
2525
, num_solver_position_iterations(static_cast<uint8_t>(settings.num_solver_position_iterations))
2626
, num_restitution_iterations(static_cast<uint8_t>(settings.num_restitution_iterations))
2727
, num_individual_restitution_iterations(static_cast<uint8_t>(settings.num_individual_restitution_iterations))
28-
, allow_full_ownership(allow_full_ownership_)
28+
, allow_full_ownership(allow_full_ownership)
2929
{}
3030
};
3131

include/edyn/networking/util/asset_util.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ void assign_to_asset(entt::registry &registry, entt::entity entity, entt::entity
3333
if constexpr(sizeof...(Component) > 0) {
3434
if (auto *ctx = registry.ctx().find<client_network_context>()) {
3535
(entry.sync_indices.push_back(ctx->snapshot_exporter->get_component_index<Component>()), ...);
36-
} else if (auto *server_ctx = registry.ctx().find<server_network_context>()) {
37-
(entry.sync_indices.push_back(server_ctx->snapshot_exporter->get_component_index<Component>()), ...);
36+
} else if (auto *ctx = registry.ctx().find<server_network_context>()) {
37+
(entry.sync_indices.push_back(ctx->snapshot_exporter->get_component_index<Component>()), ...);
3838
}
3939
}
4040
}

include/edyn/networking/util/server_snapshot_exporter.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ class server_snapshot_exporter_impl : public server_snapshot_exporter {
208208
bool temporary_ownership = false;
209209

210210
if (allow_ownership) {
211-
graph.traverse(node_index, [&](auto edge_node_index) {
212-
auto neighbor = graph.node_entity(edge_node_index);
211+
graph.traverse(node_index, [&](auto node_index) {
212+
auto neighbor = graph.node_entity(node_index);
213213

214214
if (owner_view.contains(neighbor)) {
215215
auto [owner] = owner_view.get(neighbor);

include/edyn/networking/util/server_snapshot_importer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ class server_snapshot_importer_impl : public server_snapshot_importer {
9090
node_index = node.node_index;
9191
}
9292

93-
graph.traverse(node_index, [&](auto traversed_node_index) {
94-
auto neighbor = graph.node_entity(traversed_node_index);
93+
graph.traverse(node_index, [&](auto node_index) {
94+
auto neighbor = graph.node_entity(node_index);
9595

9696
if (owner_view.contains(neighbor)) {
9797
auto [owner] = owner_view.get(neighbor);

include/edyn/parallel/atomic_counter_sync.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace edyn {
99

1010
class atomic_counter_sync {
1111
public:
12-
atomic_counter_sync(size_t initial_count)
13-
: count(initial_count)
12+
atomic_counter_sync(size_t count)
13+
: count(count)
1414
, done(false)
1515
{}
1616

0 commit comments

Comments
 (0)