From 8f7785771b9e02b1a1daf7a252550d78ea93053d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sat, 17 Jun 2017 19:11:28 +0200 Subject: Cpp11 initializers 2 (#5999) * C++11 patchset 10: continue cleanup on constructors * Drop obsolete bool MainMenuData::enable_public (setting is called with cURL in server loop) * More classes cleanup * More classes cleanup + change NULL tests to boolean tests --- src/map.h | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'src/map.h') diff --git a/src/map.h b/src/map.h index 7fc502793..377e75ed0 100644 --- a/src/map.h +++ b/src/map.h @@ -72,17 +72,13 @@ enum MapEditEventType{ struct MapEditEvent { - MapEditEventType type; + MapEditEventType type = MEET_OTHER; v3s16 p; - MapNode n; + MapNode n = CONTENT_AIR; std::set modified_blocks; - u16 already_known_by_peer; + u16 already_known_by_peer = 0; - MapEditEvent(): - type(MEET_OTHER), - n(CONTENT_AIR), - already_known_by_peer(0) - { } + MapEditEvent() {} MapEditEvent * clone() { @@ -323,7 +319,7 @@ protected: std::map m_sectors; // Be sure to set this to NULL when the cached sector is deleted - MapSector *m_sector_cache; + MapSector *m_sector_cache = nullptr; v2s16 m_sector_cache_p; // Queued transforming water nodes @@ -336,10 +332,10 @@ protected: float start_off, float end_off, u32 needed_count); private: - f32 m_transforming_liquid_loop_count_multiplier; - u32 m_unprocessed_count; - u64 m_inc_trending_up_start_time; // milliseconds - bool m_queue_size_timer_started; + f32 m_transforming_liquid_loop_count_multiplier = 1.0f; + u32 m_unprocessed_count = 0; + u64 m_inc_trending_up_start_time = 0; // milliseconds + bool m_queue_size_timer_started = false; }; /* @@ -501,8 +497,8 @@ private: Metadata is re-written on disk only if this is true. This is reset to false when written on disk. */ - bool m_map_metadata_changed; - MapDatabase *dbase; + bool m_map_metadata_changed = true; + MapDatabase *dbase = nullptr; }; @@ -521,9 +517,6 @@ public: m_loaded_blocks.clear(); } - void setMap(Map *map) - {m_map = map;} - void initialEmerge(v3s16 blockpos_min, v3s16 blockpos_max, bool load_if_inexistent = true); @@ -531,10 +524,9 @@ public: void blitBackAll(std::map * modified_blocks, bool overwrite_generated = true); - bool m_is_dirty; + bool m_is_dirty = false; protected: - bool m_create_area; Map *m_map; /* key = blockpos -- cgit v1.2.3