mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
Merge pull request #94889 from rune-scape/no-const-list-erase
Remove const_cast in `List::erase`
This commit is contained in:
commit
90ce26a27b
@ -224,7 +224,7 @@ private:
|
||||
Element *last = nullptr;
|
||||
int size_cache = 0;
|
||||
|
||||
bool erase(const Element *p_I) {
|
||||
bool erase(Element *p_I) {
|
||||
ERR_FAIL_NULL_V(p_I, false);
|
||||
ERR_FAIL_COND_V(p_I->data != this, false);
|
||||
|
||||
@ -244,7 +244,7 @@ private:
|
||||
p_I->next_ptr->prev_ptr = p_I->prev_ptr;
|
||||
}
|
||||
|
||||
memdelete_allocator<Element, A>(const_cast<Element *>(p_I));
|
||||
memdelete_allocator<Element, A>(p_I);
|
||||
size_cache--;
|
||||
|
||||
return true;
|
||||
@ -430,7 +430,7 @@ public:
|
||||
/**
|
||||
* erase an element in the list, by iterator pointing to it. Return true if it was found/erased.
|
||||
*/
|
||||
bool erase(const Element *p_I) {
|
||||
bool erase(Element *p_I) {
|
||||
if (_data && p_I) {
|
||||
bool ret = _data->erase(p_I);
|
||||
|
||||
|
@ -1472,7 +1472,7 @@ void VisualShaderGraphPlugin::disconnect_nodes(VisualShader::Type p_type, int p_
|
||||
if (visual_shader.is_valid() && visual_shader->get_shader_type() == p_type) {
|
||||
graph->disconnect_node(itos(p_from_node), p_from_port, itos(p_to_node), p_to_port);
|
||||
|
||||
for (const List<VisualShader::Connection>::Element *E = connections.front(); E; E = E->next()) {
|
||||
for (List<VisualShader::Connection>::Element *E = connections.front(); E; E = E->next()) {
|
||||
if (E->get().from_node == p_from_node && E->get().from_port == p_from_port && E->get().to_node == p_to_node && E->get().to_port == p_to_port) {
|
||||
connections.erase(E);
|
||||
break;
|
||||
|
@ -317,7 +317,7 @@ bool GraphEdit::is_node_connected(const StringName &p_from, int p_from_port, con
|
||||
void GraphEdit::disconnect_node(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port) {
|
||||
ERR_FAIL_NULL_MSG(connections_layer, "connections_layer is missing.");
|
||||
|
||||
for (const List<Ref<Connection>>::Element *E = connections.front(); E; E = E->next()) {
|
||||
for (List<Ref<Connection>>::Element *E = connections.front(); E; E = E->next()) {
|
||||
if (E->get()->from_node == p_from && E->get()->from_port == p_from_port && E->get()->to_node == p_to && E->get()->to_port == p_to_port) {
|
||||
connection_map[p_from].erase(E->get());
|
||||
connection_map[p_to].erase(E->get());
|
||||
|
@ -1368,7 +1368,7 @@ void VisualShader::disconnect_nodes(Type p_type, int p_from_node, int p_from_por
|
||||
ERR_FAIL_INDEX(p_type, TYPE_MAX);
|
||||
Graph *g = &graph[p_type];
|
||||
|
||||
for (const List<Connection>::Element *E = g->connections.front(); E; E = E->next()) {
|
||||
for (List<Connection>::Element *E = g->connections.front(); E; E = E->next()) {
|
||||
if (E->get().from_node == p_from_node && E->get().from_port == p_from_port && E->get().to_node == p_to_node && E->get().to_port == p_to_port) {
|
||||
g->connections.erase(E);
|
||||
g->nodes[p_from_node].next_connected_nodes.erase(p_to_node);
|
||||
|
Loading…
Reference in New Issue
Block a user