diff options
author | paramat <paramat@users.noreply.github.com> | 2018-03-02 13:39:39 +0000 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2018-03-03 22:59:49 +0000 |
commit | 07622bf9b49830aae2a5e12b5616471da6a8b19a (patch) | |
tree | a2319dd495e14a32e721fc696302ca4ce2a00815 | |
parent | b952d42000a4038cd759a7829286a33fa91391d3 (diff) | |
download | minetest-07622bf9b49830aae2a5e12b5616471da6a8b19a.tar.gz minetest-07622bf9b49830aae2a5e12b5616471da6a8b19a.tar.bz2 minetest-07622bf9b49830aae2a5e12b5616471da6a8b19a.zip |
Generate Notifier: Clear events once after all 'on generated' functions
-rw-r--r-- | src/emerge.cpp | 6 | ||||
-rw-r--r-- | src/mapgen/mapgen.cpp | 10 | ||||
-rw-r--r-- | src/mapgen/mapgen.h | 4 |
3 files changed, 14 insertions, 6 deletions
diff --git a/src/emerge.cpp b/src/emerge.cpp index ffe387f63..277841053 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -585,6 +585,12 @@ MapBlock *EmergeThread::finishGen(v3s16 pos, BlockMakeData *bmdata, m_server->setAsyncFatalError("Lua: finishGen" + std::string(e.what())); } + /* + Clear generate notifier events + */ + Mapgen *mg = m_emerge->getCurrentMapgen(); + mg->gennotify.clearEvents(); + EMERGE_DBG_OUT("ended up with: " << analyze_block(block)); /* diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index 5e581086f..5f7a9d6cf 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -1003,8 +1003,7 @@ bool GenerateNotifier::addEvent(GenNotifyType type, v3s16 pos, u32 id) void GenerateNotifier::getEvents( - std::map<std::string, std::vector<v3s16> > &event_map, - bool peek_events) + std::map<std::string, std::vector<v3s16> > &event_map) { std::list<GenNotifyEvent>::iterator it; @@ -1016,9 +1015,12 @@ void GenerateNotifier::getEvents( event_map[name].push_back(gn.pos); } +} + - if (!peek_events) - m_notify_events.clear(); +void GenerateNotifier::clearEvents() +{ + m_notify_events.clear(); } diff --git a/src/mapgen/mapgen.h b/src/mapgen/mapgen.h index 6ca907573..2ebba68ea 100644 --- a/src/mapgen/mapgen.h +++ b/src/mapgen/mapgen.h @@ -99,8 +99,8 @@ public: void setNotifyOnDecoIds(std::set<u32> *notify_on_deco_ids); bool addEvent(GenNotifyType type, v3s16 pos, u32 id=0); - void getEvents(std::map<std::string, std::vector<v3s16> > &event_map, - bool peek_events=false); + void getEvents(std::map<std::string, std::vector<v3s16> > &event_map); + void clearEvents(); private: u32 m_notify_on = 0; |