Revert "Fix issue #2441: crash on respawn, since a conversion std::list to std::vector on Environment.cpp"

This reverts parts of commit 9749d9fee6db99da1ab861dc04ec63ef973db3e0, which breaks node resolver
list clearing
This commit is contained in:
kwolekr 2015-03-20 18:40:18 -04:00
parent d03c2999da
commit 26153bab7d
5 changed files with 12 additions and 11 deletions

@ -412,8 +412,9 @@ void GenerateNotifier::getEvents(
std::map<std::string, std::vector<v3s16> > &event_map, std::map<std::string, std::vector<v3s16> > &event_map,
bool peek_events) bool peek_events)
{ {
for (std::vector<GenNotifyEvent>::iterator it = m_notify_events.begin(); std::list<GenNotifyEvent>::iterator it;
it != m_notify_events.end(); ++it) {
for (it = m_notify_events.begin(); it != m_notify_events.end(); ++it) {
GenNotifyEvent &gn = *it; GenNotifyEvent &gn = *it;
std::string name = (gn.type == GENNOTIFY_DECORATION) ? std::string name = (gn.type == GENNOTIFY_DECORATION) ?
"decoration#"+ itos(gn.id) : "decoration#"+ itos(gn.id) :

@ -91,7 +91,7 @@ public:
private: private:
u32 m_notify_on; u32 m_notify_on;
std::set<u32> *m_notify_on_deco_ids; std::set<u32> *m_notify_on_deco_ids;
std::vector<GenNotifyEvent> m_notify_events; std::list<GenNotifyEvent> m_notify_events;
}; };
struct MapgenSpecificParams { struct MapgenSpecificParams {

@ -445,7 +445,7 @@ private:
content_t m_next_id; content_t m_next_id;
// List of node strings and node resolver callbacks to perform // List of node strings and node resolver callbacks to perform
std::vector<NodeResolveInfo *> m_pending_node_lookups; std::list<NodeResolveInfo *> m_pending_node_lookups;
// True when all nodes have been registered // True when all nodes have been registered
bool m_node_registration_complete; bool m_node_registration_complete;
@ -481,7 +481,7 @@ void CNodeDefManager::clear()
m_next_id = 0; m_next_id = 0;
m_node_registration_complete = false; m_node_registration_complete = false;
for (std::vector<NodeResolveInfo *>::iterator for (std::list<NodeResolveInfo *>::iterator
it = m_pending_node_lookups.begin(); it = m_pending_node_lookups.begin();
it != m_pending_node_lookups.end(); it != m_pending_node_lookups.end();
++it) ++it)
@ -1320,7 +1320,7 @@ void CNodeDefManager::pendNodeResolve(NodeResolveInfo *nri)
void CNodeDefManager::cancelNodeResolve(NodeResolver *resolver) void CNodeDefManager::cancelNodeResolve(NodeResolver *resolver)
{ {
for (std::vector<NodeResolveInfo *>::iterator for (std::list<NodeResolveInfo *>::iterator
it = m_pending_node_lookups.begin(); it = m_pending_node_lookups.begin();
it != m_pending_node_lookups.end(); it != m_pending_node_lookups.end();
++it) { ++it) {
@ -1337,7 +1337,7 @@ void CNodeDefManager::runNodeResolverCallbacks()
{ {
while (!m_pending_node_lookups.empty()) { while (!m_pending_node_lookups.empty()) {
NodeResolveInfo *nri = m_pending_node_lookups.front(); NodeResolveInfo *nri = m_pending_node_lookups.front();
m_pending_node_lookups.erase(m_pending_node_lookups.begin()); m_pending_node_lookups.pop_front();
nri->resolver->resolveNodeNames(nri); nri->resolver->resolveNodeNames(nri);
nri->resolver->m_lookup_done = true; nri->resolver->m_lookup_done = true;
delete nri; delete nri;
@ -1356,7 +1356,7 @@ bool CNodeDefManager::getIdFromResolveInfo(NodeResolveInfo *nri,
content_t c; content_t c;
std::string name = nri->nodenames.front(); std::string name = nri->nodenames.front();
nri->nodenames.erase(nri->nodenames.begin()); nri->nodenames.pop_front();
bool success = getId(name, c); bool success = getId(name, c);
if (!success && node_alt != "") { if (!success && node_alt != "") {
@ -1396,7 +1396,7 @@ bool CNodeDefManager::getIdsFromResolveInfo(NodeResolveInfo *nri,
content_t c; content_t c;
std::string name = nri->nodenames.front(); std::string name = nri->nodenames.front();
nri->nodenames.erase(nri->nodenames.begin()); nri->nodenames.pop_front();
if (name.substr(0,6) != "group:") { if (name.substr(0,6) != "group:") {
if (getId(name, c)) { if (getId(name, c)) {

@ -309,7 +309,7 @@ struct NodeResolveInfo {
resolver = nr; resolver = nr;
} }
std::vector<std::string> nodenames; std::list<std::string> nodenames;
std::list<NodeListInfo> nodelistinfo; std::list<NodeListInfo> nodelistinfo;
NodeResolver *resolver; NodeResolver *resolver;
}; };

@ -459,7 +459,7 @@ int ModApiMapgen::l_register_biome(lua_State *L)
} }
NodeResolveInfo *nri = new NodeResolveInfo(b); NodeResolveInfo *nri = new NodeResolveInfo(b);
std::vector<std::string> &nnames = nri->nodenames; std::list<std::string> &nnames = nri->nodenames;
nnames.push_back(getstringfield_default(L, index, "node_top", "")); nnames.push_back(getstringfield_default(L, index, "node_top", ""));
nnames.push_back(getstringfield_default(L, index, "node_filler", "")); nnames.push_back(getstringfield_default(L, index, "node_filler", ""));
nnames.push_back(getstringfield_default(L, index, "node_stone", "")); nnames.push_back(getstringfield_default(L, index, "node_stone", ""));