We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 59b3f5a commit e135e9bCopy full SHA for e135e9b
src/terrain_3d_storage.cpp
@@ -31,16 +31,16 @@ void Terrain3DStorage::_clear() {
31
///////////////////////////
32
33
void Terrain3DStorage::initialize(Terrain3D *p_terrain) {
34
- if (p_terrain != nullptr) {
35
- _terrain = p_terrain;
36
- } else {
+ if (p_terrain == nullptr) {
37
LOG(ERROR, "Initialization failed, p_terrain is null");
38
return;
39
}
40
LOG(INFO, "Initializing storage");
+ bool initialized = _terrain != nullptr;
+ _terrain = p_terrain;
41
_region_map.resize(REGION_MAP_SIZE * REGION_MAP_SIZE);
42
_mesh_vertex_spacing = _terrain->get_mesh_vertex_spacing();
43
- if (!_terrain->get_storage_directory().is_empty()) {
+ if (!initialized && !_terrain->get_storage_directory().is_empty()) {
44
load_directory(_terrain->get_storage_directory());
45
46
0 commit comments