Skip to content

Commit 1fee649

Browse files
lhofhanslnerzhul
authored andcommittedJan 8, 2017
Minor: Fix indentation in serverenvironment.cpp
1 parent 98e36d7 commit 1fee649

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed
 

‎src/serverenvironment.cpp

+51-51
Original file line numberDiff line numberDiff line change
@@ -770,65 +770,65 @@ class ABMHandler
770770

771771
v3s16 p0;
772772
for(p0.X=0; p0.X<MAP_BLOCKSIZE; p0.X++)
773-
for(p0.Y=0; p0.Y<MAP_BLOCKSIZE; p0.Y++)
774-
for(p0.Z=0; p0.Z<MAP_BLOCKSIZE; p0.Z++)
775-
{
776-
const MapNode &n = block->getNodeUnsafe(p0);
777-
content_t c = n.getContent();
773+
for(p0.Y=0; p0.Y<MAP_BLOCKSIZE; p0.Y++)
774+
for(p0.Z=0; p0.Z<MAP_BLOCKSIZE; p0.Z++)
775+
{
776+
const MapNode &n = block->getNodeUnsafe(p0);
777+
content_t c = n.getContent();
778778

779-
if (c >= m_aabms.size() || !m_aabms[c])
780-
continue;
779+
if (c >= m_aabms.size() || !m_aabms[c])
780+
continue;
781781

782-
v3s16 p = p0 + block->getPosRelative();
783-
for(std::vector<ActiveABM>::iterator
784-
i = m_aabms[c]->begin(); i != m_aabms[c]->end(); ++i) {
785-
if(myrand() % i->chance != 0)
786-
continue;
782+
v3s16 p = p0 + block->getPosRelative();
783+
for(std::vector<ActiveABM>::iterator
784+
i = m_aabms[c]->begin(); i != m_aabms[c]->end(); ++i) {
785+
if(myrand() % i->chance != 0)
786+
continue;
787787

788-
// Check neighbors
789-
if(!i->required_neighbors.empty())
790-
{
791-
v3s16 p1;
792-
for(p1.X = p0.X-1; p1.X <= p0.X+1; p1.X++)
793-
for(p1.Y = p0.Y-1; p1.Y <= p0.Y+1; p1.Y++)
794-
for(p1.Z = p0.Z-1; p1.Z <= p0.Z+1; p1.Z++)
795-
{
796-
if(p1 == p0)
797-
continue;
798-
content_t c;
799-
if (block->isValidPosition(p1)) {
800-
// if the neighbor is found on the same map block
801-
// get it straight from there
802-
const MapNode &n = block->getNodeUnsafe(p1);
803-
c = n.getContent();
804-
} else {
805-
// otherwise consult the map
806-
MapNode n = map->getNodeNoEx(p1 + block->getPosRelative());
807-
c = n.getContent();
808-
}
809-
std::set<content_t>::const_iterator k;
810-
k = i->required_neighbors.find(c);
811-
if(k != i->required_neighbors.end()){
812-
goto neighbor_found;
813-
}
814-
}
815-
// No required neighbor found
788+
// Check neighbors
789+
if(!i->required_neighbors.empty())
790+
{
791+
v3s16 p1;
792+
for(p1.X = p0.X-1; p1.X <= p0.X+1; p1.X++)
793+
for(p1.Y = p0.Y-1; p1.Y <= p0.Y+1; p1.Y++)
794+
for(p1.Z = p0.Z-1; p1.Z <= p0.Z+1; p1.Z++)
795+
{
796+
if(p1 == p0)
816797
continue;
798+
content_t c;
799+
if (block->isValidPosition(p1)) {
800+
// if the neighbor is found on the same map block
801+
// get it straight from there
802+
const MapNode &n = block->getNodeUnsafe(p1);
803+
c = n.getContent();
804+
} else {
805+
// otherwise consult the map
806+
MapNode n = map->getNodeNoEx(p1 + block->getPosRelative());
807+
c = n.getContent();
817808
}
818-
neighbor_found:
819-
820-
// Call all the trigger variations
821-
i->abm->trigger(m_env, p, n);
822-
i->abm->trigger(m_env, p, n,
823-
active_object_count, active_object_count_wider);
824-
825-
// Count surrounding objects again if the abms added any
826-
if(m_env->m_added_objects > 0) {
827-
active_object_count = countObjects(block, map, active_object_count_wider);
828-
m_env->m_added_objects = 0;
809+
std::set<content_t>::const_iterator k;
810+
k = i->required_neighbors.find(c);
811+
if(k != i->required_neighbors.end()){
812+
goto neighbor_found;
829813
}
830814
}
815+
// No required neighbor found
816+
continue;
831817
}
818+
neighbor_found:
819+
820+
// Call all the trigger variations
821+
i->abm->trigger(m_env, p, n);
822+
i->abm->trigger(m_env, p, n,
823+
active_object_count, active_object_count_wider);
824+
825+
// Count surrounding objects again if the abms added any
826+
if(m_env->m_added_objects > 0) {
827+
active_object_count = countObjects(block, map, active_object_count_wider);
828+
m_env->m_added_objects = 0;
829+
}
830+
}
831+
}
832832
}
833833
};
834834

0 commit comments

Comments
 (0)
Please sign in to comment.