changeset 2708:5b354db08e90

refs #105: Fixes coverity issues related to unused variables.
author Augustin Preda
date Thu, 10 Apr 2014 23:27:22 +0300
parents b4777452361f
children aca4d09edea4
files src/core/document.cpp src/core/nlfgclientnetwork.cpp src/core/nlfgnetworkpacket.cpp src/core/nlfgnetworkpacket.h src/gui/application.cpp src/gui/charcreate.cpp src/gui/charinfo.cpp src/gui/chatline.cpp src/gui/contenteditor/contenteditor.cpp src/gui/contenteditor/fixedobjecteditor.cpp src/gui/contenteditor/gameinfotab.cpp src/gui/contenteditor/itemeditor.cpp src/gui/contenteditor/monstereditor.cpp src/gui/contenteditor/renderinfoeditor.cpp src/gui/creditswindow.cpp src/gui/dialoguewindow.cpp src/gui/inventory.cpp src/gui/itemwindow.cpp src/gui/mainmenu.cpp src/gui/mainwindow.cpp src/gui/messageboxes.cpp src/gui/minimapwindow.cpp src/gui/networkwindows.cpp src/gui/optionswindow.cpp src/gui/partyinfo.cpp src/gui/questinfo.cpp src/gui/savegamelist.cpp src/gui/skilltree.cpp src/gui/tradewindow.cpp src/gui/worldmap.cpp
diffstat 30 files changed, 300 insertions(+), 437 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/document.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/core/document.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -857,7 +857,6 @@
 	if (m_temp_player == 0)
 	{
 		// Show a notification.
-		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 		CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) CEGUIUtility::getWindow("WarningDialogWindow");
 		message->setInheritsAlpha(false);
 		message->setVisible(true);
@@ -878,7 +877,6 @@
 	if (m_temp_player == 0)
 	{
 		// Show a notification.
-		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 		CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) CEGUIUtility::getWindow("WarningDialogWindow");
 		message->setInheritsAlpha(false);
 		message->setVisible(true);
@@ -1991,7 +1989,6 @@
 void Document::showWarning (const std::string& textMessage)
 {
 	// Show a notification.
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	if (! CEGUIUtility::isWindowPresent ("WarningDialogWindow"))
 	{
 		SW_DEBUG ("Could not display the warning widget: [WarningDialogWindow]");
@@ -2013,8 +2010,6 @@
 void Document::hideWarning ()
 {
 	// Show a notification.
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
 	if (CEGUIUtility::isWindowPresent ("WarningDialogWindow"))
 	{
 		CEGUI::Window* widget = CEGUIUtility::getWindow("WarningDialogWindow");
@@ -2036,7 +2031,6 @@
 void Document::showQuestionDialog ()
 {
 	// Show a notification.
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::String widgetName = CEGUIUtility::getNameForWidget ("MainMenu/MainMenuRoot/QuestionInfoRoot");
 	if (! CEGUIUtility::isWindowPresent (widgetName))
 	{
@@ -2058,7 +2052,6 @@
 void Document::hideQuestionDialog ()
 {
 	// Show a notification.
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::String widgetName = CEGUIUtility::getNameForWidget ("MainMenu/MainMenuRoot/QuestionInfoRoot");
 	if (CEGUIUtility::isWindowPresent (widgetName))
 	{
--- a/src/core/nlfgclientnetwork.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/core/nlfgclientnetwork.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -124,7 +124,8 @@
 		return;
 	}
 	
-    unsigned int rel;
+  unsigned int rel;
+
 	if (reliability == NET_RELIABLE)
 	{
 		rel = RELIABLE;
--- a/src/core/nlfgnetworkpacket.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/core/nlfgnetworkpacket.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -17,35 +17,42 @@
 #include "nlfgnetworkpacket.h"
 
 NLFGNetworkPacket::NLFGNetworkPacket()
-:	m_data(NULL),
-	m_length(0)
+  : m_data(NULL),
+    m_packet(NULL),
+    m_length(0),
+    m_timestamp(0)
 {
-	m_timestamp = time(NULL);
-    m_packet = new NLFG_Message;
-    nlfg_init_packet(m_packet);
-    
-	nlfg_writeByte(m_packet, ID_TIMESTAMP);
-	nlfg_writeInteger(m_packet, m_timestamp);
-	nlfg_setId(m_packet, ID_USER_PACKET_ENUM);
+  m_timestamp = time(NULL);
+  m_packet = new NLFG_Message;
+  nlfg_init_packet(m_packet);
+
+  nlfg_writeByte(m_packet, ID_TIMESTAMP);
+  nlfg_writeInteger(m_packet, m_timestamp);
+  nlfg_setId(m_packet, ID_USER_PACKET_ENUM);
 }
 
 // NLFGNetworkPacket does not copy the data from RakNet packet
 // direct content from packet is used instead
 NLFGNetworkPacket::NLFGNetworkPacket(NLFG_Message* packet)
 {
-	m_data = packet->data;
-	m_length = packet->size;
+  m_data = packet->data;
+  m_length = packet->size;
 
-	if (nlfg_readByte(packet) == ID_TIMESTAMP)
-	{
-		m_timestamp = nlfg_readInteger(packet);
-	}
-	else
-	{
-		m_timestamp = time(NULL);
-	}
-	
-	m_version = nlfg_readInteger(packet);	// this is written by Network::createPacket
-	
-	m_packet = packet;
+  if (nlfg_readByte(packet) == ID_TIMESTAMP)
+  {
+    m_timestamp = nlfg_readInteger(packet);
+  }
+  else
+  {
+    m_timestamp = time(NULL);
+  }
+
+  m_version = nlfg_readInteger(packet);  // this is written by Network::createPacket
+
+  m_packet = packet;
 }
+
+NLFGNetworkPacket::~NLFGNetworkPacket()
+{
+  // TODO(Augustin Preda, 2014.04.10): should the m_packet member be deleted?
+}
--- a/src/core/nlfgnetworkpacket.h	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/core/nlfgnetworkpacket.h	Thu Apr 10 23:27:22 2014 +0300
@@ -18,248 +18,271 @@
 
 #define ID_TIMESTAMP                    23
 
+//
+// C system headers
+//
+#include <time.h>
+
+//
+// C++ system headers
+//
+
+// Allow using std::max
+#include <algorithm>
+#include <string>
+
+//
+// Other libraries' headers
+//
+
+// none
+
+//
+// This project's headers
+//
+
 #include "networkpacket.h"
 #include "nlfg.h"
-#include <time.h>
 #include "network.h"
 
 /**
  * Class for data sent or received with NLFG
  */
-class NLFGNetworkPacket : public NetworkPacket
+class NLFGNetworkPacket 
+  : public NetworkPacket
 {
-	public:
-		/**
-		 * \brief Constructor
-		 * Creates a new packet and writes the current time as timestamp
-		 */
-		NLFGNetworkPacket();
+  public:
+    /**
+     * \brief Constructor
+     * Creates a new packet and writes the current time as timestamp
+     */
+    NLFGNetworkPacket();
+
+    /**
+    * \brief Creates a new packet from a RakNet::Packet
+    * \param packet RakNet Packet
+    */
+    explicit NLFGNetworkPacket(NLFG_Message* packet);
+
+    /**
+     * \brief Destructor
+     */
+    virtual ~NLFGNetworkPacket();
 
-		/**
-		* \brief Creates a new packet from a RakNet::Packet
-		* \param packet RakNet Packet
-		*/
-		NLFGNetworkPacket(NLFG_Message* packet);
+    /**
+    * \brief writes raw data to the buffer
+    * \param data raw data
+    * \param size length of data in bytes
+    */
+    virtual void toBuffer(const char* data, unsigned int size)
+    {
+      nlfg_writeStringWithSize(m_packet, data, size);
+    }
+
+    /**
+    * \brief reads raw data from buffer
+    * \param data output buffer for raw data
+    * \param size length of data in bytes
+    */
+    virtual void fromBuffer(char* data, unsigned int size)
+    {
+      nlfg_readStringWithSize(m_packet, data, size);
+    }
 
-		/**
-		* \brief writes raw data to the buffer
-		* \param data raw data
-		* \param size length of data in bytes
-		*/
-		virtual void toBuffer(const char* data, unsigned int size)
-		{
-			nlfg_writeStringWithSize(m_packet, data, size);
-		}
+    /**
+    * \brief writes a string to the buffer
+    * \param s String
+    */
+    virtual void toBuffer(const std::string& s)
+    {
+      toBuffer(static_cast<int>(s.size()));
+      toBuffer(s.data(), s.size());
+    }
 
+    /**
+    * \brief reads a string from the buffer
+    * \param s String
+    */
+    virtual void fromBuffer(std::string& s)
+    {
+      int len;
+      fromBuffer(len);
 
-		/**
-		* \brief reads raw data from buffer
-		* \param data output buffer for raw data
-		* \param size length of data in bytes
-		*/
-		virtual void fromBuffer(char* data, unsigned int size)
-		{
-			nlfg_readStringWithSize(m_packet, data, size);
-		}
+      char * data = new char[len];
+      fromBuffer(data, len);
+      s.assign(data, len);
+      delete [] data;
+    }
 
-		/**
-		* \brief writes a string to the buffer
-		* \param s String
-		*/
-		virtual void toBuffer(const std::string& s)
-		{
-			toBuffer(static_cast<int>(s.size()));
-			toBuffer(s.data(),s.size());
-		}
+    /**
+    * \brief writes a double to the buffer
+    * \param d double
+    */
+    virtual void toBuffer(const double d)
+    {
+      nlfg_writeDouble(m_packet, d);
+    }
 
+    /**
+    * \brief reads a double from the buffer
+    * \param d double
+    */
+    virtual void fromBuffer(double& d)
+    {
+      d = nlfg_readDouble(m_packet);
+    }
 
-		/**
-		* \brief reads a string from the buffer
-		* \param s String
-		*/
-		virtual void fromBuffer(std::string& s)
-		{
-			int len;
-			fromBuffer(len);
+    /**
+    * \brief writes a float to the buffer
+    * \param f float
+    */
+    virtual void toBuffer(const float f)
+    {
+      nlfg_writeFloat(m_packet, f);
+    }
+
+    /**
+    * \brief reads a float from the buffer
+    * \param f float
+    */
+    virtual void fromBuffer(float& f)
+    {
+      f = nlfg_readFloat(m_packet);
+    }
 
-			char * data = new char[len];
-			fromBuffer(data,len);
-			s.assign(data,len);
-			delete [] data;
-		}
+    /**
+    * \brief writes an int to the buffer
+    * \param i int
+    */
+    virtual void toBuffer(const int i)
+    {
+      nlfg_writeInteger(m_packet, i);
+    }
 
-		/**
-		* \brief writes a double to the buffer
-		* \param d double
-		*/
-		virtual void toBuffer(const double d)
-		{
-			nlfg_writeDouble(m_packet, d);
-		}
+    /**
+    * \brief reads an int from the buffer
+    * \param i int
+    */
+    virtual void fromBuffer(int& i)
+    {
+      i = nlfg_readInteger(m_packet);
+    }
 
+    /**
+    * \brief writes a short to the buffer
+    * \param s short
+    */
+    virtual void toBuffer(const short s)
+    {
+      nlfg_writeShort(m_packet, s);
+    }
 
-		/**
-		* \brief reads a double from the buffer
-		* \param d double
-		*/
-		virtual void fromBuffer(double& d)
-		{
-			d = nlfg_readDouble(m_packet);
-		}
+    /**
+    * \brief reads a short from the buffer
+    * \param s short
+    */
+    virtual void fromBuffer(short& s)
+    {
+      s = nlfg_readShort(m_packet);
+    }
 
-		/**
-		* \brief writes a float to the buffer
-		* \param f float
-		*/
-		virtual void toBuffer(const float f)
-		{
-			nlfg_writeFloat(m_packet, f);
-		}
+    /**
+    * \brief writes a char to the buffer
+    * \param c char
+    */
+    virtual void toBuffer(const char c)
+    {
+      nlfg_writeByte(m_packet, c);
+    }
+
+    /**
+    * \brief reads a char from the buffer
+    * \param c char
+    */
+    virtual void fromBuffer(char& c)
+    {
+      c = nlfg_readByte(m_packet);
+    }
 
+    /**
+    * \brief writes a char to the buffer
+    * \param c char
+    */
+    virtual void toBuffer(const unsigned char c)
+    {
+        nlfg_writeByte(m_packet, c);
+    }
 
-		/**
-		* \brief reads a float from the buffer
-		* \param f float
-		*/
-		virtual void fromBuffer(float& f)
-		{
-			f = nlfg_readFloat(m_packet);
-		}
+    /**
+    * \brief reads a char from the buffer
+    * \param c char
+    */
+    virtual void fromBuffer(unsigned char& c)
+    {
+        c = nlfg_readByte(m_packet);
+    }
 
-		/**
-		* \brief writes an int to the buffer
-		* \param i int
-		*/
-		virtual void toBuffer(const int i)
-		{
-			nlfg_writeInteger(m_packet, i);
-		}
+    /**
+    * \brief returns the number of bits read from stream so far
+    */
+    virtual int readBits()
+    {
+      // the offset is for counteracting prepended internal data
+      return nlfg_getPosition(m_packet) - 13;
+    }
 
 
-		/**
-		* \brief reads an int from the buffer
-		* \param i int
-		*/
-		virtual void fromBuffer(int& i)
-		{
-			i = nlfg_readInteger(m_packet);
-		}
-
-		/**
-		* \brief writes a short to the buffer
-		* \param s short
-		*/
-		virtual void toBuffer(const short s)
-		{
-			nlfg_writeShort(m_packet, s);
-		}
-
-
-		/**
-		* \brief reads a short from the buffer
-		* \param s short
-		*/
-		virtual void fromBuffer(short& s)
-		{
-			s = nlfg_readShort(m_packet);
-		}
+    /**
+    * \brief returns the number of bits written to stream so far
+    */
+    virtual int writeBits()
+    {
+      // the offset is for counteracting prepended internal data
+      return nlfg_getPosition(m_packet) - 9;
+    }
 
-		/**
-		* \brief writes a char to the buffer
-		* \param c char
-		*/
-		virtual void toBuffer(const char c)
-		{
-			nlfg_writeByte(m_packet, c);
-		}
-
-
-		/**
-		* \brief reads a char from the buffer
-		* \param c char
-		*/
-		virtual void fromBuffer(char& c)
-		{
-			c = nlfg_readByte(m_packet);
-		}
-
-        /**
-        * \brief writes a char to the buffer
-        * \param c char
-        */
-        virtual void toBuffer(const unsigned char c)
-        {
-            nlfg_writeByte(m_packet, c);
-        }
-
+    /**
+    * \brief returns the delay of the packet in milliseconds
+    */
+    virtual float getDelay()
+    {
+      return std::max(
+          0.0f,
+          static_cast<float>(time(NULL)) - static_cast<float>(m_timestamp));
+    }
 
-        /**
-        * \brief reads a char from the buffer
-        * \param c char
-        */
-        virtual void fromBuffer(unsigned char& c)
-        {
-            c = nlfg_readByte(m_packet);
-        }
+    /**
+     * \brief Returns the NLFG packet that was used to create the object
+     */
+    NLFG_Message* getPacket() const
+    {
+      return m_packet;
+    }
 
-		/**
-		* \brief returns the number of bits read from stream so far
-		*/
-		virtual int readBits()
-		{
-			// the offset is for counteracting prepended internal data
-			return nlfg_getPosition(m_packet) - 13;
-		}
-
-
-		/**
-		* \brief returns the number of bits written to stream so far
-		*/
-		virtual int writeBits()
-		{
-			// the offset is for counteracting prepended internal data
-			return nlfg_getPosition(m_packet) - 9;
-		}
+    /**
+     * \brief Returns the underlying bitstream (for internal use only)
+     */
+    char* getData()
+    {
+      return m_packet->data;
+    }
 
-		/**
-		* \brief returns the delay of the packet in milliseconds
-		*/
-		virtual float getDelay()
-		{
-			return std::max(0.0f,static_cast<float>(time(NULL))-static_cast<float>(m_timestamp));
-		}
-
-		/**
-		 * \brief Returns the NLFG packet that was used to create the object
-		 */
-		NLFG_Message* getPacket() const
-		{
-			return m_packet;
-		}
+  private:
+    /**
+    * \brief stream for reading and writing the data
+    */
+    char *m_data;
+    int m_length;
 
-		/**
-		 * \brief Returns the underlying bitstream (for internal use only)
-		 */
-		char* getData()
-		{
-			return m_packet->data;
-		}
-	private:
-		/**
-		* \brief stream for reading and writing the data
-		*/
-		char *m_data;
-		int m_length;
+    /**
+     * \brief Time when the packet was created
+     */
+    unsigned int m_timestamp;
 
-		/**
-		 * \brief Time when the packet was created
-		 */
-		unsigned int m_timestamp;
-
-		/**
-		 * \brief Pointer to the RakNet Packet that was used to create this object
-		 */
-		NLFG_Message* m_packet;
+    /**
+     * \brief Pointer to the RakNet Packet that was used to create this object
+     */
+    NLFG_Message* m_packet;
 };
 
-#endif // __SUMWARS_CORE_NLFGNETWORKPACKET_H__
+#endif  // __SUMWARS_CORE_NLFGNETWORKPACKET_H__
--- a/src/gui/application.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/application.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -407,8 +407,6 @@
 			SW_DEBUG("update time was %f",t);
 		}
 
-		float musicUpdateTimer = frametime;
-
 		timer2.reset();
 		// run the message pump
 		Ogre::WindowEventUtilities::messagePump();
@@ -561,7 +559,7 @@
 			SW_DEBUG ("Currently selected video mode: %s",  opt_it->second.currentValue.c_str ());
 			returnValue = opt_it->second.currentValue;
 			std::string sLeft, sRight;
-			int nPos = returnValue.find (" ");
+			size_t nPos = returnValue.find (" ");
 			if (nPos == std::string::npos)
 			{
 				// some error...
--- a/src/gui/charcreate.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/charcreate.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -33,8 +33,6 @@
 	SW_DEBUG ("CharCreate window created with cegui skin [%s]", m_ceguiSkinName.c_str ());
 	// Create GUI Elements
 
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	// Rahmen fuer das Menue Savegame auswaehlen
 	CEGUI::FrameWindow* char_create = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("charcreate.layout");
 	m_window = char_create;
@@ -83,7 +81,6 @@
 void CharCreate::update()
 {
 	// aktuell gewaehlte Klasse ermitteln
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::String widgetName = CEGUIUtility::getNameForWidget("ClassList");
 	CEGUI::Listbox* classlist = static_cast<CEGUI::Listbox*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
 	CEGUI::ListboxItem * itm = classlist->getFirstSelectedItem();
@@ -110,7 +107,6 @@
 
 void CharCreate::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::PushButton* btn;
 	CEGUI::Window* widget;
 	CEGUI::String widgetName;
@@ -134,7 +130,6 @@
 
 void CharCreate::updateClassList()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::String widgetName = CEGUIUtility::getNameForWidget("ClassList");
 	CEGUI::Listbox* classlist = static_cast<CEGUI::Listbox*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
 	classlist->resetList();
@@ -157,7 +152,6 @@
 bool CharCreate::onClassSelected(const CEGUI::EventArgs& evt)
 {
 	SW_DEBUG ("CharCreate::onClassSelected");
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::String widgetName = CEGUIUtility::getNameForWidget("ClassList");
 	CEGUI::Listbox* classlist = static_cast<CEGUI::Listbox*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
 	CEGUI::ListboxItem * itm = classlist->getFirstSelectedItem();
@@ -185,7 +179,6 @@
 
 bool CharCreate::onLookSelected(const CEGUI::EventArgs& evt)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::String widgetName = CEGUIUtility::getNameForWidget("LookList");
 	CEGUI::Listbox* classlist = static_cast<CEGUI::Listbox*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
 	CEGUI::ListboxItem * itm = classlist->getFirstSelectedItem();
@@ -222,7 +215,6 @@
 
 bool CharCreate::onButtonAbort(const CEGUI::EventArgs& evt)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Editbox* namebox;
 
 	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
@@ -237,7 +229,6 @@
 
 bool CharCreate::onButtonCharCreate(const CEGUI::EventArgs& evt)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Editbox* namebox;
 	CEGUI::String widgetName;
 
--- a/src/gui/charinfo.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/charinfo.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -22,19 +22,17 @@
 CharInfo::CharInfo (Document* doc)
 	: Window(doc)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	// The CharInfo window and holder
 	CEGUI::FrameWindow* char_info = (CEGUI::FrameWindow*) (CEGUIUtility::loadLayoutFromFile ("characterscreen.layout"));
 	if (!char_info)
 	{
-		SW_DEBUG ("WARNING: Failed to load [%s]", "characterscreen.layout");
+		SW_DEBUG("WARNING: Failed to load [%s]", "characterscreen.layout");
 	}
 
 	CEGUI::Window* char_info_holder = CEGUIUtility::loadLayoutFromFile ("characterscreen_holder.layout");
 	if (!char_info_holder)
 	{
-		SW_DEBUG ("WARNING: Failed to load [%s]", "characterscreen_holder.layout");
+		SW_DEBUG("WARNING: Failed to load [%s]", "characterscreen_holder.layout");
 	}
 	
 	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (char_info_holder, "CharInfo_Holder");
@@ -45,8 +43,15 @@
 	}
 	else
 	{
-		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for char screen.");
-		if (!wndCharInfo) SW_DEBUG ("ERROR: Unable to get the window for char screen.");
+		if (!wndHolder)
+    {
+      SW_DEBUG ("ERROR: Unable to get the window holder for char screen.");
+    }
+
+		if (!wndCharInfo) 
+    {
+      SW_DEBUG ("ERROR: Unable to get the window for char screen.");
+    }
 	}
 
 	m_window = char_info_holder;
@@ -201,8 +206,6 @@
 	CEGUI::String ttext="";
 
 	// Fenstermanager
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
 	CEGUI::PushButton* btn;
 	CEGUI::Window* label;
 	std::ostringstream out_stream;
@@ -230,7 +233,7 @@
 		out_stream.str("");
 	}
 	
-	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
+	if (label->getText() != (CEGUI::utf8*) out_stream.str().c_str())
 	{
 		SW_DEBUG("set class label");
 		label->setText((CEGUI::utf8*) out_stream.str().c_str());
@@ -619,7 +622,6 @@
 
 void CharInfo::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 
 	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo");
--- a/src/gui/chatline.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/chatline.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -77,8 +77,6 @@
 
 void ChatLine::setHistoryLine()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	//CEGUI::Editbox* line = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindow ("Chatline"));
 	CEGUI::Editbox* line = static_cast<CEGUI::Editbox*>(m_window);
 	
 	if (m_history_line == 0)
--- a/src/gui/contenteditor/contenteditor.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/contenteditor/contenteditor.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -48,8 +48,6 @@
 
 void ContentEditor::init(bool visible)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	//CEGUI::System* guiSystem = System::getSingletonPtr();
 	CEGUI::WindowManager* winManager = WindowManager::getSingletonPtr();
   CEGUI::Window* gameScreen = CEGUIUtility::getWindow("GameScreen");
@@ -262,7 +260,6 @@
 
 void ContentEditor::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 
 	textdomain("tools");
--- a/src/gui/contenteditor/fixedobjecteditor.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/contenteditor/fixedobjecteditor.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -29,8 +29,6 @@
 	ContentEditorTab::init(parent);
   m_rootWindow = parent;
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
   CEGUI::PushButton* detectCircleButton = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
     "Root/ObjectInfoTabControl/__auto_TabPane__/FixedObjectTab/FixedObjectTabControl/__auto_TabPane__/Properties/DetectCircleButton"));
   CEGUI::PushButton* detectRectButton = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
@@ -128,8 +126,6 @@
 
 void FixedObjectEditor::updateAllFixedObjectList()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
   CEGUI::Combobox* copyfoSelector = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
     "Root/ObjectInfoTabControl/__auto_TabPane__/FixedObjectTab/FixedObjectTabControl/Properties/CopyDataBox"));
 	
@@ -148,8 +144,6 @@
 
 void FixedObjectEditor::updateFixedObjectXML()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	// update the XML representation
 	m_edited_fixed_object.writeToXML(m_fixed_object_xml.FirstChildElement());
 	
@@ -166,8 +160,6 @@
 {
 	m_no_cegui_events = true;
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
   CEGUI::Combobox* layerSelector = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
     "Root/ObjectInfoTabControl/__auto_TabPane__/FixedObjectTab/FixedObjectTabControl/__auto_TabPane__/Properties/LayerSelector"));
 	
@@ -230,8 +222,6 @@
 		return true;
   }
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	CEGUI::RadioButton* CircleButton = static_cast<CEGUI::RadioButton*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
     "Root/ObjectInfoTabControl/__auto_TabPane__/FixedObjectTab/FixedObjectTabControl/__auto_TabPane__/Properties/CircleCheckbox"));
 	//CEGUI::RadioButton* RectButton = static_cast<CEGUI::RadioButton*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
@@ -287,8 +277,6 @@
 	const CEGUI::MouseEventArgs& we =
 	static_cast<const CEGUI::MouseEventArgs&>(evt);
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	CEGUI::PushButton* detectCircleButton = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
     "Root/ObjectInfoTabControl/__auto_TabPane__/FixedObjectTab/FixedObjectTabControl/__auto_TabPane__/Properties/DetectCircleButton"));
 	//CEGUI::PushButton* detectRectButton = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
@@ -331,7 +319,6 @@
 
 bool FixedObjectEditor::onFixedObjectXMLModified(const CEGUI::EventArgs& evt)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::MultiLineEditbox* editor = static_cast<CEGUI::MultiLineEditbox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
     "Root/ObjectInfoTabControl/__auto_TabPane__/FixedObjectTab/FixedObjectTabControl/__auto_TabPane__/XML/FOXMLEditbox"));
 	
--- a/src/gui/contenteditor/gameinfotab.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/contenteditor/gameinfotab.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -29,7 +29,6 @@
 	ContentEditorTab::init(parent);
   m_rootWindow = parent;
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
   m_ShowBox = static_cast<CEGUI::MultiLineEditbox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
     "Root/ObjectInfoTabControl/__auto_TabPane__/GameInfoTab/TextBox"));
 }
--- a/src/gui/contenteditor/itemeditor.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/contenteditor/itemeditor.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -51,8 +51,6 @@
 	ContentEditorTab::init(parent);
   m_rootWindow = parent;
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
   CEGUI::PushButton* xmlsubmitButton = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayout(
       m_rootWindow,
       "Root/ObjectInfoTabControl/__auto_TabPane__/ItemTab/ItemTabControl/__auto_TabPane__/XML/SubmitButton"));
@@ -369,8 +367,6 @@
 
 void ItemEditor::updateAllItemList()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	CEGUI::Combobox* copyItemSelector = static_cast<CEGUI::Combobox*>(
       CEGUIUtility::getWindowForLoadedLayout(
           m_rootWindow,
@@ -633,7 +629,6 @@
 
 bool ItemEditor::onItemXMLModified(const CEGUI::EventArgs& evt)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::MultiLineEditbox* editor = static_cast<CEGUI::MultiLineEditbox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
     "Root/ObjectInfoTabControl/__auto_TabPane__/ItemTab/ItemTabControl/__auto_TabPane__/XML/ItemXMLEditbox"));
 	
@@ -681,7 +676,6 @@
 
 Item* ItemEditor::createItem()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	RenderInfoEditor* ri_editor = dynamic_cast<RenderInfoEditor*>(ContentEditor::getSingleton().getComponent("RIEditor"));
 	
 	// create an item picture
@@ -898,8 +892,6 @@
 
 void ItemEditor::updateItemXML()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	// update the XML representation
 	m_edited_item.writeToXML(m_item_xml.FirstChildElement());
 	
--- a/src/gui/contenteditor/monstereditor.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/contenteditor/monstereditor.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -33,9 +33,6 @@
 	ContentEditorTab::init(parent);
   m_rootWindow = parent;
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	
   CEGUI::Spinner* radiusSpinner =  static_cast<CEGUI::Spinner*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
       "Root/ObjectInfoTabControl/__auto_TabPane__/MonsterTab/MonsterTabControl/__auto_TabPane__/Properties/RadiusSpinner"));
 	
@@ -115,8 +112,6 @@
 
 void MonsterEditor::updateAllMonsterList()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	CEGUI::Combobox* copyfoSelector = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
       "Root/ObjectInfoTabControl/__auto_TabPane__/MonsterTab/MonsterTabControl/__auto_TabPane__/Properties/CopyDataBox"));
 	
@@ -131,8 +126,6 @@
 
 void MonsterEditor::updateMonsterXML()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	// update the XML representation
 	m_edited_monster.writeToXML(m_monster_xml.FirstChildElement());
 	
@@ -149,7 +142,6 @@
 {
 	m_no_cegui_events = true;
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	/*
 	CEGUI::Combobox* layerSelector = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
     "Root/ObjectInfoTabControl/__auto_TabPane__/MonsterTab/MonsterTabControl/__auto_TabPane__/Prop/LayerSelector"));
@@ -189,8 +181,6 @@
 		return true;
   }
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	CEGUI::Spinner* radiusSpinner =  static_cast<CEGUI::Spinner*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
       "Root/ObjectInfoTabControl/__auto_TabPane__/MonsterTab/MonsterTabControl/__auto_TabPane__/Prop/RadiusSpinner"));
 	
@@ -219,7 +209,6 @@
 
 bool MonsterEditor::onMonsterXMLModified(const CEGUI::EventArgs& evt)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::MultiLineEditbox* editor = static_cast<CEGUI::MultiLineEditbox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
       "Root/ObjectInfoTabControl/__auto_TabPane__/MonsterTab/MonsterTabControl/__auto_TabPane__/XML/MonsterXMLEditbox"));
 	
--- a/src/gui/contenteditor/renderinfoeditor.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/contenteditor/renderinfoeditor.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -34,8 +34,6 @@
 	m_edited_graphicobject = 0;
 	m_unique_id = 1;
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton(); 
-	
 	// add parts to the mesh selectors
   CEGUI::Combobox* selector = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
       "Root/ObjectInfoTabControl/__auto_TabPane__/RenderInfoTab/RenderInfoTabControl/__auto_TabPane__/BasicMesh/MeshSelector"));
@@ -269,8 +267,6 @@
 
 void RenderInfoEditor::updateSubmeshEditor(std::string objectname, bool updateList)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	CEGUI::Spinner* rotXspinner =  static_cast<CEGUI::Spinner*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
       "Root/ObjectInfoTabControl/__auto_TabPane__/RenderInfoTab/RenderInfoTabControl/__auto_TabPane__/SubMesh/SMRotateX"));
 	CEGUI::Spinner* rotYspinner =  static_cast<CEGUI::Spinner*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
@@ -470,7 +466,6 @@
 
 void RenderInfoEditor::updateBoneList()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Combobox* boneSelector = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
       "Root/ObjectInfoTabControl/__auto_TabPane__/RenderInfoTab/RenderInfoTabControl/__auto_TabPane__/SubMesh/BoneSelector"));
 	CEGUI::Combobox* boneobjSelector = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
@@ -540,8 +535,6 @@
 
 void RenderInfoEditor::updateRenderInfoXML()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	// update the XML representation
 	m_edited_renderinfo.writeToXML(m_renderinfo_xml.FirstChildElement());
 	
@@ -708,8 +701,6 @@
 		return true;
   }
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	// the the GUI parts
 	CEGUI::Spinner* rotXspinner =  static_cast<CEGUI::Spinner*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
       "Root/ObjectInfoTabControl/__auto_TabPane__/RenderInfoTab/RenderInfoTabControl/__auto_TabPane__/SubMesh/SMRotateX"));
@@ -797,20 +788,25 @@
 bool RenderInfoEditor::onSubMeshDeleted(const CEGUI::EventArgs& evt)
 {
 	if (m_no_cegui_events)
+  {
 		return true;
+  }
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Combobox* objSelector = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
       "Root/ObjectInfoTabControl/__auto_TabPane__/RenderInfoTab/RenderInfoTabControl/__auto_TabPane__/SubMesh/EditSMSelector"));
 	
 	// get the MovableObjectInfo
 	CEGUI::ListboxItem* item = objSelector->getSelectedItem();
 	if (item == 0)
+  {
 		return true;
+  }
 	
 	MovableObjectInfo* minfo = m_edited_renderinfo.getObject(item->getText().c_str());
 	if (minfo == 0)
+  {
 		return true;
+  }
 	
 	// Remove it from the renderinfo
 	m_edited_renderinfo.removeObject(minfo->m_objectname);
@@ -821,7 +817,6 @@
 
 bool RenderInfoEditor::onRenderinfoXMLModified(const CEGUI::EventArgs& evt)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::MultiLineEditbox* editor = static_cast<CEGUI::MultiLineEditbox*>(CEGUIUtility::getWindowForLoadedLayout(m_rootWindow,
       "Root/ObjectInfoTabControl/__auto_TabPane__/RenderInfoTab/RenderInfoTabControl/__auto_TabPane__/XML/RIXMLEditbox"));
 	
--- a/src/gui/creditswindow.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/creditswindow.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -95,8 +95,6 @@
 
 void CreditsWindow::update()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	if (!m_window->isVisible())
 	{
 		m_shown_timer.start();
--- a/src/gui/dialoguewindow.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/dialoguewindow.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -23,7 +23,6 @@
 {
 	m_scene = scene;
 	CEGUI::Window* label;
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 
 	// The CharInfo window and holder
 	CEGUI::FrameWindow* dialog_wnd = static_cast<CEGUI::FrameWindow*> (CEGUIUtility::loadLayoutFromFile ("dialogwindow.layout"));
@@ -77,8 +76,6 @@
 
 void DialogueWindow::update()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	Player* player = m_document->getLocalPlayer();
 	Region* reg = player->getRegion();
 	Dialogue* dia =  reg->getDialogue( player->getDialogueId() );
@@ -758,8 +755,8 @@
 bool DialogueWindow::onTextClicked(const CEGUI::EventArgs& evt)
 {
 	SW_DEBUG ("DialogueWindow::onTextClicked");
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	const CEGUI::MouseEventArgs& we =
+
+  const CEGUI::MouseEventArgs& we =
 			static_cast<const CEGUI::MouseEventArgs&>(evt);
 	CEGUI::Window* btn = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow/DialogueLowerBar/DialogueSkipAllButton");
 	bool skipAll = false;
--- a/src/gui/inventory.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/inventory.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -27,8 +27,6 @@
 {
 	DEBUGX("setup inventory");
 
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
 	CEGUI::Window* inventory = CEGUIUtility::loadLayoutFromFile ("inventory.layout");
 	if (!inventory)
 	{
@@ -236,7 +234,6 @@
 
 void Inventory::update()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* img;
 	CEGUI::Window* label;
 	Item* it,*weapon;
@@ -393,7 +390,6 @@
 
 void Inventory::setState(State s)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 
 	if(s == Inventory::StateSmall)
@@ -457,7 +453,6 @@
 
 void Inventory::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 	
 	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GoldStaticImage/GoldDropButton");
@@ -490,8 +485,6 @@
 
 bool Inventory::onDropGoldClicked(const CEGUI::EventArgs& evt)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
 	CEGUI::Editbox* gold = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GoldDropValueBox"));
 	int val =0;
 	std::stringstream stream;
@@ -542,7 +535,6 @@
 {
 #if ((CEGUI_VERSION_MAJOR << 16) + (CEGUI_VERSION_MINOR << 8) + CEGUI_VERSION_PATCH >= (0 << 16)+(7 << 8)+5)
 
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 
 	CEGUI::AnimationManager::getSingleton().loadAnimationsFromXML("InventoryAnimations.xml");
--- a/src/gui/itemwindow.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/itemwindow.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -93,7 +93,7 @@
 	
 	if (we.button == CEGUI::LeftButton)
 	{
-		DEBUGX("left button released on Item %i",id);
+		DEBUGX("left button released on Item %i", id);
 	}
 	return true;
 }
@@ -230,9 +230,8 @@
 		windowname.erase(pos,5);
 	}
 	windowname.append("ProgressBar");
-	// Fenstermanager
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
+
+  // Fenstermanager
 	if (CEGUIUtility::isWindowPresent (windowname))
 	{
 		// update progress bar to reflect item timer
--- a/src/gui/mainmenu.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/mainmenu.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -55,7 +55,6 @@
 	m_savegame_player_action.m_elapsed_time = 0;
 	
 	
-    CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::PushButton* btn;
 #if 0
 	// Load the holder (this should be aspect ratio dependent).
@@ -72,25 +71,10 @@
 	{
 		WARNING ("WARNING: Failed to load [%s]", "mainmenu.layout");
 	}
-	CEGUI::Window* wndHeld = CEGUIUtility::getWindowForLoadedLayoutEx (m_starMenuRoot, "MainMenuRoot");
 
 	SW_DEBUG ("Placing layout into holder");
 	m_starMenuRoot->setVisible (true);
 
-#if 0
-	main_menu_holder->setVisible (true);
-
-	if (wndHolder && wndHeld)
-	{
-		CEGUIUtility::addChildWidget (wndHolder, wndHeld);
-	}
-	else
-	{
-		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for main menu.");
-		if (!wndHeld) DEBUG ("ERROR: Unable to get the window for main menu.");
-	}
-#endif
-
 	//m_window = main_menu_holder;
     m_window = m_starMenuRoot;// Augustin Preda, 2014.01.08: switched main window to the holder.
 
@@ -216,8 +200,6 @@
 
 void MainMenu::updateTranslation()
 {
-    CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
 	CEGUI::Window* widget;
 
 	// Update the button labels.
@@ -435,7 +417,6 @@
 
 void MainMenu::setSavegameListVisible(bool show)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::FrameWindow* savegameList = (CEGUI::FrameWindow*) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "SaveGameSelectionFrame");
 	if (savegameList->isVisible() != show)
 	{
@@ -973,8 +954,6 @@
 
 void MainMenu::createSavegameList()
 {
-    CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
     // Select the frame for the saved games in the menu
 	std::string widgetName (CEGUIUtility::getNameForWidget("SaveGameSelectionFrame"));
 	CEGUI::FrameWindow* savegameList = static_cast<CEGUI::FrameWindow*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_starMenuRoot, widgetName));
--- a/src/gui/mainwindow.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/mainwindow.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -336,8 +336,6 @@
 		m_document->setModified(m_document->getModified() & (~Document::SAVEGAME_MODIFIED));
 	}
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
 	// Sprache anpassen
 	if (Gettext::getLocaleChanged())
 	{
@@ -1090,9 +1088,6 @@
 {
 	DEBUGX("setup object info");
 
-	// Fenstermanager
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
 	// Leiste fuer Informationen
 	CEGUI::Window* monster_health_holder = CEGUIUtility::loadLayoutFromFile ("monsterhealthbar.layout");
 	if (monster_health_holder)
@@ -1292,7 +1287,6 @@
 
 void  MainWindow::updateMainMenu()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* img = 0;
 	if (CEGUIUtility::isWindowPresent ("MainMenu/StartScreenRoot"))
 	{
@@ -1338,9 +1332,6 @@
 	Item* item = 0;
 	item = player->getEquipement()->getItem(Equipement::CURSOR_ITEM);
 	
-	
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label = CEGUIUtility::getWindowForLoadedLayoutEx (m_root_window, "CursorItemImage");
 	
 	if (item == 0)
@@ -1411,7 +1402,6 @@
 	std::string objname = "";
 
 	// Fenstermanager
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label = CEGUIUtility::getWindow ("GameScreen/ObjectInfoRoot/ObjectInfoLabel");
 	CEGUI::Window* itmlabel = CEGUIUtility::getWindow ("GameScreen/ItemInfoLabel");
 	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindow ("GameScreen/ObjectInfoRoot/MonsterHealthProgressBar"));
@@ -2170,8 +2160,6 @@
 		m_sub_windows["PartyInfo"]->update();
 	}
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	CEGUI::Window* img;
 	CEGUI::ProgressBar* bar;
 	
@@ -2298,8 +2286,6 @@
 			//SoundManager::getPtr ()->getMusicPlayer ()->stop ();
 		}
 		
-		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
 		if (refresh)
 		{
 			SW_DEBUG ("*** main window expecting refresh for region [%s]", pl->getRegion ()->getName ().c_str ());
@@ -2467,7 +2453,6 @@
 	static Timer timer;
 	int windows = m_document->getGUIState()->m_shown_windows;
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	Player* pl = m_document->getLocalPlayer();
 	
 	CEGUI::Window* label;
@@ -2643,7 +2628,6 @@
 	
 	try
 	{
-		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 		CEGUI::Window* label = CEGUIUtility::getWindowForLoadedLayoutEx (m_root_window, "CursorItemImage");
 	
 		int off = 0;
@@ -2765,8 +2749,6 @@
 */
 bool MainWindow::mouseReleased (const OIS::MouseEvent &evt, OIS::MouseButtonID btn)
 {
-	CEGUI::MouseButton button = CEGUI::NoButton;
-
 	// TODO: There are 2 separate if-else blocks; check if it makes sense to unite them,
 	// or the sequence of events is really necessary.
 	if (btn == OIS::MB_Left)
@@ -2946,8 +2928,6 @@
 {
 	m_ready_to_start = ready;
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindow ("MainMenu/StartScreenRoot/LoadRessourcesProgressBar"));
 	bar->setVisible(!ready);
 
@@ -2973,13 +2953,7 @@
 
 void MainWindow::setRessourceLoadingBar(float percent)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindow ("MainMenu/StartScreenRoot/LoadRessourcesProgressBar"));
 	bar->setProgress(percent);
 }
 
-
-
-
-
--- a/src/gui/messageboxes.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/messageboxes.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -25,7 +25,6 @@
 SaveExitWindow::SaveExitWindow (Document* doc)
 	:Window(doc)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::PushButton* btn;
 	
 	CEGUI::FrameWindow* save_exit = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("saveexitwindow.layout");
@@ -56,7 +55,6 @@
 
 void SaveExitWindow::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 	
 	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "GameExitConfirmButton"));
@@ -117,7 +115,6 @@
 {
 	m_question = question;
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::PushButton* btn;
 	
 	CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile (layoutName.c_str ());
@@ -148,7 +145,6 @@
 
 void MessageQuestionWindow::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* widget;
 
 	CEGUI::String widgetName (CEGUIUtility::getNameForWidget("QuestionAnswerButton1"));
@@ -186,7 +182,6 @@
 WarningDialogWindow::WarningDialogWindow (Document* doc)
 :Window(doc)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::PushButton* btn;
 	
 	CEGUI::FrameWindow* warning_dialog = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile("warningdialogwindow.layout");
@@ -205,7 +200,6 @@
 
 void WarningDialogWindow::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 	
 	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "WarningDialogConfirmButton"));
@@ -238,7 +232,6 @@
 ErrorDialogWindow::ErrorDialogWindow (Document* doc)
 :Window(doc)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::PushButton* btn;
 
 	CEGUI::FrameWindow* error_dialog = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("errordialogwindow.layout");
@@ -257,7 +250,6 @@
 
 void ErrorDialogWindow::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 	
 	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ErrorDialogConfirmButton"));
--- a/src/gui/minimapwindow.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/minimapwindow.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -43,8 +43,6 @@
 	DEBUGX("setup main menu");
 
 	// Create GUI Items.
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	CEGUI::Window* minimapWnd = CEGUIUtility::loadLayoutFromFile ("minimapwindow.layout");
 	if (!minimapWnd)
 	{
--- a/src/gui/networkwindows.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/networkwindows.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -22,7 +22,6 @@
 	:Window(doc)
 {
 	SW_DEBUG ("HostGameWindow being created");
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::PushButton* btn;
 	CEGUI::Editbox* box;
 
@@ -82,7 +81,6 @@
 
 void HostGameWindow::update()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Editbox* box;
 	
 	Options* options = Options::getInstance();
@@ -113,7 +111,6 @@
 
 void HostGameWindow::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 	
 	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/HostGameStartButton"));
@@ -135,7 +132,6 @@
 
 bool HostGameWindow::onStartHostGame(const CEGUI::EventArgs& evt)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Editbox* box;
 	
 	Options* options = Options::getInstance();
@@ -175,7 +171,6 @@
 	:Window(doc)
 {
 	SW_DEBUG ("JoinGameWindow being created");
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::PushButton* btn;
 	CEGUI::Editbox* box;
 
@@ -200,8 +195,14 @@
 	}
 	else
 	{
-		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for char screen.");
-		if (!wndCharInfo) SW_DEBUG ("ERROR: Unable to get the window for char screen.");
+		if (!wndHolder)
+    {
+      SW_DEBUG ("ERROR: Unable to get the window holder for char screen.");
+    }
+		if (!wndCharInfo)
+    {
+      SW_DEBUG ("ERROR: Unable to get the window for char screen.");
+    }
 	}
 
 	m_window = join_game_holder;
@@ -235,7 +236,6 @@
 
 void JoinGameWindow::update()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Editbox* box;
 	
 	Options* options = Options::getInstance();
@@ -263,7 +263,6 @@
 
 void JoinGameWindow::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 	
 	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/JoinGameStartButton"));
@@ -285,7 +284,6 @@
 
 bool JoinGameWindow::onStartJoinGame(const CEGUI::EventArgs& evt)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Editbox* box;
 	
 	Options* options = Options::getInstance();
--- a/src/gui/optionswindow.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/optionswindow.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -46,10 +46,8 @@
 	m_keyboard = keyboard;
 
 	SW_DEBUG ("OptionsWindow being created using cegui skin [%s]", m_ceguiSkinName.c_str ());
-	// Generate GUI Elements
 
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
+  // Generate GUI Elements
 	// Load the base options window - containing the actual elements.
 	CEGUI::FrameWindow* options = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("optionswindow.layout");
 	if (!options)
@@ -440,7 +438,6 @@
 
 void OptionsWindow::update()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 	Options* options = Options::getInstance();
 
@@ -499,7 +496,6 @@
 
 void OptionsWindow::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 	CEGUIUtility::ToggleButton* box;
 	
@@ -603,7 +599,6 @@
 {
 	try
 	{
-		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 		if (widgetType == "combobox")
 		{
 			try
@@ -727,8 +722,6 @@
 	// Check to see if the display mode was updated. The display mode is stored in a different file at the moment.
 	// TODO: move towards integrated settings file (single file for most settings).
 	{
-		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
 		// Flag to keep track of whether we need updating of the settings.
 		bool someVideoSettingsWereChanged (false);
 
@@ -1202,8 +1195,6 @@
 
 	// For windowed (fullscreen) mode, make sure the resolution can't be edited.
 
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton ();
-
 	std::string widgetName = CEGUIUtility::getNameForWidget ("OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/ResolutionBox");
 	cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
 	if (myDisplayMode == WINDOWED_FULLSCREEN)
@@ -1296,7 +1287,6 @@
 	}
 
 	// Start adding the resolutions as items to the combo-box, one by one.
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton ();
 	cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/ResolutionBox"));
 	cbo->resetList ();
 
--- a/src/gui/partyinfo.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/partyinfo.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -232,7 +232,6 @@
 	
 	Fraction::Relation rel,rel2;
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	std::ostringstream stream;
 	CEGUI::Window* label, *img, *btn;
 	bool vis;
@@ -466,7 +465,6 @@
 
 void PartyInfo::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 	
 	std::ostringstream stream;
--- a/src/gui/questinfo.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/questinfo.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -27,9 +27,6 @@
 	DEBUGX("setup main menu");
 	// GUI Elemente erzeugen
 
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-
 	// Rahmen fuer das Menue Savegame auswaehlen
 	CEGUI::FrameWindow* quest_info = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("questinfo.layout");
 	if (!quest_info)
@@ -99,8 +96,6 @@
 	if (World::getWorld() ==0)
 		return;
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	// Auswahl ermitteln
 	bool open,done,failed;
 	CEGUIUtility::ToggleButton * box;
@@ -158,7 +153,6 @@
 
 void QuestInfo::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 
 	label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo");
@@ -200,7 +194,6 @@
 
 void QuestInfo::updateDescription()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Listbox* classlist = (CEGUI::Listbox*) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestList");
 	CEGUI::ListboxItem * itm = classlist->getFirstSelectedItem();
 	
--- a/src/gui/savegamelist.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/savegamelist.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -97,8 +97,6 @@
 
 void SavegameList::update()
 {	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
 	// Liste aller Files im Save Ordner der Form *.sav
 	Ogre::FileInfoListPtr files;
 	Ogre::FileInfoList::iterator it;
@@ -418,7 +416,6 @@
 
 void SavegameList::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::PushButton* btn;
 	/*
 	CEGUI::Window* label;
@@ -511,7 +508,6 @@
 
 bool SavegameList::onDeleteCharClicked(const CEGUI::EventArgs& evt)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	const CEGUI::WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(evt);
 	onSavegameChosen(CEGUI::WindowEventArgs(we.window->getParent()));
 	
@@ -528,7 +524,6 @@
 	// Also play the click sound.
 	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
 
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	m_document->hideQuestionDialog ();
 
 	// Get the save file to remove.
@@ -573,7 +568,6 @@
 	// Also play the click sound.
 	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
 
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	m_document->hideQuestionDialog ();
 
 	return true;
--- a/src/gui/skilltree.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/skilltree.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -35,9 +35,6 @@
 	m_skill_widgets_pics.clear ();
 	m_skill_widgets_btns.clear ();
 	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
-
 	// Rahmen fuer Skilltree Fenster
 
 	// Bestandteile des Charakterfensters hinzufuegen
@@ -720,8 +717,6 @@
 
 void SkillTree::updateTranslation()
 {
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	std::vector<CEGUI::DefaultWindow*> tabs(m_nr_tabs);
 	
 	std::stringstream stream;
@@ -771,7 +766,6 @@
 	
 	DEBUGX("update tooltip for %i %s", pos, ablts[pos].m_type.c_str());
 
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 	//std::ostringstream out_stream;
 	//out_stream.str("");
--- a/src/gui/tradewindow.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/tradewindow.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -212,8 +212,6 @@
 	int nmedium = equ->getMaxItemNumber(Item::MEDIUM);
 	int nsmall = equ->getMaxItemNumber(Item::SMALL);
 	
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::PushButton* btn;
 	bool vis;
 	
@@ -282,7 +280,6 @@
 
 void TradeWindow::updateTranslation()
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::PushButton* btn;
 	CEGUI::Window* label;
 	
--- a/src/gui/worldmap.cpp	Thu Apr 10 21:32:12 2014 +0300
+++ b/src/gui/worldmap.cpp	Thu Apr 10 23:27:22 2014 +0300
@@ -23,8 +23,6 @@
 	: Window (doc)
 	, m_ceguiSkinName (ceguiSkinName)
 {
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
 	// The World map window and holder
 	CEGUI::Window* worldmap = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("worldmapwindow.layout");
 	if (!worldmap)