Index: src/test/module.cpp
===================================================================
--- src/test/module.cpp	(revision 694)
+++ src/test/module.cpp	(working copy)
@@ -26,7 +26,9 @@
 #include <sys/stat.h>
 #include <iostream>
 
-#include <direct.h>
+#if (XENOCIDE_PLATFORM == XENOCIDE_PLATFORM_WIN32)
+#    include <direct.h>
+#endif
 
 #include <OgreResourceGroupManager.h>
 #include <OgreException.h>
Index: src/core/staticdata/shortcuts.cpp
===================================================================
--- src/core/staticdata/shortcuts.cpp	(revision 694)
+++ src/core/staticdata/shortcuts.cpp	(working copy)
@@ -3,7 +3,7 @@
 This source file is part of Xenocide
 For the latest info on Xenocide, see http://www.projectxenocide.com
 
-Copyright  2003-2005 The Project Xenocide Team
+Copyright © 2003-2005 The Project Xenocide Team
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU Lesser General Public License as published by the Free Software
@@ -40,8 +40,8 @@
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("xenocore.Shortcuts"));
 
 //  Singleton
-template<> KeyCodes* TSingleton<KeyCodes>::ms_Singleton = 0;
-template<> ShortCuts* TSingleton<ShortCuts>::ms_Singleton = 0;
+//template<> KeyCodes* TSingleton<KeyCodes>::ms_Singleton = 0;
+//template<> ShortCuts* TSingleton<ShortCuts>::ms_Singleton = 0;
 
 namespace Xenocide 
 {
@@ -540,14 +540,14 @@
 
     XmlFilePtr x = XmlManager::instance().create("temp file");
 
-    const String featuresStr("");
-    const String rootStr("ShortCutsData"); 
+    const XMLChPtr featuresStr("");
+    const XMLChPtr rootStr("ShortCutsData"); 
 
     // HACK: Those are some standart strings wich looks better extracted from somewhere 
     const XMLChPtr xmlnsxsiStr("xmlns:xsi"); 
     const XMLChPtr shemaLocationStr("xsi:schemaLocation");
 
-    const String nameSpaceStr("ShortCuts");
+    const XMLChPtr nameSpaceStr("ShortCuts");
 
     const XMLChPtr groupStr("Group");
     const XMLChPtr groupNameStr("Name");
Index: src/core/staticdata/humanfacilitytype.cpp
===================================================================
--- src/core/staticdata/humanfacilitytype.cpp	(revision 694)
+++ src/core/staticdata/humanfacilitytype.cpp	(working copy)
@@ -37,7 +37,7 @@
 
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("xenocore.HumanFacility"));
 
-template<> HumanFacilityTypeFactory* TSingleton<HumanFacilityTypeFactory>::ms_Singleton = 0;
+//template<> HumanFacilityTypeFactory* TSingleton<HumanFacilityTypeFactory>::ms_Singleton = 0;
 
 //=============================================================================
 //  Namespace
Index: src/core/staticdata/crafttype.cpp
===================================================================
--- src/core/staticdata/crafttype.cpp	(revision 694)
+++ src/core/staticdata/crafttype.cpp	(working copy)
@@ -3,7 +3,7 @@
 This source file is part of Xenocide
 For the latest info on Xenocide, see http://www.projectxenocide.com
 
-Copyright  2003-2004 The Project Xenocide Team
+Copyright © 2003-2004 The Project Xenocide Team
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU Lesser General Public License as published by the Free Software
@@ -41,7 +41,7 @@
 
 
 
-template<> CraftTypeFactory* TSingleton <CraftTypeFactory>::ms_Singleton = 0;
+//template<> CraftTypeFactory* TSingleton <CraftTypeFactory>::ms_Singleton = 0;
 
 log4cxx::LoggerPtr CraftTypeFactory::logger = log4cxx::Logger::getLogger(_T("xenocommon.staticdata.CraftType"));
 
Index: src/core/staticdata/humanfacilitytype.h
===================================================================
--- src/core/staticdata/humanfacilitytype.h	(revision 694)
+++ src/core/staticdata/humanfacilitytype.h	(working copy)
@@ -140,9 +140,9 @@
 {
 private:
 // list of avaible base facilitys
-	TMap<::String, HumanFacilityTypePtr> facilityList;
-	typedef TPair<::String, HumanFacilityTypePtr> facilityListEntry;
-	typedef TMap<::String, HumanFacilityTypePtr> facilityListFactory;
+	TMap< ::String, HumanFacilityTypePtr> facilityList;
+	typedef TPair< ::String, HumanFacilityTypePtr> facilityListEntry;
+	typedef TMap< ::String, HumanFacilityTypePtr> facilityListFactory;
 
     Common::XmlFilePtr xmlFile; //< XML file with facilities static data
 
Index: src/core/staticdata/planetdatamanager.cpp
===================================================================
--- src/core/staticdata/planetdatamanager.cpp	(revision 694)
+++ src/core/staticdata/planetdatamanager.cpp	(working copy)
@@ -27,7 +27,7 @@
 
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("xenocore.PlanetData.Manager"));
 
-template<> PlanetDataManager* TSingleton<PlanetDataManager>::ms_Singleton = 0;
+//template<> PlanetDataManager* TSingleton<PlanetDataManager>::ms_Singleton = 0;
 
 PlanetDataManager::PlanetDataManager()
 {
Index: src/core/staticdata/planetdata.cpp
===================================================================
--- src/core/staticdata/planetdata.cpp	(revision 694)
+++ src/core/staticdata/planetdata.cpp	(working copy)
@@ -65,4 +65,5 @@
 void PlanetData::loadPoliticalRegion(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * region)
 {
 	
-}
\ No newline at end of file
+}
+
Index: src/core/staticdata/planetdatamanager.h
===================================================================
--- src/core/staticdata/planetdatamanager.h	(revision 694)
+++ src/core/staticdata/planetdatamanager.h	(working copy)
@@ -61,4 +61,4 @@
 	}
 }
 
-#endif
\ No newline at end of file
+#endif
Index: src/core/staticdata/staticdatafactory.h
===================================================================
--- src/core/staticdata/staticdatafactory.h	(revision 694)
+++ src/core/staticdata/staticdatafactory.h	(working copy)
@@ -37,25 +37,25 @@
 class StaticDataIterator : public Common::MapIterator<STLIterator >
 {
 public:
-	StaticDataIterator(const STLIterator begin, const STLIterator & end) : MapIterator<STLIterator>(begin, end)
+	StaticDataIterator(const STLIterator begin, const STLIterator & end) : Common::MapIterator<STLIterator>(begin, end)
 	{		
 	}
 
 	typename STLIterator::value_type::second_type::element_type * next()
 	{
-		return MapIterator<STLIterator>::next().get();
+		return Common::MapIterator<STLIterator>::next().get();
 	}
 
 	static void registerLua(const ::String name)
 	{
 		using namespace luabind;
 		
-		lua_State* L = ScriptSystem::instance().getState();
+		lua_State* L = Common::ScriptSystem::instance().getState();
 
-		module(ScriptSystem::instance().getState(), "__Iterator")
+		module(Common::ScriptSystem::instance().getState(), "__Iterator")
 		[
 			class_< StaticDataIterator<STLIterator> >(name.c_str())
-				.property("hasMore", &Iterator<STLIterator>::hasMore)
+				.property("hasMore", &Common::Iterator<STLIterator>::hasMore)
 				.def("next", &StaticDataIterator<STLIterator>::next)
 		];
 	}
@@ -68,7 +68,7 @@
 	typedef TSharedPtr<const StaticDataType> ConstSharedPtr;
 
 private:
-	typedef	TMap<::String, ConstSharedPtr > DataMap;
+	typedef	TMap< ::String, ConstSharedPtr > DataMap;
 	DataMap dataMap;
 
 protected:
@@ -85,7 +85,7 @@
 
 	const StaticDataType * getItem(const ::String name) const
 	{
-		DataMap::const_iterator iter = dataMap.find(name);
+		typename DataMap::const_iterator iter = dataMap.find(name);
 		if(iter != dataMap.end())
 		{
 			return iter->second.get();
@@ -109,7 +109,7 @@
 		
 	using namespace luabind;
 	
-	lua_State* L = ScriptSystem::instance().getState();
+	lua_State* L = Common::ScriptSystem::instance().getState();
 
 	module(L, "__StaticData")
 	[
@@ -126,4 +126,4 @@
     }
 }
 
-#endif
\ No newline at end of file
+#endif
Index: src/core/staticdata/planetdata.h
===================================================================
--- src/core/staticdata/planetdata.h	(revision 694)
+++ src/core/staticdata/planetdata.h	(working copy)
@@ -58,12 +58,13 @@
 template <typename RegionType>
 void PlanetData::loadRegions(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * regionsNode, TList<TSharedPtr<RegionType> > & list)
 {
+	XERCES_CPP_NAMESPACE_USE
 	DOMNodeList* regions = regionsNode->getChildNodes();
     for(unsigned int i=0;i<regions->getLength();i++)
     {
 		DOMNode * region = regions->item(i);
 		if(region->getNodeType() == DOMNode::ELEMENT_NODE
-			&& XmlManager::transcodeString(region->getNodeName()) == "region")
+			&& Common::XmlManager::transcodeString(region->getNodeName()) == "region")
 		{
 			TSharedPtr<RegionType> ptr(new RegionType(region));
 			list.push_back(ptr);
@@ -74,4 +75,4 @@
 	}
 }
 
-#endif
\ No newline at end of file
+#endif
Index: src/core/staticdata/staticdata.h
===================================================================
--- src/core/staticdata/staticdata.h	(revision 694)
+++ src/core/staticdata/staticdata.h	(working copy)
@@ -32,4 +32,4 @@
 	}
 }
 
-#endif
\ No newline at end of file
+#endif
Index: src/core/staticdata/planetregion.cpp
===================================================================
--- src/core/staticdata/planetregion.cpp	(revision 694)
+++ src/core/staticdata/planetregion.cpp	(working copy)
@@ -231,4 +231,4 @@
 GeographicalRegion::GeographicalRegion(DOMNode * region) : PlanetRegion(region)
 {
 
-};
\ No newline at end of file
+};
Index: src/core/staticdata/planetregion.h
===================================================================
--- src/core/staticdata/planetregion.h	(revision 694)
+++ src/core/staticdata/planetregion.h	(working copy)
@@ -82,4 +82,4 @@
 	}
 }
 
-#endif
\ No newline at end of file
+#endif
Index: src/core/entities/globeicon.cpp
===================================================================
--- src/core/entities/globeicon.cpp	(revision 694)
+++ src/core/entities/globeicon.cpp	(working copy)
@@ -22,6 +22,8 @@
 
 #include "globeicon.h"
 
+BOOST_CLASS_EXPORT_GUID(Xenocide::Core::GlobeIcon, "GlobeIcon");
+
 using namespace Xenocide::Common;
 using namespace Xenocide::Core;
 using namespace boost;
Index: src/core/entities/mission.cpp
===================================================================
--- src/core/entities/mission.cpp	(revision 694)
+++ src/core/entities/mission.cpp	(working copy)
@@ -155,7 +155,7 @@
         } catch (const luabind::error& e) {
             const char* message = lua_tostring(e.state(), -1);
             LOG4CXX_ERROR(logger, boost::str(boost::format("Mission::update: Lua error: %1%") % message));
-        } catch (const luabind::cast_failed e) {
+        } catch (const luabind::cast_failed& e) {
             LOG4CXX_ERROR(logger, boost::str(boost::format("Mission::update: Lua cast error: %1%, %2%") % e.what() % e.info()->name()));
         }
     }
Index: src/core/entities/globeicon.h
===================================================================
--- src/core/entities/globeicon.h	(revision 694)
+++ src/core/entities/globeicon.h	(working copy)
@@ -111,7 +111,7 @@
     ////////////////////////////////////////////////////////////////////////////
     // Fields
 
-    friend LuaGlobeIcon;
+    friend class LuaGlobeIcon;
 private:
     GlobeIcon::WeakPtr globeIcon;
 
@@ -146,6 +146,4 @@
     } // namespace Core
 } // namespace Xenocide
 
-BOOST_CLASS_EXPORT_GUID(Xenocide::Core::GlobeIcon, "GlobeIcon");
-
 #endif // xenocide__core__entities__globeicon_h
Index: src/core/simulation/craft.cpp
===================================================================
--- src/core/simulation/craft.cpp	(revision 694)
+++ src/core/simulation/craft.cpp	(working copy)
@@ -34,4 +34,4 @@
 
 
 
-}
\ No newline at end of file
+}
Index: src/core/simulation/task.cpp
===================================================================
--- src/core/simulation/task.cpp	(revision 694)
+++ src/core/simulation/task.cpp	(working copy)
@@ -150,4 +150,4 @@
 
     tasks.push_back(task);
 
-}
\ No newline at end of file
+}
Index: src/core/simulation/craft.h
===================================================================
--- src/core/simulation/craft.h	(revision 694)
+++ src/core/simulation/craft.h	(working copy)
@@ -92,4 +92,4 @@
 	} // end of Common namespace
 } // end of Xenocide namespace
 
-#endif
\ No newline at end of file
+#endif
Index: src/core/simulation/task.h
===================================================================
--- src/core/simulation/task.h	(revision 694)
+++ src/core/simulation/task.h	(working copy)
@@ -115,4 +115,4 @@
 	} // end of Common namespace
 } // end of Xenocide namespace
 
-#endif
\ No newline at end of file
+#endif
Index: src/core/simulation/simulation.cpp
===================================================================
--- src/core/simulation/simulation.cpp	(revision 694)
+++ src/core/simulation/simulation.cpp	(working copy)
@@ -3,7 +3,7 @@
 This source file is part of Xenocide
 For the latest info on Xenocide, see http://www.projectxenocide.com
 
-Copyright  2003-2004 The Project Xenocide Team
+Copyright © 2003-2004 The Project Xenocide Team
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU Lesser General Public License as published by the Free Software
@@ -48,8 +48,8 @@
 //using Xenocide::Common::StaticData::CraftType;
 
 // TSingleton
-template<> Simulation* TSingleton <Simulation>::ms_Singleton = 0;
-template<> TargetZoneFactory* TSingleton <TargetZoneFactory>::ms_Singleton = 0;
+//template<> Simulation* TSingleton <Simulation>::ms_Singleton = 0;
+//template<> TargetZoneFactory* TSingleton <TargetZoneFactory>::ms_Singleton = 0;
 
 // Logger
 log4cxx::LoggerPtr Simulation::logger = log4cxx::Logger::getLogger(_T("xenocore.Simulation"));
Index: src/core/dictionary.cpp
===================================================================
--- src/core/dictionary.cpp	(revision 694)
+++ src/core/dictionary.cpp	(working copy)
@@ -40,7 +40,7 @@
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("xenocore.Dictionary"));
 
 // Singleton
-template<> Dictionary* TSingleton<Dictionary>::ms_Singleton = 0;
+//template<> Dictionary* TSingleton<Dictionary>::ms_Singleton = 0;
 
 //-----------------------------------------------------------------------------
 const String& Dictionary::resolveString(const String& symbolicName) const
Index: src/core/entitymanager.cpp
===================================================================
--- src/core/entitymanager.cpp	(revision 694)
+++ src/core/entitymanager.cpp	(working copy)
@@ -26,7 +26,7 @@
 #include <core/entities/globeicon.h>
 
 // Singleton
-template<> Xenocide::Core::EntityManager* TSingleton<Xenocide::Core::EntityManager>::ms_Singleton = 0;
+//template<> Xenocide::Core::EntityManager* TSingleton<Xenocide::Core::EntityManager>::ms_Singleton = 0;
 
 // Logger
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("xenocore.EntityManager"));
Index: src/core/entitybase.h
===================================================================
--- src/core/entitybase.h	(revision 694)
+++ src/core/entitybase.h	(working copy)
@@ -74,13 +74,13 @@
 	EntityBase() {};
 
     //! Returns type of the entity
-    virtual const String& getType() = 0;
+    virtual const ::String& getType() const = 0;
 };
 
 
-
     } // namespace Core
 } // namespace Xenocide
+BOOST_IS_ABSTRACT(Xenocide::Core::EntityBase);
 /*
 namespace boost
 {
Index: src/core/entity.h
===================================================================
--- src/core/entity.h	(revision 694)
+++ src/core/entity.h	(working copy)
@@ -69,7 +69,7 @@
     typedef Common::Iterator<typename TypeList::iterator> Iterator;
 
 private:
-    static const String TYPE_NAME;
+    static const::String TYPE_NAME;
     static TypeList entityList;
 
     static EntitySignal createSignal;
@@ -97,7 +97,7 @@
     }
 
     //! @copydoc EntityBase::getType()
-    virtual const String& getType()
+    virtual const ::String& getType() const
     {
         return TYPE_NAME;
     }
@@ -180,6 +180,15 @@
     }
 };
 
+template<class Derived, class Params>
+const::String Entity<Derived, Params>::TYPE_NAME;
+template<class Derived, class Params>
+TList<TWeakPtr<Derived> > Entity<Derived, Params>::entityList;
+template<class Derived, class Params>
+TSignal<void (TWeakPtr<Derived>)> Entity<Derived, Params>::createSignal;
+template<class Derived, class Params>
+TSignal<void (TWeakPtr<Derived>)> Entity<Derived, Params>::destroySignal;
+
     } // namespace Core
 } // namespace Xenocide
 
Index: src/core/gametime.cpp
===================================================================
--- src/core/gametime.cpp	(revision 694)
+++ src/core/gametime.cpp	(working copy)
@@ -3,7 +3,7 @@
 This source file is part of Xenocide Client UI Application 
 For the latest info on Xenocide, see http://www.projectxenocide.com
 
-Copyright  2003-2004 The Project Xenocide Team
+Copyright © 2003-2004 The Project Xenocide Team
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU Lesser General Public License as published by the Free Software
@@ -44,7 +44,7 @@
 	Settings::registerSetting<Real> max_tick_length("gametime_max_tick_length", 60.0f);
 }
 
-template<> GameTime* TSingleton<GameTime>::ms_Singleton = 0;
+//template<> GameTime* TSingleton<GameTime>::ms_Singleton = 0;
 
 //-----------------------------------------------------------------------------
 GameTime::GameTime() : 
Index: src/core/gamestate/gamemachine.cpp
===================================================================
--- src/core/gamestate/gamemachine.cpp	(revision 694)
+++ src/core/gamestate/gamemachine.cpp	(working copy)
@@ -44,10 +44,10 @@
 * internal and doesn't influence IntelliSense too much.
 */
 #define XENOCIDE_STATE(a) \
-    template<> State< a >::StateSignalType State< a >::signalCommon; \
-    template<> State< a >::SignalType State< a >::signalEnter; \
-    template<> State< a >::SignalType State< a >::signalLeave; \
     template<> log4cxx::LoggerPtr State< a >::stateLogger = log4cxx::Logger::getLogger(_T("xenocore.GameMachine."#a))
+//    template<> State< a >::StateSignalType State< a >::signalCommon; 
+//    template<> State< a >::SignalType State< a >::signalEnter; 
+//    template<> State< a >::SignalType State< a >::signalLeave; 
 
 //==============================================================================
 //  Namespace
Index: src/core/gamestate/humanbase.cpp
===================================================================
--- src/core/gamestate/humanbase.cpp	(revision 694)
+++ src/core/gamestate/humanbase.cpp	(working copy)
@@ -23,6 +23,8 @@
 
 #include "humanbase.h"
 
+BOOST_CLASS_EXPORT_GUID(Xenocide::Core::HumanBase, "HumanBase");
+
 using namespace Xenocide::Core;
 using Xenocide::Common::Geoposition;
 
@@ -81,7 +83,7 @@
 
 bool HumanBase::destroyFacility(int x, int y)
 {
-    Console::instance().echo("Destroy button pressed! :" + boost::lexical_cast<::String>(x) + " , " +  boost::lexical_cast<::String>(y));
+    Console::instance().echo("Destroy button pressed! :" + boost::lexical_cast< ::String>(x) + " , " +  boost::lexical_cast< ::String>(y));
     // ToDo: add conitnuum tests
 
     // find and erase facility from list
@@ -239,7 +241,7 @@
 		}
 	}
 
-    XENOCIDE_EXCEPT("Trying to get facility that doesn't exist! pos:" + boost::lexical_cast<::String>(px) + ", " + boost::lexical_cast<::String>(py));
+    XENOCIDE_EXCEPT("Trying to get facility that doesn't exist! pos:" + boost::lexical_cast< ::String>(px) + ", " + boost::lexical_cast< ::String>(py));
     return HumanFacility::SharedPtr();
 }
 
@@ -345,18 +347,18 @@
 
 	Console::instance().echo(" ------------------ Base info: -------------------------");
 	Console::instance().echo("Name:" + name);
-	Console::instance().echo("Number of facilities:" +  boost::lexical_cast<::String>(getNumberOfFacilities()));
-	Console::instance().echo("Manteinance costs:" +  boost::lexical_cast<::String>(getManteinance()));
+	Console::instance().echo("Number of facilities:" +  boost::lexical_cast< ::String>(getNumberOfFacilities()));
+	Console::instance().echo("Manteinance costs:" +  boost::lexical_cast< ::String>(getManteinance()));
     Console::instance().echo(" --- Capacities list(available/total):");
-	Console::instance().echo("Launch pads:" + boost::lexical_cast<::String>(launchAreas.available) + "/" + boost::lexical_cast<::String>(launchAreas.total));
-	Console::instance().echo("General capacity:" + boost::lexical_cast<::String>(generalCapacity.available) + "/" + boost::lexical_cast<::String>(generalCapacity.total));
-	Console::instance().echo("Alien capacity:" + boost::lexical_cast<::String>(alienCapacity.available) + "/" + boost::lexical_cast<::String>(alienCapacity.total));
-	Console::instance().echo("Personel capacity:" + boost::lexical_cast<::String>(personelCapacity.available) + "/" + boost::lexical_cast<::String>(personelCapacity.total));
-    Console::instance().echo("Laboratory capacity:" + boost::lexical_cast<::String>(laboratoryCapacity.available) + "/" + boost::lexical_cast<::String>(laboratoryCapacity.total));
-	Console::instance().echo("Workshop capacity:" + boost::lexical_cast<::String>(workshopCapacity.available) + "/" + boost::lexical_cast<::String>(workshopCapacity.total));
+	Console::instance().echo("Launch pads:" + boost::lexical_cast< ::String>(launchAreas.available) + "/" + boost::lexical_cast< ::String>(launchAreas.total));
+	Console::instance().echo("General capacity:" + boost::lexical_cast< ::String>(generalCapacity.available) + "/" + boost::lexical_cast< ::String>(generalCapacity.total));
+	Console::instance().echo("Alien capacity:" + boost::lexical_cast< ::String>(alienCapacity.available) + "/" + boost::lexical_cast< ::String>(alienCapacity.total));
+	Console::instance().echo("Personel capacity:" + boost::lexical_cast< ::String>(personelCapacity.available) + "/" + boost::lexical_cast< ::String>(personelCapacity.total));
+    Console::instance().echo("Laboratory capacity:" + boost::lexical_cast< ::String>(laboratoryCapacity.available) + "/" + boost::lexical_cast< ::String>(laboratoryCapacity.total));
+	Console::instance().echo("Workshop capacity:" + boost::lexical_cast< ::String>(workshopCapacity.available) + "/" + boost::lexical_cast< ::String>(workshopCapacity.total));
 	Console::instance().echo(" --- Personell:");
-	Console::instance().echo("Scientists: " + boost::lexical_cast<::String>(scientists.getNumber()));
-	Console::instance().echo("Engineers: " + boost::lexical_cast<::String>(engineers.getNumber()));
+	Console::instance().echo("Scientists: " + boost::lexical_cast< ::String>(scientists.getNumber()));
+	Console::instance().echo("Engineers: " + boost::lexical_cast< ::String>(engineers.getNumber()));
 
 
 }
Index: src/core/gamestate/events.cpp
===================================================================
--- src/core/gamestate/events.cpp	(revision 694)
+++ src/core/gamestate/events.cpp	(working copy)
@@ -42,9 +42,9 @@
 * internal and doesn't influence IntelliSense too much.
 */
 #define XENOCIDE_EVENT(a) \
-    template<> Event< a >::SignalType Event< a >::preSignal; \
-    template<> Event< a >::SignalType Event< a >::eventSignal; \
-    template<> const String Event< a >::EVENT_NAME = #a
+    template<> const String Event< a >::EVENT_NAME = #a;
+//    template<> Event< a >::SignalType Event< a >::preSignal; \
+//    template<> Event< a >::SignalType Event< a >::eventSignal; 
 
 namespace Xenocide
 {
Index: src/core/gamestate/tradablemanager.cpp
===================================================================
--- src/core/gamestate/tradablemanager.cpp	(revision 694)
+++ src/core/gamestate/tradablemanager.cpp	(working copy)
@@ -3,7 +3,7 @@
 This source file is part of Xenocide
 For the latest info on Xenocide, see http://www.projectxenocide.com
 
-Copyright  2003-2004 The Project Xenocide Team
+Copyright © 2003-2004 The Project Xenocide Team
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU Lesser General Public License as published by the Free Software
@@ -32,7 +32,7 @@
 using namespace Xenocide::Core;
 
 // TSingleton
-template<> TradableManager* TSingleton <TradableManager>::ms_Singleton = 0;
+//template<> TradableManager* TSingleton <TradableManager>::ms_Singleton = 0;
 
 // Logger
 log4cxx::LoggerPtr TradableManager::logger = log4cxx::Logger::getLogger(_T("xenocore.TradableManager"));
Index: src/core/gamestate/technologymanager.h
===================================================================
--- src/core/gamestate/technologymanager.h	(revision 694)
+++ src/core/gamestate/technologymanager.h	(working copy)
@@ -105,4 +105,4 @@
 } // namespace Xenocide
 
 
-#endif // xenocide__core__gamestate__technologymanager_h
\ No newline at end of file
+#endif // xenocide__core__gamestate__technologymanager_h
Index: src/core/gamestate/gamecontroller.cpp
===================================================================
--- src/core/gamestate/gamecontroller.cpp	(revision 694)
+++ src/core/gamestate/gamecontroller.cpp	(working copy)
@@ -39,7 +39,7 @@
 log4cxx::LoggerPtr Xenocide::Core::GameController::logger = log4cxx::Logger::getLogger(_T("xenocore.GameController"));
 
 // Singleton
-template<> Xenocide::Core::GameController* TSingleton<Xenocide::Core::GameController>::ms_Singleton = 0;
+//template<> Xenocide::Core::GameController* TSingleton<Xenocide::Core::GameController>::ms_Singleton = 0;
 
 //==============================================================================
 //  Namespace
Index: src/core/gamestate/techsystem.h
===================================================================
--- src/core/gamestate/techsystem.h	(revision 694)
+++ src/core/gamestate/techsystem.h	(working copy)
@@ -42,4 +42,4 @@
     }
 }
 
-#endif
\ No newline at end of file
+#endif
Index: src/core/gamestate/humanfacility.h
===================================================================
--- src/core/gamestate/humanfacility.h	(revision 694)
+++ src/core/gamestate/humanfacility.h	(working copy)
@@ -109,6 +109,4 @@
     } // namespace Core
 } // namespace Xenocide
 
-BOOST_CLASS_EXPORT_GUID(Xenocide::Core::HumanFacility, "HumanFacility");
-
 #endif // xenocide__core__humanfacility_h
Index: src/core/gamestate/gamemachine.h
===================================================================
--- src/core/gamestate/gamemachine.h	(revision 694)
+++ src/core/gamestate/gamemachine.h	(working copy)
@@ -88,7 +88,7 @@
     void signalEvent(const EventType&)
     {
         //LOG4CXX_INFO(machineLogger, "Event: " << typename EventType::EVENT_NAME);
-        typename EventType::eventSignal();
+        EventType::eventSignal();
     }
 
 private:
@@ -153,6 +153,13 @@
     static log4cxx::LoggerPtr stateLogger;
 };
 
+template< typename MostDerived >
+typename State<MostDerived>::StateSignalType State<MostDerived>::signalCommon;
+template< typename MostDerived >
+typename State<MostDerived>::SignalType State<MostDerived>::signalEnter;
+template< typename MostDerived >
+typename State<MostDerived>::SignalType State<MostDerived>::signalLeave;
+
 //==============================================================================
 //  Main state
 //==============================================================================
Index: src/core/gamestate/technologymanager.cpp
===================================================================
--- src/core/gamestate/technologymanager.cpp	(revision 694)
+++ src/core/gamestate/technologymanager.cpp	(working copy)
@@ -37,7 +37,7 @@
 log4cxx::LoggerPtr Xenocide::Core::TechnologyManager::logger = log4cxx::Logger::getLogger(_T("xenocore.TechnologyManager"));
 
 // Singleton
-template<> Xenocide::Core::TechnologyManager* TSingleton<Xenocide::Core::TechnologyManager>::ms_Singleton = 0;
+//template<> Xenocide::Core::TechnologyManager* TSingleton<Xenocide::Core::TechnologyManager>::ms_Singleton = 0;
 
 namespace Xenocide
 {
Index: src/core/gamestate/humanbase.h
===================================================================
--- src/core/gamestate/humanbase.h	(revision 694)
+++ src/core/gamestate/humanbase.h	(working copy)
@@ -213,6 +213,4 @@
 	} // namespace Core
 } // namespace Xenocide
 
-BOOST_CLASS_EXPORT_GUID(Xenocide::Core::HumanBase, "HumanBase");
-
 #endif
Index: src/core/gamestate/events.h
===================================================================
--- src/core/gamestate/events.h	(revision 694)
+++ src/core/gamestate/events.h	(working copy)
@@ -45,6 +45,7 @@
         namespace States
         {
 
+struct GameMachine;
 /**
  * @brief Base class for all events.
  */
@@ -79,13 +80,18 @@
         return connectSignal(preSignal, slot, group);
     }
 
-    const static String EVENT_NAME;
+    static const String EVENT_NAME;
 
 protected:
     static SignalType preSignal;
     static SignalType eventSignal;
 };
 
+template< typename MostDerived >
+typename Event<MostDerived>::SignalType Event<MostDerived>::preSignal;
+template< typename MostDerived >
+typename Event<MostDerived>::SignalType Event<MostDerived>::eventSignal;
+
 // Main
 struct EvQuitGame : public Event< EvQuitGame > {};
 struct EvAbandonGame : public Event< EvAbandonGame > {};
Index: src/core/gamestate/gamestate.cpp
===================================================================
--- src/core/gamestate/gamestate.cpp	(revision 694)
+++ src/core/gamestate/gamestate.cpp	(working copy)
@@ -31,7 +31,7 @@
 using namespace Xenocide::Common;
 using namespace Xenocide::Core;
 
-template<> GameState* TSingleton <GameState>::ms_Singleton = 0;
+//template<> GameState* TSingleton <GameState>::ms_Singleton = 0;
 
 GameState::GameState()
 {
Index: src/core/gamestate/player.cpp
===================================================================
--- src/core/gamestate/player.cpp	(revision 694)
+++ src/core/gamestate/player.cpp	(working copy)
@@ -32,7 +32,7 @@
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("xenocore.Player"));
 
 // Singleton
-template<> Xenocide::Core::Player* TSingleton<Xenocide::Core::Player>::ms_Singleton = 0;
+//template<> Xenocide::Core::Player* TSingleton<Xenocide::Core::Player>::ms_Singleton = 0;
 
 //==============================================================================
 //  Namespace
@@ -94,7 +94,7 @@
 void Player::updateMoneyStr()
 {
     Sint64 money = Player::instance().getMoney();
-    moneyStr = boost::lexical_cast<::String, Sint64> (money);
+    moneyStr = boost::lexical_cast< ::String, Sint64> (money);
     int money_numbers = moneyStr.length();
     int money_spaces = (money_numbers - 1) / 3;
     for (int nr = 1; nr <= money_spaces; nr++)
Index: src/core/gamestate/humanfacility.cpp
===================================================================
--- src/core/gamestate/humanfacility.cpp	(revision 694)
+++ src/core/gamestate/humanfacility.cpp	(working copy)
@@ -21,6 +21,8 @@
 #include "gametime.h"
 #include "common/console/console.h"
 
+BOOST_CLASS_EXPORT_GUID(Xenocide::Core::HumanFacility, "HumanFacility");
+
 using namespace Xenocide::Common;
 using namespace Xenocide::Core;
 
Index: src/common/iterator.h
===================================================================
--- src/common/iterator.h	(revision 694)
+++ src/common/iterator.h	(working copy)
@@ -131,4 +131,4 @@
 	}
 }
 
-#endif
\ No newline at end of file
+#endif
Index: src/common/lua/lua_stack.h
===================================================================
--- src/common/lua/lua_stack.h	(revision 694)
+++ src/common/lua/lua_stack.h	(working copy)
@@ -62,4 +62,4 @@
     } // end of namespace Common
 } // end of namespace Xenocide
 
-#endif
\ No newline at end of file
+#endif
Index: src/common/path.h
===================================================================
--- src/common/path.h	(revision 694)
+++ src/common/path.h	(working copy)
@@ -32,7 +32,7 @@
 {
 private:
     typedef TVector<boost::filesystem::path> PathList;
-    THashMap<::String, PathList> pathMap;
+    THashMap< ::String, PathList> pathMap;
     boost::filesystem::path initialPath;
 
 public:
Index: src/common/singleton.h
===================================================================
--- src/common/singleton.h	(revision 694)
+++ src/common/singleton.h	(working copy)
@@ -86,6 +86,8 @@
     { return ms_Singleton; }
 };
 
+template <typename T> T* TSingleton<T>::ms_Singleton = 0;
+
 //    }
 //}
 
Index: src/common/types.h
===================================================================
--- src/common/types.h	(revision 694)
+++ src/common/types.h	(working copy)
@@ -54,8 +54,9 @@
 #   endif
 #else
 # if(XENOCIDE_PLATFORM == XENOCIDE_PLATFORM_LINUX)
-#	include <set>
-#	include <map>
+#   include <ext/hash_set>
+#   include <ext/hash_map>
+#   include <OgreString.h>
 #   define THashMap ::__gnu_cxx::hash_map
 #   define THashSet ::__gnu_cxx::hash_set
 #   define THashMultiMap ::__gnu_cxx::hash_multimap
Index: src/common/commonrequisites.h
===================================================================
--- src/common/commonrequisites.h	(revision 694)
+++ src/common/commonrequisites.h	(working copy)
@@ -91,7 +91,7 @@
 // Xerces Headers (will speed up compilation I hope)
 #include <xercesc/util/XercesDefs.hpp>
 #include <xercesc/util/XMLString.hpp>
-#include <xercesc/DOM/DOM.hpp>
+#include <xercesc/dom/DOM.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 // Common Xenocide Headers
Index: src/common/factory.h
===================================================================
--- src/common/factory.h	(revision 694)
+++ src/common/factory.h	(working copy)
@@ -72,7 +72,7 @@
 };
 
 template <class AbstractProduct>
-void TFactory<AbstractProduct>::registerCreateFn(const String& className, typename CreateFn fn)
+void TFactory<AbstractProduct>::registerCreateFn(const String& className, CreateFn fn)
 {
     registry[className] = fn;
 }
@@ -82,7 +82,7 @@
 {
     ProductPtr object(NULL);
 
-    FnRegistry::const_iterator entry = registry.find(className);
+    typename FnRegistry::const_iterator entry = registry.find(className);
     if (entry != registry.end())
     {
         object = entry->second();
Index: src/common/settings/settings.cpp
===================================================================
--- src/common/settings/settings.cpp	(revision 694)
+++ src/common/settings/settings.cpp	(working copy)
@@ -38,7 +38,8 @@
 
 using namespace Xenocide::Common;
 
-template<> Settings* TSingleton <Settings>::ms_Singleton = 0;
+//template<> Settings* TSingleton <Settings>::ms_Singleton = 0;
+TSharedPtr<Settings> Settings::sharedSettings;
 
 Settings::Settings()
 {
@@ -151,3 +152,10 @@
 	Console::instance().echo("Settings saved to " + fileName);
 
 }
+
+// Template specializations should be at namespace level for GCC compatibility
+
+template<> Settings::SettingType Settings::getType<Bool>() { return TYPE_BOOL; }
+template<> Settings::SettingType Settings::getType<Sint>() { return TYPE_INT; }
+template<> Settings::SettingType Settings::getType<Real>() { return TYPE_REAL; }
+template<> Settings::SettingType Settings::getType< ::String>() { return TYPE_STRING; }
Index: src/common/settings/settings.h
===================================================================
--- src/common/settings/settings.h	(revision 694)
+++ src/common/settings/settings.h	(working copy)
@@ -3,7 +3,7 @@
 This source file is part of Xenocide Client UI Application 
 For the latest info on Xenocide, see http://www.projectxenocide.com
 
-Copyright  2003-2004 The Project Xenocide Team
+Copyright © 2003-2004 The Project Xenocide Team
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU Lesser General Public License as published by the Free Software
@@ -59,7 +59,8 @@
 {
 public:
     friend class Console;
-	enum SettingType { TYPE_BOOL, TYPE_INT, TYPE_REAL, TYPE_STRING };
+    enum SettingType { TYPE_BOOL, TYPE_INT, TYPE_REAL, TYPE_STRING };
+    static TSharedPtr<Settings> sharedSettings;
 
 private:
 	void registerLua();
@@ -74,10 +75,6 @@
 		//this will never get executed
 		return TYPE_BOOL;
 	};
-	template<> static SettingType getType<Bool>() { return TYPE_BOOL; }
-	template<> static SettingType getType<Sint>() { return TYPE_INT; }
-	template<> static SettingType getType<Real>() { return TYPE_REAL; }
-	template<> static SettingType getType<::String>() { return TYPE_STRING; }
 
 	template<SettingType type> static SettingType getBasicType()
 	{
@@ -158,17 +155,6 @@
 			static ReturnType returnValue(const T & returnValue) { return static_cast<ReturnType>(returnValue); };
 	};
 
-	template<>
-	struct ThrowIfFalse<false>
-	{
-		ThrowIfFalse() { XENOCIDE_EXCEPT("Wrong type for this setting"); };
-		template<typename ReturnType, typename T>
-			static ReturnType returnValue(const T & returnValue) {
-				XENOCIDE_EXCEPT("Wrong type for this setting"); 
-				return ReturnType();
-			};
-	};
-
 	template<typename ReturnType>
 	class GetVisitor : public boost::static_visitor<ReturnType>
 	{
@@ -180,28 +166,12 @@
 			XENOCIDE_EXCEPT("Wrong type for this setting");
 		}
 
-		template<>
-		ReturnType operator()<ReturnType>(ReturnType i) const
-		{ 
-			return i;
-		}
-	};
+        // same as template<> ReturnType operator()<ReturnType>
+        ReturnType operator()(ReturnType i) const
+        { 
+            return i;
+        }
 
-	template<>
-	class GetVisitor<::String> : public boost::static_visitor<::String>
-	{
-	public:
-		template<typename T>
-		::String operator()(T i) const
-		{
-			return boost::lexical_cast<::String>(i);
-		}
-
-		template<>
-			::String operator()(::String i) const
-		{
-			return i;
-		}
 	};
 
 	template<typename SetType>
@@ -219,55 +189,56 @@
 			return Setting::SettingVariant();
 		}
 
-		template<>
-		Setting::SettingVariant operator()<SetType>(SetType i) const
-		{
-			return Setting::SettingVariant(value);
-		}
+        // same as template<> Setting::ReturnType operator()<SetType>
+        Setting::SettingVariant operator()(SetType i) const
+        {
+            return Setting::SettingVariant(value);
+        }
+
 	};
 
 
-	/** \brief SettingUpdater allows you to update local copies with the most current setting value.
-	*
-	* It is used with registerSettingCallback (see the example there)
-	*
-	* @see registerSettingCallback
-	*/
-	template<class VarType>
-	class SettingUpdater
-	{
-	private:
-		VarType & reference;
+    typedef TMap<String, Setting> SettingsMap;
 
-	public:
+    SettingsMap settings;
 
-		SettingUpdater(VarType & var) : reference(var)
-		{
+public:
+	Settings();
+	~Settings() {};
 
-		}
+    /** \brief SettingUpdater allows you to update local copies with the most current setting value.
+    *
+    * It is used with registerSettingCallback (see the example there)
+    *
+    * @see registerSettingCallback
+    */
+    template<class VarType>
+    class SettingUpdater
+    {
+    private:
+        VarType & reference;
 
-		void operator()(const Setting & setting)
-		{
-			if(setting.value)
-			{
-				reference = boost::apply_visitor(GetVisitor<VarType>(), *setting.value);
-			}
-			else
-			{
-				reference = boost::apply_visitor(GetVisitor<VarType>(), setting.defaultValue);
-			}
-		}
+    public:
 
-	};
+        SettingUpdater(VarType & var) : reference(var)
+        {
 
+        }
 
-    typedef TMap<String, Setting> SettingsMap;
+        void operator()(const Setting & setting)
+        {
+            if(setting.value)
+            {
+                reference = boost::apply_visitor(GetVisitor<VarType>(), *setting.value);
+            }
+            else
+            {
+                reference = boost::apply_visitor(GetVisitor<VarType>(), setting.defaultValue);
+            }
+        }
 
-    SettingsMap settings;
+    };
 
-public:
-	Settings();
-	~Settings() {};
 
 	/** \brief registers a function object to call once the setting with the supplied keyname has changed
 	 *
@@ -344,8 +315,9 @@
 			if(Settings::instancePtr() == 0)
 			{
 				new Settings();
+				sharedSettings.reset(Settings::instancePtr());
 			}
-			settingsSingleton.reset(Settings::instancePtr());
+			settingsSingleton = Settings::sharedSettings;
 			Settings::SettingsMap::iterator iter = Settings::instance().settings.find(keyname);
 			if(iter != Settings::instance().settings.end())
 				XENOCIDE_EXCEPT("Setting: " + keyname + " already exist");
@@ -361,6 +333,9 @@
 		~registerSetting()
 		{
 			int a = 0;
+			settingsSingleton.reset();
+			if (Settings::sharedSettings.unique())
+				Settings::sharedSettings.reset();
 		}
 	private:
 		registerSetting();
@@ -447,16 +422,43 @@
 	Bool getBool(const ::String & keyname) const { return get<Bool>(keyname); };
 	Sint getInt(const ::String & keyname) const { return get<Sint>(keyname); };
 	Real getReal(const ::String & keyname) const { return get<Real>(keyname); };
-	::String getString(const ::String & keyname) const { return get<::String>(keyname); };
+	::String getString(const ::String & keyname) const { return get< ::String>(keyname); };
 
 	void setBool(const ::String & keyname, Bool value) { set<Bool>(keyname, value); };
 	void setInt(const ::String & keyname, Sint value) { set<Sint>(keyname, value); };
 	void setReal(const ::String & keyname, Real value) { set<Real>(keyname, value); };
-    void setString(const ::String & keyname, const ::String & value) { set<::String>(keyname, value); };
+    void setString(const ::String & keyname, const ::String & value) { set< ::String>(keyname, value); };
 
 };
 
-	}
-}
 
+// Template specializations should be at namespace level for GCC compatibility
+
+template<> Settings::SettingType Settings::getType<Bool>();
+template<> Settings::SettingType Settings::getType<Sint>();
+template<> Settings::SettingType Settings::getType<Real>();
+template<> Settings::SettingType Settings::getType< ::String>();
+
+template<>
+struct Settings::ThrowIfFalse<false>
+{
+	ThrowIfFalse() { XENOCIDE_EXCEPT("Wrong type for this setting"); };
+	template<typename ReturnType, typename T>
+		static ReturnType returnValue(const T & returnValue) {
+			XENOCIDE_EXCEPT("Wrong type for this setting"); 
+			return ReturnType();
+		};
+};
+
+template<>
+    template<typename T>
+    ::String Settings::GetVisitor< ::String>::operator()(T i) const
+    {
+        return boost::lexical_cast< ::String>(i);
+
+    }
+
+	} // Common
+} // Xenocide
+
 #endif
Index: src/common/xml/xmlfile.cpp
===================================================================
--- src/common/xml/xmlfile.cpp	(revision 694)
+++ src/common/xml/xmlfile.cpp	(working copy)
@@ -85,7 +85,7 @@
         //load();
         touch();
     }
-    catch (Ogre::Exception &e)
+    catch (const Ogre::Exception &e)
     {
         XENOCIDE_EXCEPT(e.getFullDescription());
     }
@@ -172,7 +172,8 @@
 //  XmlDocument class implementation
 //=============================================================================
 
-XmlDocument::XmlDocument(XMLChPtr nameSpace, XMLChPtr root, XMLChPtr features)
+XmlDocument::XmlDocument(const XMLChPtr& nameSpace, const XMLChPtr& root, 
+    const XMLChPtr& features)
 {
     DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(features);
     doc = impl->createDocument(nameSpace, root, 0);
Index: src/common/xml/xmlfile.h
===================================================================
--- src/common/xml/xmlfile.h	(revision 694)
+++ src/common/xml/xmlfile.h	(working copy)
@@ -78,7 +78,8 @@
 {
 public:
     //! Creates empty DOMDocument and stores it's pointer.
-    XmlDocument(XMLChPtr nameSpace, XMLChPtr root, XMLChPtr features);
+    XmlDocument(const XMLChPtr& nameSpace, const XMLChPtr& root, 
+		const XMLChPtr& features);
     virtual ~XmlDocument();
 
     //! Returns an implementation used to create the document.
Index: src/common/xml/xmlmanager.cpp
===================================================================
--- src/common/xml/xmlmanager.cpp	(revision 694)
+++ src/common/xml/xmlmanager.cpp	(working copy)
@@ -58,7 +58,7 @@
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("xenocommon.XmlManager"));
 
 //  Singleton
-template<> XmlManager* TSingleton<XmlManager>::ms_Singleton = 0;
+//template<> XmlManager* TSingleton<XmlManager>::ms_Singleton = 0;
 
 //=============================================================================
 //  Namespace
@@ -72,7 +72,7 @@
 class XmlErrorHandler : public XERCES_CPP_NAMESPACE::ErrorHandler
 {
 public:
-    XmlErrorHandler::XmlErrorHandler( Bool _throwErrors, Bool _throwWarnings )
+    XmlErrorHandler( Bool _throwErrors, Bool _throwWarnings )
         : sawErrors( false )
         , throwErrors( _throwErrors )
         , throwWarnings( _throwWarnings )
@@ -179,7 +179,7 @@
         XERCES_CPP_NAMESPACE_USE;
         using namespace Ogre;
 
-        //LOG4CXX_DEBUG(logger, ::String("resId type: ") + boost::lexical_cast<::String>(resId->getResourceIdentifierType()));
+        //LOG4CXX_DEBUG(logger, ::String("resId type: ") + boost::lexical_cast< ::String>(resId->getResourceIdentifierType()));
 
         InputSource* input = 0;
 
@@ -197,7 +197,7 @@
         case XMLResourceIdentifier::UnKnown:
         default:
             LOG4CXX_ERROR(logger, ::String("Unable to resolve entity: not implemented (resId = ")
-                + boost::lexical_cast<::String>(resId->getResourceIdentifierType()) + ")");
+                + boost::lexical_cast< ::String>(resId->getResourceIdentifierType()) + ")");
         }
 
         return input;
Index: src/common/console/scriptsystem.h
===================================================================
--- src/common/console/scriptsystem.h	(revision 694)
+++ src/common/console/scriptsystem.h	(working copy)
@@ -123,7 +123,7 @@
 
     void setUseMultiline(Bool newStatus) { if (newStatus == true) isMultiline = false; useMultiline = newStatus; }
 
-    void ScriptSystem::dumpStack (lua_State* aState);
+    void dumpStack (lua_State* aState);
 
 private:
     Bool isIncomplete(Sint status);
Index: src/common/console/console.cpp
===================================================================
--- src/common/console/console.cpp	(revision 694)
+++ src/common/console/console.cpp	(working copy)
@@ -54,7 +54,7 @@
 
 using namespace Xenocide::Common;
 
-template<> Console* TSingleton <Console>::ms_Singleton = 0;
+//template<> Console* TSingleton <Console>::ms_Singleton = 0;
 
 log4cxx::LoggerPtr Console::logger = log4cxx::Logger::getLogger(_T("xenocommon.console"));
 
@@ -140,7 +140,7 @@
     }
 
     ofstream file(filePath);
-    TDeque<::String>::iterator it;
+    TDeque< ::String>::iterator it;
     Bool isBegin = true;
 
     for (it = outputBuffer.begin(); it != outputBuffer.end(); it++)
@@ -228,11 +228,11 @@
 		    {
                 Settings::instance().setFromString(key, tokens[2]);
 		    }
-            catch(boost::bad_lexical_cast&)
+            catch(const boost::bad_lexical_cast&)
             {
                 XENOCIDE_CONECHO(tokens[2] << " isn't proper value expression for setting " << key);
             }
-            catch(Xenocide::Common::Exception&)
+            catch(const Xenocide::Common::Exception&)
 		    {
                 Console::instance().echo(key + " is not a setting");
             }            
@@ -248,7 +248,7 @@
 
             try
 		    {
-				::String value = Settings::instance().get<::String>(key);
+				::String value = Settings::instance().get< ::String>(key);
 
                 Console::instance().echo(key + " = \"" + value + "\"");
 		    }
@@ -424,7 +424,7 @@
     ::String ret;
 
     if (startLine >= outputSize)
-        return(::String());
+        return("");
 
     if (startLine + numLines > outputSize)
         numLines = outputSize - startLine;
Index: src/common/console/console.h
===================================================================
--- src/common/console/console.h	(revision 694)
+++ src/common/console/console.h	(working copy)
@@ -53,10 +53,10 @@
 class Console : public TSingleton<Console>
 {
 private:
-    TDeque<::String> execBuffer;
-    TDeque<::String> outputBuffer;
-    TDeque<::String> historyBuffer;
-    TDeque<::String>::iterator historyIterator;
+    TDeque< ::String> execBuffer;
+    TDeque< ::String> outputBuffer;
+    TDeque< ::String> historyBuffer;
+    TDeque< ::String>::iterator historyIterator;
 
     Bool isExecuting; //< True when execBuffer execution has been fired
     Bool isChanged; //< True when output buffer changed
Index: src/common/console/scriptsystem.cpp
===================================================================
--- src/common/console/scriptsystem.cpp	(revision 694)
+++ src/common/console/scriptsystem.cpp	(working copy)
@@ -37,7 +37,7 @@
 
 using namespace Xenocide::Common;
 
-template<> ScriptSystem* TSingleton <ScriptSystem>::ms_Singleton = 0;
+//template<> ScriptSystem* TSingleton <ScriptSystem>::ms_Singleton = 0;
 
 log4cxx::LoggerPtr ScriptSystem::logger = log4cxx::Logger::getLogger(_T("xenocommon.scriptsystem"));
 
Index: src/common/resourceptr.h
===================================================================
--- src/common/resourceptr.h	(revision 694)
+++ src/common/resourceptr.h	(working copy)
@@ -69,7 +69,7 @@
     }
 
     /// Operator used to convert a ResourcePtr to a ResourcePtrTemplate<T>
-    template<class T> TResourcePtr& operator=(const Ogre::ResourcePtr& r)
+    TResourcePtr& operator=(const Ogre::ResourcePtr& r)
     {
         if (pRep == static_cast<T*>(r.getPointer()))
             return *this;
Index: src/common/planetview/globeiconmanager.cpp
===================================================================
--- src/common/planetview/globeiconmanager.cpp	(revision 694)
+++ src/common/planetview/globeiconmanager.cpp	(working copy)
@@ -38,7 +38,7 @@
     virtual const String& getName() = 0;
 
     //! Returns type of the entity
-    virtual const String& getType() = 0;
+    virtual const String& getType() const = 0;
 
     //! Returns handle
     EntityHandle getHandle();
Index: src/launcher/launcher.cpp
===================================================================
--- src/launcher/launcher.cpp	(revision 694)
+++ src/launcher/launcher.cpp	(working copy)
@@ -43,7 +43,11 @@
 using namespace boost::program_options;
 using namespace std;
 
+#ifdef _WIN32
 #define XENOCIDE_EXCEPT(m)     throw(std::exception(m));
+#else
+#define XENOCIDE_EXCEPT(m)     throw(std::runtime_error(m));
+#endif
 
 // Module creation and destruction function pointers
 typedef IApplicationModule* (*getModulePtr)();
@@ -137,7 +141,7 @@
             moduleName += ".so";
         moduleName = "lib" + moduleName;
 
-        cout << "Loading " << moduleName << "..." << std;
+        cout << "Loading " << moduleName << "..." << endl;
 
 		//For now we just load the lib from the same dir
 		binDir = "system_d";
@@ -148,8 +152,10 @@
         chdir(moduleDir.c_str());
 
         // Set environment variable PATH (note that on linux ':' separates PATH entries, while Win32 uses ';')
-        string pathEnv = "PATH=" + pathDir + ":" + getenv("PATH");
-        putenv(pathEnv.c_str());        
+        // On linux putenv creates a pointer to the char array and demands it to be non-const.
+        // This means that if you destroy the array, the env variable goes with it.
+        string pathEnv = pathDir + ":" + getenv("PATH");
+        setenv("PATH", pathEnv.c_str(), 1);
 
         moduleLib = dlopen(modulePath.c_str(), RTLD_NOW | RTLD_GLOBAL);
         if (!moduleLib)
@@ -180,7 +186,7 @@
         app = 0;
 
     }
-    catch(std::exception &e)
+    catch(const std::exception &e)
     {
 #ifdef _WIN32
         MessageBox(NULL, e.what(), "An exception has occured!", 
Index: src/client/xenocideapp.cpp
===================================================================
--- src/client/xenocideapp.cpp	(revision 694)
+++ src/client/xenocideapp.cpp	(working copy)
@@ -55,7 +55,7 @@
 using namespace Ogre;
 
 //===================================================================================================
-template<> XenocideApp* TSingleton<XenocideApp>::ms_Singleton = 0;
+//template<> XenocideApp* TSingleton<XenocideApp>::ms_Singleton = 0;
 //===================================================================================================
 
 typedef TVector<boost::filesystem::path> PathList;
Index: src/client/xenocidemodule.cpp
===================================================================
--- src/client/xenocidemodule.cpp	(revision 694)
+++ src/client/xenocidemodule.cpp	(working copy)
@@ -72,7 +72,6 @@
     using namespace boost::filesystem;
 
     initial_path();
-
     log4cxx::PropertyConfigurator::configure(_T("../data/config/logging.cfg"));
 
     logger->info(_T("Xenocide UI Client has started."));
@@ -88,7 +87,7 @@
     {
 		Xenocide::UI::XenocideApp::instancePtr()->go();
     } 
-    catch( Ogre::Exception& e ) // intercept Ogre exception and rethrow it as standard exception
+    catch(const Ogre::Exception& e ) // intercept Ogre exception and rethrow it as standard exception
     {
         XENOCIDE_EXCEPT((String("Ogre exception: ") + e.getFullDescription()).c_str());
     }
Index: src/client/xenocideapp.h
===================================================================
--- src/client/xenocideapp.h	(revision 694)
+++ src/client/xenocideapp.h	(working copy)
@@ -128,4 +128,4 @@
     } // namespace UI
 } // namespace Xenocide
 
-#endif xenocide__client__xenocideapp_h
+#endif // xenocide__client__xenocideapp_h
Index: src/client/mainframelistener.cpp
===================================================================
--- src/client/mainframelistener.cpp	(revision 694)
+++ src/client/mainframelistener.cpp	(working copy)
@@ -43,7 +43,7 @@
 using namespace boost;
 
 // Singleton
-template<> MainFrameListener* TSingleton<MainFrameListener>::ms_Singleton = 0;
+//template<> MainFrameListener* TSingleton<MainFrameListener>::ms_Singleton = 0;
 
 // Logger
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("xenoui.MainFrameListener"));
Index: src/client/commonui/actionmapdialog.h
===================================================================
--- src/client/commonui/actionmapdialog.h	(revision 694)
+++ src/client/commonui/actionmapdialog.h	(working copy)
@@ -56,7 +56,7 @@
 
     void clear()
     {
-        TVector<T*>::iterator it = data.begin();
+        typename TVector<T*>::iterator it = data.begin();
         for(; it != data.end(); it++)
         {
             delete *it;
@@ -78,7 +78,7 @@
         try
         {
             T* userData = static_cast<T*>(pointer);
-            TVector<T*>::iterator it = data.begin();
+            typename TVector<T*>::iterator it = data.begin();
             for(; it != data.end(); it++)
             {
                 if(*it == userData)
Index: src/client/commonui/optionsdialog.cpp
===================================================================
--- src/client/commonui/optionsdialog.cpp	(revision 694)
+++ src/client/commonui/optionsdialog.cpp	(working copy)
@@ -92,7 +92,7 @@
         eventMap.handler("OptionsDialog/Sound/Music", &OptionsDialog::onMusicSwitch, this);
         eventMap.handler("OptionsDialog/Sound/Effects", &OptionsDialog::onSfxSwitch, this);
     }
-    catch (CEGUI::Exception& e)
+    catch (const CEGUI::Exception& e)
     {
         LOG4CXX_ERROR(logger, "Error creating Options dialog: " << e.getMessage().c_str());
         XENOCIDE_EXCEPT("Error creating Options dialog: " << e.getMessage().c_str());
Index: src/client/commonui/modaldialog.cpp
===================================================================
--- src/client/commonui/modaldialog.cpp	(revision 694)
+++ src/client/commonui/modaldialog.cpp	(working copy)
@@ -98,4 +98,4 @@
 }
 
     }
-}
\ No newline at end of file
+}
Index: src/client/commonui/uitest.cpp
===================================================================
--- src/client/commonui/uitest.cpp	(revision 694)
+++ src/client/commonui/uitest.cpp	(working copy)
@@ -50,9 +50,12 @@
 		EventMap eventMap(CEGUI::PushButton::EventClicked);
         eventMap.handler("UITest/Back", States::EvToggleTestUI());
 
-		CEGUI::GlobalEventSet::getSingleton().subscribeEvent(CEGUI::Slider::EventNamespace + "/" + CEGUI::Slider::EventValueChanged, CEGUI::Event::Subscriber(UITest::Slide,this));
+		CEGUI::GlobalEventSet::getSingleton().subscribeEvent(
+                CEGUI::Slider::EventNamespace + "/" + 
+                CEGUI::Slider::EventValueChanged, 
+                CEGUI::Event::Subscriber(&UITest::Slide,this));
     }
-    catch(CEGUI::Exception e)
+    catch(const CEGUI::Exception& e)
     {
         XENOCIDE_EXCEPT("Unable to load uitest: " << e.getMessage().c_str());
     }
@@ -67,7 +70,7 @@
 
 bool UITest::Slide(const CEGUI::EventArgs& e)
 {
-	CEGUI::Window* slide = ((CEGUI::WindowEventArgs*)&e)->window;
+	CEGUI::Window* slide = ((const CEGUI::WindowEventArgs*)&e)->window;
 	slide->requestRedraw();
 
 	return true;
@@ -79,7 +82,7 @@
     {
         CEGUI::System::getSingleton().setGUISheet(window);
     }
-    catch(CEGUI::Exception e)
+    catch(const CEGUI::Exception& e)
     {
         XENOCIDE_EXCEPT("Unable to load uitest: " << e.getMessage().c_str());
     }
Index: src/client/commonui/loading.cpp
===================================================================
--- src/client/commonui/loading.cpp	(revision 694)
+++ src/client/commonui/loading.cpp	(working copy)
@@ -57,7 +57,7 @@
     {
         //window = CEGUI::WindowManager::getSingleton().loadWindowLayout("layouts/loading.layout");
     }
-    catch(CEGUI::Exception &)
+    catch(const CEGUI::Exception &)
     {
     }
 }
Index: src/client/commonui/xnet.cpp
===================================================================
--- src/client/commonui/xnet.cpp	(revision 694)
+++ src/client/commonui/xnet.cpp	(working copy)
@@ -83,11 +83,11 @@
     std::list<CEGUI::PushButton*>::iterator curCategory;
     std::list<CEGUI::PushButton*>::iterator nextCategory;
 
-    const static float BUTTON_X;
-    const static float BUTTON_Y;
-    const static float BUTTON_HEIGHT;
-    const static float BUTTON_WIDTH;
-    const static float BUTTON_OFFSET;
+    static const float BUTTON_X;
+    static const float BUTTON_Y;
+    static const float BUTTON_HEIGHT;
+    static const float BUTTON_WIDTH;
+    static const float BUTTON_OFFSET;
 };
 
     } // namespace UI
@@ -287,7 +287,7 @@
 bool XNetButtonList::categoryClicked(const CEGUI::EventArgs &e)
 {
     //you can never have enough parentheses
-    openCategory(static_cast<CEGUI::PushButton*>(((CEGUI::WindowEventArgs*)(&e))->window));
+    openCategory(static_cast<CEGUI::PushButton*>(((const CEGUI::WindowEventArgs*)(&e))->window));
 
     return true;
 }
@@ -336,7 +336,7 @@
 
         setupScene();
     }
-    catch(CEGUI::FileIOException e)
+    catch(const CEGUI::FileIOException& e)
     {
         LOG4CXX_ERROR(logger, e.getMessage().c_str());
     }
@@ -400,8 +400,8 @@
 // Implements processing of button actions.
 bool XNet::handleAction(const CEGUI::EventArgs& e)
 {
-	CEGUI::MouseEventArgs * event = (CEGUI::MouseEventArgs*)&e;
-    const ::String action = ((CEGUI::WindowEventArgs*)&e)->window->getName().c_str();
+	const CEGUI::MouseEventArgs * event = (const CEGUI::MouseEventArgs*)&e;
+    const ::String action = ((const CEGUI::WindowEventArgs*)&e)->window->getName().c_str();
 
 	/**
 	 * blob: Added mousewheel scrolling to infopane
@@ -438,8 +438,8 @@
 
 bool XNet::handleMouseMoved(const CEGUI::EventArgs& e)
 {
-	CEGUI::MouseEventArgs * event = (CEGUI::MouseEventArgs*)&e;
-	const ::String window = ((CEGUI::WindowEventArgs*)&e)->window->getName().c_str();
+	const CEGUI::MouseEventArgs * event = (const CEGUI::MouseEventArgs*)&e;
+	const ::String window = ((const CEGUI::WindowEventArgs*)&e)->window->getName().c_str();
 	
 	if ("XNet/ModelPane" == window)
 	{
@@ -564,7 +564,7 @@
 
 bool XNet::openEntry(const CEGUI::EventArgs &e)
 {
-    openEntry(*static_cast<String*>( ( (CEGUI::WindowEventArgs*) (&e) )->window->getUserData()));
+    openEntry(*static_cast<String*>( ( (const CEGUI::WindowEventArgs*) (&e) )->window->getUserData()));
 
 	return true;
 }
Index: src/client/commonui/modaldialog.h
===================================================================
--- src/client/commonui/modaldialog.h	(revision 694)
+++ src/client/commonui/modaldialog.h	(working copy)
@@ -31,7 +31,7 @@
 #ifndef xenocide__client__commonui__modaldialog_h
 #define xenocide__client__commonui__modaldialog_h
 
-#include "ceguievent.h"
+#include "CEGUIEvent.h"
 
 namespace Xenocide
 {
@@ -59,7 +59,7 @@
     //! Caller should subscribe in order to receive notifications.
     template <class T> void subscribeToClose(Ret (T::*f)(Arg), T *target)
     {
-        closeHandler = new _memberBinder<T, Ret, Arg>(f, target);
+        closeHandler = new CEGUI::_memberBinder<T, Ret, Arg>(f, target);
     }
 
 protected:
@@ -90,4 +90,4 @@
     }
 }
 
-#endif
\ No newline at end of file
+#endif
Index: src/client/commonui/consoledialog.cpp
===================================================================
--- src/client/commonui/consoledialog.cpp	(revision 694)
+++ src/client/commonui/consoledialog.cpp	(working copy)
@@ -259,8 +259,8 @@
 
     switch(key.scancode)
     {
-    case Key::Scan::Return:
-    case Key::Scan::NumpadEnter:
+    case Key::Return:
+    case Key::NumpadEnter:
         // save and wipe out command line
         cmdLine = wnd->getText().c_str();
         wnd->setText("");
@@ -275,7 +275,7 @@
 
         break;
 
-    case Key::Scan::PageUp:
+    case Key::PageUp:
         firstLineShown -= conPageskip;
         if (firstLineShown < 0)
             firstLineShown = 0;
@@ -284,7 +284,7 @@
 
         break;
 
-    case Key::Scan::PageDown:
+    case Key::PageDown:
         firstLineShown += conPageskip;
         if ((firstLineShown + conLines) >= Console::instance().getOutputSize())
         {
@@ -296,7 +296,7 @@
 
         break;
     
-    case Key::Scan::Home:
+    case Key::Home:
         firstLineShown = 0;
         changedPosition = true;
         isAtEnd = false;
@@ -304,25 +304,25 @@
         break;
 
 
-    case Key::Scan::End:
+    case Key::End:
         firstLineShown = Console::instance().getOutputSize() - conLines;
         changedPosition = true;
         isAtEnd = true;
         break;
 
-    case Key::Scan::ArrowUp:
+    case Key::ArrowUp:
         wnd->setText(Console::instance().getPrevLine());
 		// Move the carat to the end of the string
 		static_cast<Editbox*>(wnd)->setCaratIndex( wnd->getText().length() );
         break;
 
-    case Key::Scan::ArrowDown:
+    case Key::ArrowDown:
         wnd->setText(Console::instance().getNextLine());
 		// Move the carat to the end of the string
 		static_cast<Editbox*>(wnd)->setCaratIndex( wnd->getText().length() );
         break;
 
-    case Key::Scan::Escape:
+    case Key::Escape:
         Console::instance().addText(wnd->getText().c_str());
         wnd->setText("");
         break;
Index: src/client/commonui/xnet.h
===================================================================
--- src/client/commonui/xnet.h	(revision 694)
+++ src/client/commonui/xnet.h	(working copy)
@@ -98,4 +98,4 @@
     } // namespace UI
 } // namespace Xenocide
 
-#endif xenocide__client__ui__xnet__xnetview_h
+#endif // xenocide__client__ui__xnet__xnetview_h
Index: src/client/commonui/luagui.cpp
===================================================================
--- src/client/commonui/luagui.cpp	(revision 694)
+++ src/client/commonui/luagui.cpp	(working copy)
@@ -117,7 +117,7 @@
 
         fWnd->setAlwaysOnTop(true);
 
-    } catch (::CEGUI::Exception & e) {
+    } catch (const ::CEGUI::Exception & e) {
         LOG4CXX_ERROR(logger, boost::str(boost::format("Got exception: %1%") % e.getMessage().c_str()));
     }
 
Index: src/client/commonui/luagui.h
===================================================================
--- src/client/commonui/luagui.h	(revision 694)
+++ src/client/commonui/luagui.h	(working copy)
@@ -71,7 +71,7 @@
 
 		}
 
-		template<typename T> bool operator()(T args) const
+		template<typename R> bool operator()(R args) const
 		{
             LOG4CXX_DEBUG(LuaGui::logger, "Calling FunctorWrapper");
             if (callback.is_valid() == false) {
Index: src/client/commonui/actionmapdialog.cpp
===================================================================
--- src/client/commonui/actionmapdialog.cpp	(revision 694)
+++ src/client/commonui/actionmapdialog.cpp	(working copy)
@@ -45,7 +45,7 @@
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("xenoui.ActionMapDialog"));
 
 // Singleton
-template<> ActionMapDialog* TSingleton< ActionMapDialog >::ms_Singleton = 0;
+//template<> ActionMapDialog* TSingleton< ActionMapDialog >::ms_Singleton = 0;
 
 namespace Xenocide
 {
@@ -104,7 +104,7 @@
             list->setUserColumnDraggingEnabled(false);
             list->setUserColumnSizingEnabled(false);
             list->setUserSortControlEnabled(false);
-            list->setSelectionMode(MultiColumnList::SelectionMode::RowSingle);
+            list->setSelectionMode(MultiColumnList::RowSingle);
 
             // Subscribing to lists events
             eventMap.setEventType(MultiColumnList::EventMouseDoubleClick);
@@ -123,7 +123,7 @@
         update();
 
     }
-    catch(CEGUI::Exception& e)
+    catch(const CEGUI::Exception& e)
     {
         LOG4CXX_ERROR(logger, "Error creating ActionMap dialog: " << e.getMessage().c_str());
         XENOCIDE_EXCEPT("Error creating ActionMap dialog: " << e.getMessage().c_str());
@@ -156,7 +156,7 @@
     do // eventially, unique name will be found
     {
         i++; number++;
-        setName = "userset" + boost::lexical_cast<::String, Uint>(number);
+        setName = "userset" + boost::lexical_cast< ::String, Uint>(number);
 
         if(i > 100) // if something goes wrong (and it always does) -- better leave with bang then get stuck forever.
             XENOCIDE_EXCEPT("Infinite loop emergency exit!"); // HACK: Better still to show a messagebox, but we don't have one yet :)
@@ -390,7 +390,7 @@
     void* tmp = list->getUserData();
     if(groupNames.exists(tmp))
     {   
-        group = *static_cast<::String*>(tmp);
+        group = *static_cast< ::String*>(tmp);
     }
     else
     {
@@ -400,7 +400,7 @@
     tmp = item->getUserData();
     if(actionNames.exists(tmp))
     {
-        action = *static_cast<::String*>(tmp);
+        action = *static_cast< ::String*>(tmp);
     }
     else
     {
Index: src/client/commonui/startscreen.cpp
===================================================================
--- src/client/commonui/startscreen.cpp	(revision 694)
+++ src/client/commonui/startscreen.cpp	(working copy)
@@ -74,7 +74,7 @@
 
 		UIManager::translateWindowTree(window);
 	}
-	catch(CEGUI::Exception &e)
+	catch(const CEGUI::Exception &e)
 	{
         XENOCIDE_EXCEPT("Unable to load startscreen: " << e.getMessage().c_str());
 	}
Index: src/client/geoscape/globeline.cpp
===================================================================
--- src/client/geoscape/globeline.cpp	(revision 694)
+++ src/client/geoscape/globeline.cpp	(working copy)
@@ -143,4 +143,4 @@
 
         
     } // namespace UI
-} // namespace Xenocide
\ No newline at end of file
+} // namespace Xenocide
Index: src/client/geoscape/baseviewrenderer.h
===================================================================
--- src/client/geoscape/baseviewrenderer.h	(revision 694)
+++ src/client/geoscape/baseviewrenderer.h	(working copy)
@@ -61,7 +61,7 @@
  */
 class BaseviewRendererListener : public Ogre::FrameListener
 {
-    friend BaseviewRenderer;
+    friend class BaseviewRenderer;
 
 private:
 	BaseviewRenderer* renderer;
@@ -81,8 +81,8 @@
  */
 class BaseviewRenderer : public SignalTrackable
 {
-    friend BaseviewRendererListener;
-    friend Baseview;
+    friend class BaseviewRendererListener;
+    friend class Baseview;
 
 public:
 
Index: src/client/geoscape/globeline.h
===================================================================
--- src/client/geoscape/globeline.h	(revision 694)
+++ src/client/geoscape/globeline.h	(working copy)
@@ -36,7 +36,7 @@
 // Xenocide namespaces
 using namespace Xenocide::Common;
 using namespace Xenocide::Core;
-using namespace boost;
+//using namespace boost;
 
 
 //=============================================================================
@@ -79,4 +79,4 @@
     } // namespace UI
 } // namespace Xenocide
 
-#endif // xenocide__client__ui__globeline_h
\ No newline at end of file
+#endif // xenocide__client__ui__globeline_h
Index: src/client/geoscape/baseview.cpp
===================================================================
--- src/client/geoscape/baseview.cpp	(revision 694)
+++ src/client/geoscape/baseview.cpp	(working copy)
@@ -35,7 +35,7 @@
 #include "fadingmanager.h"
 #include "audio/audiosystem.h"
 
-#include <core/gamestate/humanbase.h>
+//#include <core/gamestate/humanbase.h>
 #include <core/gamestate/gamemachine.h>
 #include <core/gamestate/technologymanager.h>
 #include <core/gamestate/player.h>
@@ -54,7 +54,7 @@
 // Logger
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("xenoui.Baseview"));
 
-template<> Baseview* TSingleton <Baseview>::ms_Singleton = 0;
+//template<> Baseview* TSingleton <Baseview>::ms_Singleton = 0;
 
 // Default constructor
 Baseview::Baseview()
@@ -86,7 +86,7 @@
 
 		UIManager::translateWindowTree(window);
     }
-    catch(CEGUI::Exception e)
+    catch(const CEGUI::Exception& e)
     {
 		XENOCIDE_EXCEPT("Unable to load basescape" << e.getMessage().c_str());
     }
@@ -191,7 +191,7 @@
 // Implements all actions on renderer window
 bool Baseview::handleMouseClickOnRenderer(const CEGUI::EventArgs &e)
 {
-	CEGUI::MouseEventArgs * event = (CEGUI::MouseEventArgs*)&e;
+	const CEGUI::MouseEventArgs * event = (const CEGUI::MouseEventArgs*)&e;
 	
 	float dx, dy;
 
@@ -205,7 +205,7 @@
 
 bool Baseview::handleMouseMoveOnRenderer(const CEGUI::EventArgs &e)
 {
-	CEGUI::MouseEventArgs * event = (CEGUI::MouseEventArgs*)&e;
+	const CEGUI::MouseEventArgs * event = (const CEGUI::MouseEventArgs*)&e;
 	
 	float dx, dy;
     dx = window->screenToWindowX(event->position.d_x);
@@ -222,7 +222,7 @@
 bool Baseview::handleAction(const EventArgs& e)
 {
     // Get name of button pressed
-	const ::String action = ((WindowEventArgs*)&e)->window->getName().c_str();
+	const ::String action = ((const WindowEventArgs*)&e)->window->getName().c_str();
 
 	if (action == "Baseview/NewFacility")
 	{
@@ -262,7 +262,7 @@
 
 bool Baseview::onFacilityListClosed(const ModalDialogReturnArgs* args)
 {
-    FacilityListReturnArgs* ret = (FacilityListReturnArgs*)args;
+    const FacilityListReturnArgs* ret = (const FacilityListReturnArgs*)args;
 
     if(ret->selectionHappened)
     {
@@ -323,7 +323,7 @@
 
 bool BaseviewFacilityTypeList::facilitySelected(const CEGUI::EventArgs &e)
 {
-    const ::String selectedFacility = ((::String*)(((WindowEventArgs*)&e)->window->getUserData()))->c_str();
+    const ::String selectedFacility = ((::String*)(((const WindowEventArgs*)&e)->window->getUserData()))->c_str();
 
     // Setting return arguments.
     FacilityListReturnArgs* args = dynamic_cast<FacilityListReturnArgs*>(arguments.get());
Index: src/client/geoscape/earthpane.cpp
===================================================================
--- src/client/geoscape/earthpane.cpp	(revision 694)
+++ src/client/geoscape/earthpane.cpp	(working copy)
@@ -129,7 +129,8 @@
     , detailLevel(EDL_MEDIUM)
 {
 	detailLevel = static_cast<EarthDetailLevel>(Settings::instance().get<Sint>("globe_detail_level"));
-    Settings::instance().registerCallback("globe_camera_offset", boost::bind(EarthPane::cameraOffsetChanged, this, _1));
+    Settings::instance().registerCallback("globe_camera_offset", 
+            boost::bind(&EarthPane::cameraOffsetChanged, this, _1));
 }
 
 //-----------------------------------------------------------
@@ -150,7 +151,7 @@
     // Get settings from lua's autoexec script
     earthYawTurnSpeed = Settings::instance().get<float>("globe_yaw_speed");
     earthPitchTurnSpeed = Settings::instance().get<float>("globe_pitch_speed");
-    cameraOffset = Settings::instance().get<::Real>("globe_camera_offset");
+    cameraOffset = Settings::instance().get< ::Real>("globe_camera_offset");
 
     try
     {
@@ -216,12 +217,12 @@
         // Get Main viewport
         viewport = XenocideApp::instance().getMainViewport();
     }
-    catch(Ogre::Exception& e)
+    catch(const Ogre::Exception& e)
     {
 		LOG4CXX_ERROR(logger, "Error initializing globe: " << e.getFullDescription());
         throw;
     }
-    catch(std::exception& e)
+    catch(const std::exception& e)
     {
 		LOG4CXX_ERROR(logger, "Error initializing globe: " << e.what());
         throw;
@@ -365,7 +366,7 @@
 //------------------------------------------------------------------------------
 bool EarthPane::handleClick(const CEGUI::EventArgs& e)
 {
-	CEGUI::Point position = ((CEGUI::MouseEventArgs*)&e)->position;
+	CEGUI::Point position = ((const CEGUI::MouseEventArgs*)&e)->position;
 
 	Ogre::Ray mouseRay = camera->getCameraToViewportRay( position.d_x/absoluteWidth, position.d_y/absoluteHeight );
 	std::pair<bool, Ogre::Real> intersect = mouseRay.intersects(Ogre::Sphere(Ogre::Vector3(0.0f,0.0f,0.0f), GLOBE_RADIUS));
@@ -377,14 +378,14 @@
 		Ogre::Radian phi = Ogre::Math::ASin(point.y);
 		Ogre::Radian theta = -Ogre::Math::ATan2(point.x , point.z);
 
-		if (((CEGUI::MouseEventArgs*)&e)->button == CEGUI::RightButton)
+		if (((const CEGUI::MouseEventArgs*)&e)->button == CEGUI::RightButton)
 		{
 			if (Settings::instance().get<Bool>("globe_rightclick_centers"))
 			{
 				centerOn(Geoposition(phi.valueRadians(), theta.valueRadians()));
 			}
 		}
-		else if(((CEGUI::MouseEventArgs*)&e)->button == CEGUI::LeftButton)
+		else if(((const CEGUI::MouseEventArgs*)&e)->button == CEGUI::LeftButton)
 		{
 			/* --- GUYVER: disabled due to refactoring
 			GlobeItemManager::instance().onClick(position.d_x/absoluteWidth, position.d_y/absoluteHeight);
Index: src/client/geoscape/earthpane.h
===================================================================
--- src/client/geoscape/earthpane.h	(revision 694)
+++ src/client/geoscape/earthpane.h	(working copy)
@@ -75,8 +75,8 @@
         EDL_HIGH = 2    // 1024x1024
     };
 
-	const static Real THETA_OFFSET;
-	const static Real GLOBE_RADIUS;
+	static const Real THETA_OFFSET;
+	static const Real GLOBE_RADIUS;
 
     EarthPane();
     ~EarthPane();
@@ -163,4 +163,4 @@
     } // namespace UI
 } // namespace Xenocide
 
-#endif
\ No newline at end of file
+#endif
Index: src/client/geoscape/planetview.cpp
===================================================================
--- src/client/geoscape/planetview.cpp	(revision 694)
+++ src/client/geoscape/planetview.cpp	(working copy)
@@ -70,7 +70,7 @@
 }
 
 // Singleton
-template<> Planetview* TSingleton<Planetview>::ms_Singleton = 0;
+//template<> Planetview* TSingleton<Planetview>::ms_Singleton = 0;
 
 //=============================================================================
 //  Namespace
@@ -158,7 +158,7 @@
 
 //		globeWheelZoomSpeedGuard = Settings::instance().registerSettingCallback("globe_wheel_zoom_speed", Settings::SettingUpdater<Real>(globeWheelZoomSpeed));
     }
-    catch(CEGUI::Exception& e)
+    catch(const CEGUI::Exception& e)
     {
         XENOCIDE_EXCEPT("Unable to load planetscape: " << e.getMessage().c_str());
     }
@@ -232,7 +232,7 @@
 //------------------------------------------------------------------------------
 bool Planetview::handleMouseDown(const CEGUI::EventArgs& e)
 {
-    CEGUI::MouseEventArgs* event = (CEGUI::MouseEventArgs*)&e;
+    const CEGUI::MouseEventArgs* event = (const CEGUI::MouseEventArgs*)&e;
 
     Window* globeView = WindowManager::getSingleton().getWindow("Planetview/EarthPane");
     if(globeView->captureInput())
@@ -243,7 +243,7 @@
 
 bool Planetview::handleMouseUp(const CEGUI::EventArgs& e)
 {
-    CEGUI::MouseEventArgs* event = (CEGUI::MouseEventArgs*)&e;
+    const CEGUI::MouseEventArgs* event = (const CEGUI::MouseEventArgs*)&e;
 
     Window* globeView = WindowManager::getSingleton().getWindow("Planetview/EarthPane");
     globeView->releaseInput();
@@ -254,7 +254,7 @@
 
 bool Planetview::handleMouseMove(const CEGUI::EventArgs& e)
 {
-    CEGUI::MouseEventArgs* event = (CEGUI::MouseEventArgs*)&e;
+    const CEGUI::MouseEventArgs* event = (const CEGUI::MouseEventArgs*)&e;
 
     if(dragging)
     {
@@ -270,7 +270,7 @@
 
 bool Planetview::handleMouseWheel(const CEGUI::EventArgs& e)
 {
-    CEGUI::MouseEventArgs* event = (CEGUI::MouseEventArgs*)&e;
+    const CEGUI::MouseEventArgs* event = (const CEGUI::MouseEventArgs*)&e;
 
     if (event->wheelChange) {
 		// At least on my computer, event->wheelChange is +- 0.12 per mouse wheel "click"
@@ -286,7 +286,7 @@
 bool Planetview::handleAction(const EventArgs& e)
 {
     // Get name of button pressed
-    const ::String action = ((WindowEventArgs*)&e)->window->getName().c_str();
+    const ::String action = ((const WindowEventArgs*)&e)->window->getName().c_str();
 
     if ("Planetview/ArrowUp" == action)
     {
@@ -401,7 +401,7 @@
 bool Planetview::getButtonDown(const CEGUI::EventArgs& e)
 {
     // Get name of button pressed
-    const ::String action = ((WindowEventArgs*)&e)->window->getName().c_str();
+    const ::String action = ((const WindowEventArgs*)&e)->window->getName().c_str();
     ButtonDown = action;
 
     return true;
@@ -422,7 +422,7 @@
         GameTime::formatTwoDigit(GameTime::instance().getDay()) + " " + GameTime::instance().getMonthString());
 
     WindowManager::getSingleton().getWindow("Planetview/Year")->setProperty("Text", 
-        lexical_cast<::String, Uint>(GameTime::instance().getYear()));
+        lexical_cast< ::String, Uint>(GameTime::instance().getYear()));
 
     WindowManager::getSingleton().getWindow("Planetview/HourMin")->setProperty("Text", 
         GameTime::formatTwoDigit(GameTime::instance().getHour())+":"+GameTime::formatTwoDigit(GameTime::instance().getMinute()));
Index: src/client/geoscape/regiondefiner.cpp
===================================================================
--- src/client/geoscape/regiondefiner.cpp	(revision 694)
+++ src/client/geoscape/regiondefiner.cpp	(working copy)
@@ -39,7 +39,7 @@
 
 	lua_State* L = Common::ScriptSystem::instance().getState();
 
-	static isRegistered = false;
+	static bool isRegistered = false;
 	if(!isRegistered)
 	{
 		isRegistered = true;
@@ -94,4 +94,4 @@
 	{
 		XENOCIDE_EXCEPT("Not currently defining a region, enable region definiton with Helpers.RegionDefiner:defineRegion()");
 	}
-}
\ No newline at end of file
+}
Index: src/client/geoscape/regiondefiner.h
===================================================================
--- src/client/geoscape/regiondefiner.h	(revision 694)
+++ src/client/geoscape/regiondefiner.h	(working copy)
@@ -48,4 +48,4 @@
 	}
 }
 
-#endif
\ No newline at end of file
+#endif
Index: src/client/geoscape/baseviewrenderer.cpp
===================================================================
--- src/client/geoscape/baseviewrenderer.cpp	(revision 694)
+++ src/client/geoscape/baseviewrenderer.cpp	(working copy)
@@ -71,15 +71,15 @@
     using namespace Ogre;
 
     // Get camera variables from settings and register callbacks
-    Settings::instance().registerSettingCallback("baseview_pivot_x", Settings::SettingUpdater<::Real>(cameraInitPivot.x));
-    Settings::instance().registerSettingCallback("baseview_pivot_y", Settings::SettingUpdater<::Real>(cameraInitPivot.y));
-    Settings::instance().registerSettingCallback("baseview_camera_x", Settings::SettingUpdater<::Real>(cameraInitPos.x));
-    Settings::instance().registerSettingCallback("baseview_camera_y", Settings::SettingUpdater<::Real>(cameraInitPos.y));
-    Settings::instance().registerSettingCallback("baseview_camera_dist", Settings::SettingUpdater<::Real>(cameraInitDist));
-    Settings::instance().registerSettingCallback("baseview_camera_offset", Settings::SettingUpdater<::Real>(cameraOffset));
+    Settings::instance().registerSettingCallback("baseview_pivot_x", Settings::SettingUpdater< ::Real>(cameraInitPivot.x));
+    Settings::instance().registerSettingCallback("baseview_pivot_y", Settings::SettingUpdater< ::Real>(cameraInitPivot.y));
+    Settings::instance().registerSettingCallback("baseview_camera_x", Settings::SettingUpdater< ::Real>(cameraInitPos.x));
+    Settings::instance().registerSettingCallback("baseview_camera_y", Settings::SettingUpdater< ::Real>(cameraInitPos.y));
+    Settings::instance().registerSettingCallback("baseview_camera_dist", Settings::SettingUpdater< ::Real>(cameraInitDist));
+    Settings::instance().registerSettingCallback("baseview_camera_offset", Settings::SettingUpdater< ::Real>(cameraOffset));
 
     boost::function<void (const ::String&)> cameraCallback = 
-        boost::bind(BaseviewRenderer::changedCamera, this, _1);
+        boost::bind(&BaseviewRenderer::changedCamera, this, _1);
     Settings::instance().registerCallback("baseview_pivot_x", cameraCallback);
     Settings::instance().registerCallback("baseview_pivot_y", cameraCallback);
     Settings::instance().registerCallback("baseview_camera_x", cameraCallback);
@@ -174,7 +174,7 @@
             facilityNode[currentFacility]->setPosition(	(FACILITY_WIDTH * currentBase->getFacility()->getXPos()) + (0.5f * FACILITY_WIDTH * currentBase->getFacility()->getXSize()) ,
                 (FACILITY_WIDTH * currentBase->getFacility()->getYPos()) + (0.5f * FACILITY_WIDTH * currentBase->getFacility()->getYSize()) ,
                 0.0f);		
-            facilityObject.push_back(assets->getModel(currentBase->getFacility()->getMeshType(), String("testFacility") + boost::lexical_cast<::String>(currentFacility),sceneMgr));
+            facilityObject.push_back(assets->getModel(currentBase->getFacility()->getMeshType(), String("testFacility") + boost::lexical_cast< ::String>(currentFacility),sceneMgr));
             facilityNode[currentFacility]->attachObject(facilityObject[currentFacility]);
             facilityNode[currentFacility]->pitch(Ogre::Degree(90));
         }
@@ -420,7 +420,7 @@
                     facilityNode[currentBase->getNumberOfFacilities() - 1]->setPosition(	(FACILITY_WIDTH * position.x) + (0.5f * FACILITY_WIDTH * widthf) ,
 																(FACILITY_WIDTH * position.y) + (0.5f * FACILITY_WIDTH * heightf) ,
 																0.0f);		
-                    facilityObject.push_back(assets->getModel(currentBase->getFacility(position.x, position.y)->getMeshType(),String("testFacility") + boost::lexical_cast<::String>(currentBase->getNumberOfFacilities() - 1),sceneMgr));
+                    facilityObject.push_back(assets->getModel(currentBase->getFacility(position.x, position.y)->getMeshType(),String("testFacility") + boost::lexical_cast< ::String>(currentBase->getNumberOfFacilities() - 1),sceneMgr));
                     facilityNode[currentBase->getNumberOfFacilities() - 1]->attachObject(facilityObject[currentBase->getNumberOfFacilities() - 1]);
                     facilityNode[currentBase->getNumberOfFacilities() - 1]->pitch(Ogre::Degree(90));
 				}
@@ -486,7 +486,8 @@
 	}
 	else
 	{
-		XENOCIDE_EXCEPT("Can't find assets for facility building pointer!");
+		XENOCIDE_EXCEPT("Can't find assets for facility building pointer! (" +
+                        facilityType + ")");
 	}
 
 	pointerNode->attachObject(pointer);
Index: src/client/geoscape/globeiconrenderer.h
===================================================================
--- src/client/geoscape/globeiconrenderer.h	(revision 694)
+++ src/client/geoscape/globeiconrenderer.h	(working copy)
@@ -84,7 +84,7 @@
 	static Real BILLBOARD_RADIUS;
 	static Real BILLBOARD_SIZE;
 	
-	const static Ogre::RenderQueueGroupID RENDER_QUEUE;
+	static const Ogre::RenderQueueGroupID RENDER_QUEUE;
 
 
 public:
Index: src/client/uimanager.cpp
===================================================================
--- src/client/uimanager.cpp	(revision 694)
+++ src/client/uimanager.cpp	(working copy)
@@ -57,7 +57,7 @@
 
 // Singleton instantiation
 // Initialize code has been left as it depends on Ogre, but cleanup code has been moved into destructor
-template<> UIManager* TSingleton <UIManager>::ms_Singleton = 0;
+//template<> UIManager* TSingleton <UIManager>::ms_Singleton = 0;
 //
 
 //==============================================================================
@@ -87,7 +87,7 @@
     {
         ceguiRenderer = new CEGUI::OgreCEGUIRenderer(window, Ogre::RENDER_QUEUE_OVERLAY, false, 0);
         ceguiScriptModule = new CEGUI::LuaScriptModule(Common::ScriptSystem::instance().getState());
-        ceguiSystem = new CEGUI::System(ceguiRenderer, ceguiScriptModule, (CEGUI::utf8*)"");
+        ceguiSystem = new CEGUI::System(ceguiRenderer, ceguiScriptModule, (const CEGUI::utf8*)"");
 
         CEGUI::Logger *logger = &CEGUI::Logger::getSingleton();
         logger->setLoggingLevel(CEGUI::Informative);
@@ -99,7 +99,7 @@
         CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
         CEGUI::System::getSingleton().setDefaultFont("Tahoma-14");
     }
-    catch (CEGUI::Exception& e)
+    catch (const CEGUI::Exception& e)
     {
         delete ceguiRenderer;
         delete ceguiScriptModule;
@@ -132,6 +132,7 @@
     // Create Baseview Singleton
     baseviewScreen.reset(new Baseview);
 
+    connectStubs();
     connectCommon();
     connectPlanetview();
     connectBaseview();
@@ -178,12 +179,53 @@
 {
     return ceguiRenderer;
 }
+//------------------------------------------------------------------------------
+void stub() {}
 
+// Set stub functions for all signals without a defined function.
+void UIManager::connectStubs()
+{
+    States::EvAbandonGame::preEvent(&stub);
+    States::EvNewGame::preEvent(&stub);
+    States::EvNewGame::onEvent(&stub);
+    States::EvShowSaveGame::onEvent(&stub);
+    States::EvHideSaveGame::onEvent(&stub);
+    States::EvShowLoadGame::onEvent(&stub);
+    States::EvLoadGame::onEvent(&stub);
+    States::EvCancelLoadGame::onEvent(&stub);
+
+    States::EvShowOptions::onEvent(&stub);
+    States::EvHideOptions::preEvent(&stub);
+    States::EvHideOptions::onEvent(&stub);
+    States::EvShowOptionsSound::onEvent(&stub);
+    States::EvHideOptionsSound::onEvent(&stub);
+    States::EvShowOptionsVideo::onEvent(&stub);
+    States::EvHideOptionsVideo::onEvent(&stub);
+    States::EvShowOptionsGameplay::onEvent(&stub);
+    States::EvHideOptionsGameplay::onEvent(&stub);
+
+    States::EvLoadedGeoscape::preEvent(&stub);
+    States::EvExitBaseview::preEvent(&stub);
+    States::EvEnterBaseview::preEvent(&stub);
+
+    States::EvShowEquipment::onEvent(&stub);
+    States::EvHideEquipment::onEvent(&stub);
+    States::EvHideXNet::preEvent(&stub);
+
+    States::EvLoadedBattle::onEvent(&stub);
+    States::EvStartBattle::onEvent(&stub);
+    States::EvEndBattle::onEvent(&stub);
+
+    States::EvToggleConsole::preEvent(&stub);
+    States::EvToggleConsole::onEvent(&stub);
+    States::EvToggleTestUI::preEvent(&stub);
+    States::EvToggleTestUI::onEvent(&stub);
+}
+
 //------------------------------------------------------------------------------
 void UIManager::connectPlanetview()
 {
     using namespace boost::assign;
-
     planetviewLink +=
         // Publishing
         States::EvLoadedGeoscape::onEvent(bind(&Planetview::publish, ui_cast<Planetview>(planetviewScreen))),
Index: src/client/mainframelistener.h
===================================================================
--- src/client/mainframelistener.h	(revision 694)
+++ src/client/mainframelistener.h	(working copy)
@@ -158,4 +158,4 @@
     } // namespace UI
 } // namespace Xenocide
 
-#endif xenocide__client__mainframelistener_h
+#endif // xenocide__client__mainframelistener_h
Index: src/client/misc/dynamiclines.cpp
===================================================================
--- src/client/misc/dynamiclines.cpp	(revision 694)
+++ src/client/misc/dynamiclines.cpp	(working copy)
@@ -1,4 +1,4 @@
-#include "DynamicLines.h"
+#include "dynamiclines.h"
 #include <Ogre.h>
 #include <cassert>
 #include <cmath>
@@ -139,4 +139,4 @@
 {
    return Vector3::ZERO;
 }
-*/
\ No newline at end of file
+*/
Index: src/client/misc/assetmapper.cpp
===================================================================
--- src/client/misc/assetmapper.cpp	(revision 694)
+++ src/client/misc/assetmapper.cpp	(working copy)
@@ -98,7 +98,7 @@
 
 }
 
-template<> AssetMapper* TSingleton<AssetMapper>::ms_Singleton = 0;
+//template<> AssetMapper* TSingleton<AssetMapper>::ms_Singleton = 0;
 
 AssetMapper::AssetMapper()
 {
Index: src/client/misc/dynamiclines.h
===================================================================
--- src/client/misc/dynamiclines.h	(revision 694)
+++ src/client/misc/dynamiclines.h	(working copy)
@@ -1,7 +1,7 @@
 #ifndef _DYNAMIC_LINES_H_
 #define _DYNAMIC_LINES_H_
 
-#include "DynamicRenderable.h"
+#include "dynamicrenderable.h"
 #include <vector>
 
 class DynamicLines : public DynamicRenderable
Index: src/client/misc/dynamicrenderable.cpp
===================================================================
--- src/client/misc/dynamicrenderable.cpp	(revision 694)
+++ src/client/misc/dynamicrenderable.cpp	(working copy)
@@ -1,4 +1,4 @@
-#include "DynamicRenderable.h"
+#include "dynamicrenderable.h"
 #include <OgreCamera.h>
 #include <OgreHardwareBufferManager.h>
 
Index: src/client/uimanager.h
===================================================================
--- src/client/uimanager.h	(revision 694)
+++ src/client/uimanager.h	(working copy)
@@ -76,6 +76,9 @@
     void connectBaseview();
     void connectCommon();
 
+    // Fixes "undefined symbols" errors with GCC
+    void connectStubs();
+
     void showXNet(const TSignal<void ()>::slot_type& slot);
     void hideXNet();
 
@@ -94,4 +97,4 @@
     } // namespace UI
 } // namespace Xenocide
 
-#endif xenocide__client__ui__uimanager_h
+#endif // xenocide__client__ui__uimanager_h
Index: src/client/audio/nullaudios.cpp
===================================================================
--- src/client/audio/nullaudios.cpp	(revision 694)
+++ src/client/audio/nullaudios.cpp	(working copy)
@@ -67,4 +67,4 @@
 bool NullAudioSystem::changeMusicVolume(float newVolume)
 {
 	return true;
-}
\ No newline at end of file
+}
Index: src/client/audio/nullaudios.h
===================================================================
--- src/client/audio/nullaudios.h	(revision 694)
+++ src/client/audio/nullaudios.h	(working copy)
@@ -55,4 +55,4 @@
 
     } // namespace UI
 } // namespace Xenocide
-#endif // xenocide__client__audio__nullaudios_h
\ No newline at end of file
+#endif // xenocide__client__audio__nullaudios_h
Index: src/client/audio/audiosystem.cpp
===================================================================
--- src/client/audio/audiosystem.cpp	(revision 694)
+++ src/client/audio/audiosystem.cpp	(working copy)
@@ -39,7 +39,7 @@
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("xenoui.Audio"));
 
 // Singleton
-template<> XenoAudio* TSingleton <XenoAudio>::ms_Singleton = 0;
+//template<> XenoAudio* TSingleton <XenoAudio>::ms_Singleton = 0;
 
 //this gives only internal linkage, so no name clashes possible
 namespace
@@ -397,7 +397,7 @@
 log4cxx::LoggerPtr AudioFactory::logger = log4cxx::Logger::getLogger(_T("xenoui.audiofacotry"));
 
 // Singleton
-template<> AudioFactory* TSingleton <AudioFactory>::ms_Singleton = 0;
+//template<> AudioFactory* TSingleton <AudioFactory>::ms_Singleton = 0;
 
 bool AudioFactory::addDevice(String name, VirtualAudioSystem *ref)
 {
Index: src/client/fadingmanager.cpp
===================================================================
--- src/client/fadingmanager.cpp	(revision 694)
+++ src/client/fadingmanager.cpp	(working copy)
@@ -3,7 +3,7 @@
 This source file is part of Xenocide Client UI Application 
 For the latest info on Xenocide, see http://www.projectxenocide.com
 
-Copyright  2003-2004 The Project Xenocide Team
+Copyright © 2003-2004 The Project Xenocide Team
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU Lesser General Public License as published by the Free Software
@@ -38,7 +38,7 @@
 // Logger
 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("xenoui.FadingManager"));
 
-template<> FadingManager* TSingleton<FadingManager>::ms_Singleton = 0;
+//template<> FadingManager* TSingleton<FadingManager>::ms_Singleton = 0;
 
 Real FadingManager::DEFAULT_FADING_TIME = 1.0;
 
Index: src/client/fadingmanager.h
===================================================================
--- src/client/fadingmanager.h	(revision 694)
+++ src/client/fadingmanager.h	(working copy)
@@ -38,8 +38,8 @@
 
 class FadingManager : public TSingleton<FadingManager>, public Ogre::FrameListener
 {
-	const static Uint TEXTURE_SIZE = 1024;
-	const static Uint TEXTURE_SIZE_SW = 512;
+	static const Uint TEXTURE_SIZE = 1024;
+	static const Uint TEXTURE_SIZE_SW = 512;
 
 public:
     // This has to be static to be allowed as default parameter further down
