aboutsummaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-04-05 02:56:29 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-04-05 02:56:29 +0300
commitd1d57cf5c34c9a4626fd8e3b40db3ea321b40335 (patch)
treee263dcc5268f514f43521d2df86640a96be94e96 /src/map.cpp
parent281f76b6a07393906cb532bed95d5d98f0791c3a (diff)
downloadminetest-d1d57cf5c34c9a4626fd8e3b40db3ea321b40335.tar.xz
initial workings of the furnace
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/map.cpp b/src/map.cpp
index f6115a62a..40274ae29 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -1756,6 +1756,35 @@ void Map::removeNodeMetadata(v3s16 p)
block->m_node_metadata.remove(p_rel);
}
+void Map::nodeMetadataStep(float dtime,
+ core::map<v3s16, MapBlock*> &changed_blocks)
+{
+ /*
+ NOTE:
+ Currently there is no way to ensure that all the necessary
+ blocks are loaded when this is run. (They might get unloaded)
+ NOTE: ^- Actually, that might not be so. In a quick test it
+ reloaded a block with a furnace when I walked back to it from
+ a distance.
+ */
+ core::map<v2s16, MapSector*>::Iterator si;
+ si = m_sectors.getIterator();
+ for(; si.atEnd() == false; si++)
+ {
+ MapSector *sector = si.getNode()->getValue();
+ core::list< MapBlock * > sectorblocks;
+ sector->getBlocks(sectorblocks);
+ core::list< MapBlock * >::Iterator i;
+ for(i=sectorblocks.begin(); i!=sectorblocks.end(); i++)
+ {
+ MapBlock *block = *i;
+ bool changed = block->m_node_metadata.step(dtime);
+ if(changed)
+ changed_blocks[block->getPos()] = block;
+ }
+ }
+}
+
/*
ServerMap
*/