aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2018-03-02 13:39:39 +0000
committerSmallJoker <mk939@ymail.com>2018-06-03 17:32:00 +0200
commita6b9acb7af7ac7b8dd184ee33ced425b616b9744 (patch)
tree3468de3492ab3932259122e5be7d383923a92a2b /src
parentc40f535df83ab8d10b0f9cc93c2531ac79036dd0 (diff)
downloadminetest-a6b9acb7af7ac7b8dd184ee33ced425b616b9744.tar.gz
minetest-a6b9acb7af7ac7b8dd184ee33ced425b616b9744.tar.bz2
minetest-a6b9acb7af7ac7b8dd184ee33ced425b616b9744.zip
Generate Notifier: Clear events once after all 'on generated' functions
Diffstat (limited to 'src')
-rw-r--r--src/emerge.cpp6
-rw-r--r--src/mapgen.cpp10
-rw-r--r--src/mapgen.h4
3 files changed, 14 insertions, 6 deletions
diff --git a/src/emerge.cpp b/src/emerge.cpp
index d24971e44..f7f6ff603 100644
--- a/src/emerge.cpp
+++ b/src/emerge.cpp
@@ -570,6 +570,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.cpp b/src/mapgen.cpp
index cb0100722..6fe2906bb 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -982,8 +982,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;
@@ -995,9 +994,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.h b/src/mapgen.h
index d1845d598..4e0d75b39 100644
--- a/src/mapgen.h
+++ b/src/mapgen.h
@@ -101,8 +101,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;