Get rid of easily removable uses of const_cast
This commit is contained in:
@@ -169,7 +169,7 @@ void GodotPhysicsServer3D::space_set_active(RID p_space, bool p_active) {
|
||||
}
|
||||
|
||||
bool GodotPhysicsServer3D::space_is_active(RID p_space) const {
|
||||
const GodotSpace3D *space = space_owner.get_or_null(p_space);
|
||||
GodotSpace3D *space = space_owner.get_or_null(p_space);
|
||||
ERR_FAIL_NULL_V(space, false);
|
||||
|
||||
return active_spaces.has(space);
|
||||
@@ -1638,8 +1638,8 @@ void GodotPhysicsServer3D::step(real_t p_step) {
|
||||
island_count = 0;
|
||||
active_objects = 0;
|
||||
collision_pairs = 0;
|
||||
for (const GodotSpace3D *E : active_spaces) {
|
||||
stepper->step(const_cast<GodotSpace3D *>(E), p_step);
|
||||
for (GodotSpace3D *E : active_spaces) {
|
||||
stepper->step(E, p_step);
|
||||
island_count += E->get_island_count();
|
||||
active_objects += E->get_active_objects();
|
||||
collision_pairs += E->get_collision_pairs();
|
||||
@@ -1659,8 +1659,8 @@ void GodotPhysicsServer3D::flush_queries() {
|
||||
|
||||
uint64_t time_beg = OS::get_singleton()->get_ticks_usec();
|
||||
|
||||
for (const GodotSpace3D *E : active_spaces) {
|
||||
GodotSpace3D *space = const_cast<GodotSpace3D *>(E);
|
||||
for (GodotSpace3D *E : active_spaces) {
|
||||
GodotSpace3D *space = E;
|
||||
space->call_queries();
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class GodotPhysicsServer3D : public PhysicsServer3D {
|
||||
bool flushing_queries = false;
|
||||
|
||||
GodotStep3D *stepper = nullptr;
|
||||
HashSet<const GodotSpace3D *> active_spaces;
|
||||
HashSet<GodotSpace3D *> active_spaces;
|
||||
|
||||
mutable RID_PtrOwner<GodotShape3D, true> shape_owner;
|
||||
mutable RID_PtrOwner<GodotSpace3D, true> space_owner;
|
||||
|
||||
@@ -69,7 +69,7 @@ void GodotShape3D::configure(const AABB &p_aabb) {
|
||||
aabb = p_aabb;
|
||||
configured = true;
|
||||
for (const KeyValue<GodotShapeOwner3D *, int> &E : owners) {
|
||||
GodotShapeOwner3D *co = const_cast<GodotShapeOwner3D *>(E.key);
|
||||
GodotShapeOwner3D *co = E.key;
|
||||
co->_shape_changed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ void GodotStep3D::_populate_island(GodotBody3D *p_body, LocalVector<GodotBody3D
|
||||
}
|
||||
|
||||
for (const KeyValue<GodotConstraint3D *, int> &E : p_body->get_constraint_map()) {
|
||||
GodotConstraint3D *constraint = const_cast<GodotConstraint3D *>(E.key);
|
||||
GodotConstraint3D *constraint = E.key;
|
||||
if (constraint->get_island_step() == _step) {
|
||||
continue; // Already processed.
|
||||
}
|
||||
@@ -88,8 +88,8 @@ void GodotStep3D::_populate_island(GodotBody3D *p_body, LocalVector<GodotBody3D
|
||||
void GodotStep3D::_populate_island_soft_body(GodotSoftBody3D *p_soft_body, LocalVector<GodotBody3D *> &p_body_island, LocalVector<GodotConstraint3D *> &p_constraint_island) {
|
||||
p_soft_body->set_island_step(_step);
|
||||
|
||||
for (const GodotConstraint3D *E : p_soft_body->get_constraints()) {
|
||||
GodotConstraint3D *constraint = const_cast<GodotConstraint3D *>(E);
|
||||
for (GodotConstraint3D *E : p_soft_body->get_constraints()) {
|
||||
GodotConstraint3D *constraint = E;
|
||||
if (constraint->get_island_step() == _step) {
|
||||
continue; // Already processed.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user