From 452df1c723722183ebf3a332f7bcc355be5b2998 Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 18 Sep 2015 13:45:42 +0200 Subject: Various style cleanups + unused code removal -> Don't pass pointer to whole IGameDef to NodeMetadata constructors and deserializers, but only to IItemDefManager, which is needed -> Remove the unused content_mapnode_get_new_name() method -> Fix style for MapBlock::deSerialize and MapBlock::deSerialize_pre22, improving accuracy of error messages a bit -> Fix style at other serialisation methods too -> Improve accuracy of some comments --- src/nodemetadata.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src/nodemetadata.cpp') diff --git a/src/nodemetadata.cpp b/src/nodemetadata.cpp index 2a9131be0..d63dac696 100644 --- a/src/nodemetadata.cpp +++ b/src/nodemetadata.cpp @@ -30,9 +30,9 @@ with this program; if not, write to the Free Software Foundation, Inc., NodeMetadata */ -NodeMetadata::NodeMetadata(IGameDef *gamedef): +NodeMetadata::NodeMetadata(IItemDefManager *item_def_mgr): m_stringvars(), - m_inventory(new Inventory(gamedef->idef())) + m_inventory(new Inventory(item_def_mgr)) { } @@ -101,34 +101,34 @@ void NodeMetadataList::serialize(std::ostream &os) const v3s16 p = i->first; NodeMetadata *data = i->second; - u16 p16 = p.Z*MAP_BLOCKSIZE*MAP_BLOCKSIZE + p.Y*MAP_BLOCKSIZE + p.X; + u16 p16 = p.Z * MAP_BLOCKSIZE * MAP_BLOCKSIZE + p.Y * MAP_BLOCKSIZE + p.X; writeU16(os, p16); data->serialize(os); } } -void NodeMetadataList::deSerialize(std::istream &is, IGameDef *gamedef) +void NodeMetadataList::deSerialize(std::istream &is, IItemDefManager *item_def_mgr) { clear(); u8 version = readU8(is); - if(version == 0){ + if (version == 0) { // Nothing return; } - if(version != 1){ - infostream<<__FUNCTION_NAME<<": version "<deSerialize(is); m_data[p] = data; } -- cgit v1.2.3