From 1fee649f1586c39510169f4dbc84b6c7aed12cfd Mon Sep 17 00:00:00 2001 From: Lars Hofhansl Date: Sun, 8 Jan 2017 09:32:16 -0800 Subject: Minor: Fix indentation in serverenvironment.cpp --- src/serverenvironment.cpp | 102 +++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 51 deletions(-) (limited to 'src/serverenvironment.cpp') diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp index 6229e4cf1..c9fa64ec5 100644 --- a/src/serverenvironment.cpp +++ b/src/serverenvironment.cpp @@ -770,65 +770,65 @@ public: v3s16 p0; for(p0.X=0; p0.XgetNodeUnsafe(p0); - content_t c = n.getContent(); + for(p0.Y=0; p0.YgetNodeUnsafe(p0); + content_t c = n.getContent(); - if (c >= m_aabms.size() || !m_aabms[c]) - continue; + if (c >= m_aabms.size() || !m_aabms[c]) + continue; - v3s16 p = p0 + block->getPosRelative(); - for(std::vector::iterator - i = m_aabms[c]->begin(); i != m_aabms[c]->end(); ++i) { - if(myrand() % i->chance != 0) - continue; + v3s16 p = p0 + block->getPosRelative(); + for(std::vector::iterator + i = m_aabms[c]->begin(); i != m_aabms[c]->end(); ++i) { + if(myrand() % i->chance != 0) + continue; - // Check neighbors - if(!i->required_neighbors.empty()) - { - v3s16 p1; - for(p1.X = p0.X-1; p1.X <= p0.X+1; p1.X++) - for(p1.Y = p0.Y-1; p1.Y <= p0.Y+1; p1.Y++) - for(p1.Z = p0.Z-1; p1.Z <= p0.Z+1; p1.Z++) - { - if(p1 == p0) - continue; - content_t c; - if (block->isValidPosition(p1)) { - // if the neighbor is found on the same map block - // get it straight from there - const MapNode &n = block->getNodeUnsafe(p1); - c = n.getContent(); - } else { - // otherwise consult the map - MapNode n = map->getNodeNoEx(p1 + block->getPosRelative()); - c = n.getContent(); - } - std::set::const_iterator k; - k = i->required_neighbors.find(c); - if(k != i->required_neighbors.end()){ - goto neighbor_found; - } - } - // No required neighbor found + // Check neighbors + if(!i->required_neighbors.empty()) + { + v3s16 p1; + for(p1.X = p0.X-1; p1.X <= p0.X+1; p1.X++) + for(p1.Y = p0.Y-1; p1.Y <= p0.Y+1; p1.Y++) + for(p1.Z = p0.Z-1; p1.Z <= p0.Z+1; p1.Z++) + { + if(p1 == p0) continue; + content_t c; + if (block->isValidPosition(p1)) { + // if the neighbor is found on the same map block + // get it straight from there + const MapNode &n = block->getNodeUnsafe(p1); + c = n.getContent(); + } else { + // otherwise consult the map + MapNode n = map->getNodeNoEx(p1 + block->getPosRelative()); + c = n.getContent(); } - neighbor_found: - - // Call all the trigger variations - i->abm->trigger(m_env, p, n); - i->abm->trigger(m_env, p, n, - active_object_count, active_object_count_wider); - - // Count surrounding objects again if the abms added any - if(m_env->m_added_objects > 0) { - active_object_count = countObjects(block, map, active_object_count_wider); - m_env->m_added_objects = 0; + std::set::const_iterator k; + k = i->required_neighbors.find(c); + if(k != i->required_neighbors.end()){ + goto neighbor_found; } } + // No required neighbor found + continue; } + neighbor_found: + + // Call all the trigger variations + i->abm->trigger(m_env, p, n); + i->abm->trigger(m_env, p, n, + active_object_count, active_object_count_wider); + + // Count surrounding objects again if the abms added any + if(m_env->m_added_objects > 0) { + active_object_count = countObjects(block, map, active_object_count_wider); + m_env->m_added_objects = 0; + } + } + } } }; -- cgit v1.2.3