summaryrefslogtreecommitdiff
path: root/modules/gridmap
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gridmap')
-rw-r--r--modules/gridmap/grid_map.cpp8
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp19
2 files changed, 11 insertions, 16 deletions
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 0cd41133f1..ca461566d3 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -519,14 +519,14 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
RS::get_singleton()->multimesh_set_mesh(mm, mesh_library->get_item_mesh(E->key())->get_rid());
int idx = 0;
- for (List<Pair<Transform3D, IndexKey>>::Element *F = E->get().front(); F; F = F->next()) {
- RS::get_singleton()->multimesh_instance_set_transform(mm, idx, F->get().first);
+ for (Pair<Transform3D, IndexKey> &F : E->get()) {
+ RS::get_singleton()->multimesh_instance_set_transform(mm, idx, F.first);
#ifdef TOOLS_ENABLED
Octant::MultimeshInstance::Item it;
it.index = idx;
- it.transform = F->get().first;
- it.key = F->get().second;
+ it.transform = F.first;
+ it.key = F.second;
mmi.items.push_back(it);
#endif
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 046f8c0adb..9530122e04 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -497,8 +497,8 @@ void GridMapEditor::_fill_selection() {
}
void GridMapEditor::_clear_clipboard_data() {
- for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
- RenderingServer::get_singleton()->free(E->get().instance);
+ for (ClipboardItem &E : clipboard_items) {
+ RenderingServer::get_singleton()->free(E.instance);
}
clipboard_items.clear();
@@ -552,9 +552,7 @@ void GridMapEditor::_update_paste_indicator() {
RenderingServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf);
- for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
- ClipboardItem &item = E->get();
-
+ for (ClipboardItem &item : clipboard_items) {
xf = Transform3D();
xf.origin = (paste_indicator.begin + (paste_indicator.current - paste_indicator.click) + center) * node->get_cell_size();
xf.basis = rot * xf.basis;
@@ -578,9 +576,7 @@ void GridMapEditor::_do_paste() {
Vector3 ofs = paste_indicator.current - paste_indicator.click;
undo_redo->create_action(TTR("GridMap Paste Selection"));
- for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
- ClipboardItem &item = E->get();
-
+ for (ClipboardItem &item : clipboard_items) {
Vector3 position = rot.xform(item.grid_offset) + paste_indicator.begin + ofs;
Basis orm;
@@ -663,8 +659,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
if ((mb->get_button_index() == MOUSE_BUTTON_RIGHT && input_action == INPUT_ERASE) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action == INPUT_PAINT)) {
if (set_items.size()) {
undo_redo->create_action(TTR("GridMap Paint"));
- for (List<SetItem>::Element *E = set_items.front(); E; E = E->next()) {
- const SetItem &si = E->get();
+ for (SetItem &si : set_items) {
undo_redo->add_do_method(node, "set_cell_item", si.position, si.new_value, si.new_orientation);
}
for (List<SetItem>::Element *E = set_items.back(); E; E = E->prev()) {
@@ -869,8 +864,8 @@ void GridMapEditor::update_palette() {
int item = 0;
- for (List<_CGMEItemSort>::Element *E = il.front(); E; E = E->next()) {
- int id = E->get().id;
+ for (_CGMEItemSort &E : il) {
+ int id = E.id;
String name = mesh_library->get_item_name(id);
Ref<Texture2D> preview = mesh_library->get_item_preview(id);