From 0bf533f7534e84a23b5b9c8a5ca45e67c1cc3f00 Mon Sep 17 00:00:00 2001
From: Perttu Ahola <celeron55@gmail.com>
Date: Sun, 16 Oct 2011 16:28:12 +0300
Subject: Switch more stuff to use the logging thing and fix segfault on player
 leave from server as introduced in a previous switch-to-logging commit

---
 src/content_nodemeta.cpp | 13 +++++++------
 src/nodemetadata.cpp     |  9 +++++----
 src/server.cpp           |  1 +
 3 files changed, 13 insertions(+), 10 deletions(-)

(limited to 'src')

diff --git a/src/content_nodemeta.cpp b/src/content_nodemeta.cpp
index e79ff6d54..e6138a401 100644
--- a/src/content_nodemeta.cpp
+++ b/src/content_nodemeta.cpp
@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "content_nodemeta.h"
 #include "inventory.h"
 #include "content_mapnode.h"
+#include "log.h"
 
 /*
 	SignNodeMetadata
@@ -287,12 +288,12 @@ bool FurnaceNodeMetadata::nodeRemovalDisabled()
 }
 void FurnaceNodeMetadata::inventoryModified()
 {
-	dstream<<"Furnace inventory modification callback"<<std::endl;
+	infostream<<"Furnace inventory modification callback"<<std::endl;
 }
 bool FurnaceNodeMetadata::step(float dtime)
 {
 	if(dtime > 60.0)
-		dstream<<"Furnace stepping a long time ("<<dtime<<")"<<std::endl;
+		infostream<<"Furnace stepping a long time ("<<dtime<<")"<<std::endl;
 	// Update at a fixed frequency
 	const float interval = 2.0;
 	m_step_accumulator += dtime;
@@ -302,7 +303,7 @@ bool FurnaceNodeMetadata::step(float dtime)
 		m_step_accumulator -= interval;
 		dtime = interval;
 
-		//dstream<<"Furnace step dtime="<<dtime<<std::endl;
+		//infostream<<"Furnace step dtime="<<dtime<<std::endl;
 		
 		InventoryList *dst_list = m_inventory->getList("dst");
 		assert(dst_list);
@@ -334,7 +335,7 @@ bool FurnaceNodeMetadata::step(float dtime)
 		*/
 		if(m_fuel_time < m_fuel_totaltime)
 		{
-			//dstream<<"Furnace is active"<<std::endl;
+			//infostream<<"Furnace is active"<<std::endl;
 			m_fuel_time += dtime;
 			m_src_time += dtime;
 			if(m_src_time >= m_src_totaltime && m_src_totaltime > 0.001
@@ -369,7 +370,7 @@ bool FurnaceNodeMetadata::step(float dtime)
 			break;
 		}
 		
-		//dstream<<"Furnace is out of fuel"<<std::endl;
+		//infostream<<"Furnace is out of fuel"<<std::endl;
 
 		InventoryList *fuel_list = m_inventory->getList("fuel");
 		assert(fuel_list);
@@ -454,7 +455,7 @@ bool FurnaceNodeMetadata::step(float dtime)
 		}
 		else
 		{
-			//dstream<<"No fuel found"<<std::endl;
+			//infostream<<"No fuel found"<<std::endl;
 			// No fuel, stop loop.
 			m_step_accumulator = 0;
 			break;
diff --git a/src/nodemetadata.cpp b/src/nodemetadata.cpp
index 3edf6d3c2..6fbfc2dba 100644
--- a/src/nodemetadata.cpp
+++ b/src/nodemetadata.cpp
@@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "inventory.h"
 #include <sstream>
 #include "content_mapnode.h"
+#include "log.h"
 
 /*
 	NodeMetadata
@@ -55,7 +56,7 @@ NodeMetadata* NodeMetadata::deSerialize(std::istream &is)
 	if(n == NULL)
 	{
 		// If factory is not found, just return.
-		dstream<<"WARNING: NodeMetadata: No factory for typeId="
+		infostream<<"WARNING: NodeMetadata: No factory for typeId="
 				<<id<<std::endl;
 		return NULL;
 	}
@@ -71,7 +72,7 @@ NodeMetadata* NodeMetadata::deSerialize(std::istream &is)
 	}
 	catch(SerializationError &e)
 	{
-		dstream<<"WARNING: NodeMetadata: ignoring SerializationError"<<std::endl;
+		infostream<<"WARNING: NodeMetadata: ignoring SerializationError"<<std::endl;
 		return NULL;
 	}
 }
@@ -138,7 +139,7 @@ void NodeMetadataList::deSerialize(std::istream &is)
 
 	if(version > 1)
 	{
-		dstream<<__FUNCTION_NAME<<": version "<<version<<" not supported"
+		infostream<<__FUNCTION_NAME<<": version "<<version<<" not supported"
 				<<std::endl;
 		throw SerializationError("NodeMetadataList::deSerialize");
 	}
@@ -165,7 +166,7 @@ void NodeMetadataList::deSerialize(std::istream &is)
 		
 		if(m_data.find(p))
 		{
-			dstream<<"WARNING: NodeMetadataList::deSerialize(): "
+			infostream<<"WARNING: NodeMetadataList::deSerialize(): "
 					<<"already set data at position"
 					<<"("<<p.X<<","<<p.Y<<","<<p.Z<<"): Ignoring."
 					<<std::endl;
diff --git a/src/server.cpp b/src/server.cpp
index 2a0914e0a..a4b6fe649 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -4377,6 +4377,7 @@ void Server::handlePeerChange(PeerChange &c)
 			/*
 				Print out action
 			*/
+			if(player != NULL)
 			{
 				std::ostringstream os(std::ios_base::binary);
 				for(core::map<u16, RemoteClient*>::Iterator
-- 
cgit v1.2.3