Skip to content

Commit

Permalink
fix: set last_layer_id only in tool code in isometric_map.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
piiertho committed Jan 4, 2024
1 parent e0c942b commit 531b9de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/editor/isometric_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ IsometricEditorPlugin::IsometricEditorPlugin() :
select_all_command_emitter(),
delete_command_emitter(),
move_editor_drawer_command_emitter(),
rotate_editor_plane_command_emitter()
rotate_editor_plane_command_emitter(),
layers_editor()
{
grid_color_picker_button->set_text(GRID_COLOR_PICKER_TITLE);
grid_color_picker_button->connect("color_changed", Callable(this, "_on_grid_color_picker_change"));
Expand Down
8 changes: 7 additions & 1 deletion src/node/isometric_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ using namespace node;

static const char* DEFAULT_LAYER_NAME = "Default";

IsometricMap::IsometricMap() : child_positionable_initialized(false), last_layer_id(0) {
IsometricMap::IsometricMap() : child_positionable_initialized(false)
#ifdef TOOLS_ENABLED
, last_layer_id(0)
#endif
{
is_container = true;
}

Expand Down Expand Up @@ -153,9 +157,11 @@ void IsometricMap::set_layer_visible(uint32_t p_layer_id, bool is_visible) {
void IsometricMap::_enter_tree() {
IsometricPositionable::_enter_tree();

#ifdef TOOLS_ENABLED
if (last_layer_id == DEFAULT_LAYER_ID && layers.size() == 0) {
layers[last_layer_id] = DEFAULT_LAYER_NAME;
}
#endif

if (child_positionable_initialized) { return; }
const Vector<int>& id_vector {grid_3d.get_internal_array()};
Expand Down

0 comments on commit 531b9de

Please sign in to comment.