Index: trunk/src/core/string.cc
===================================================================
--- trunk/src/core/string.cc	(revision 365)
+++ trunk/src/core/string.cc	(revision 367)
@@ -66,5 +66,4 @@
 		n /= 10;
 	} while ( n > 0 );
-	if ( n < 0 ) *s++ = '-';
 	*s = '\0';
 	string_reverse( str, s - 1 );
@@ -80,5 +79,4 @@
 		n /= 10;
 	} while ( n > 0 );
-	if ( n < 0 ) *s++ = '-';
 	*s = '\0';
 	string_reverse( str, s - 1 );
@@ -91,5 +89,5 @@
 	sprintf_s( str, 64, "%.*g", 6, n );
 #else
-	snprintf( buffer, 64, "%.*g", 6, n );
+	snprintf( str, 64, "%.*g", 6, n );
 #endif
 	sprintf( str, "%g", n );
@@ -102,5 +100,5 @@
 	sprintf_s( str, 64, "%.*g", 6, n );
 #else
-	snprintf( buffer, 64, "%.*g", 6, n );
+	snprintf( str, 64, "%.*g", 6, n );
 #endif
 	return strlen( str );
Index: trunk/src/formats/assimp_loader.cc
===================================================================
--- trunk/src/formats/assimp_loader.cc	(revision 365)
+++ trunk/src/formats/assimp_loader.cc	(revision 367)
@@ -7,5 +7,4 @@
 #include "nv/formats/assimp_loader.hh"
 #include <unordered_map>
-#include <glm/gtx/transform.hpp>
 #include "nv/io/std_stream.hh"
 #include "nv/gfx/mesh_creator.hh"
Index: trunk/src/formats/md2_loader.cc
===================================================================
--- trunk/src/formats/md2_loader.cc	(revision 365)
+++ trunk/src/formats/md2_loader.cc	(revision 367)
@@ -7,5 +7,4 @@
 #include "nv/formats/md2_loader.hh"
 
-#include <glm/gtc/constants.hpp>
 #include "nv/core/logging.hh"
 #include <cstring>
Index: trunk/src/formats/md3_loader.cc
===================================================================
--- trunk/src/formats/md3_loader.cc	(revision 365)
+++ trunk/src/formats/md3_loader.cc	(revision 367)
@@ -7,5 +7,4 @@
 #include "nv/formats/md3_loader.hh"
 
-#include <glm/gtc/constants.hpp>
 #include "nv/core/logging.hh"
 #include <cstring>
Index: trunk/src/formats/md5_loader.cc
===================================================================
--- trunk/src/formats/md5_loader.cc	(revision 365)
+++ trunk/src/formats/md5_loader.cc	(revision 367)
@@ -5,8 +5,6 @@
 #include "nv/formats/md5_loader.hh"
 
-#include <glm/gtc/constants.hpp>
 #include "nv/core/logging.hh"
 #include "nv/io/std_stream.hh"
-#include <cstring>
 
 using namespace nv;
@@ -14,10 +12,9 @@
 static void next_line( std::istream& stream )
 {
-	stream.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
+	stream.ignore( 1024*1024, '\n' );
 }
 
 static inline void discard( std::istream& stream, const std::string& token )
 {
-//	stream.ignore( std::numeric_limits<std::streamsize>::max(), ' ' );
 	std::string discarded;
 	stream >> discarded;
Index: trunk/src/gfx/keyframed_mesh.cc
===================================================================
--- trunk/src/gfx/keyframed_mesh.cc	(revision 365)
+++ trunk/src/gfx/keyframed_mesh.cc	(revision 367)
@@ -5,10 +5,6 @@
 #include "nv/gfx/keyframed_mesh.hh"
 
-#include <glm/gtc/matrix_access.hpp>
-#include <glm/gtx/matrix_interpolation.hpp>
 #include "nv/interface/context.hh"
 #include "nv/interface/device.hh"
-
-
 #include "nv/core/logging.hh"
 
Index: trunk/src/gfx/skeletal_mesh.cc
===================================================================
--- trunk/src/gfx/skeletal_mesh.cc	(revision 365)
+++ trunk/src/gfx/skeletal_mesh.cc	(revision 367)
@@ -5,9 +5,6 @@
 #include "nv/gfx/skeletal_mesh.hh"
 
-#include <glm/gtc/matrix_access.hpp>
-#include <glm/gtx/matrix_interpolation.hpp>
 #include "nv/interface/context.hh"
 #include "nv/interface/device.hh"
-
 
 nv::skeletal_mesh_cpu::skeletal_mesh_cpu( context* a_context, const mesh_data* a_mesh_data, const mesh_nodes_data* bones )
Index: trunk/src/gfx/texture_atlas.cc
===================================================================
--- trunk/src/gfx/texture_atlas.cc	(revision 365)
+++ trunk/src/gfx/texture_atlas.cc	(revision 367)
@@ -8,5 +8,4 @@
 
 #include "nv/core/logging.hh"
-#include <iostream>
 
 using namespace nv;
Index: trunk/src/gfx/texture_font.cc
===================================================================
--- trunk/src/gfx/texture_font.cc	(revision 365)
+++ trunk/src/gfx/texture_font.cc	(revision 367)
@@ -6,6 +6,4 @@
 #include "nv/gfx/texture_font.hh"
 
-#include <sstream>
-#include <stdexcept>
 #include "nv/lib/freetype2.hh"
 #include "nv/core/logging.hh"
@@ -126,8 +124,6 @@
 		if ( error )
 		{
-			std::stringstream error_msg;
-			error_msg << "FT_Error while loading glyphs, error: "
-				<< error << " code: " << c; 
-			NV_THROW( std::runtime_error, error_msg.str().c_str() );
+			NV_LOG_ERROR( "FT_Error while loading glyphs, error: ", error, " code: ", c );
+			NV_THROW( std::runtime_error, "FT_Error while loading glyphs" );
 		}
 
@@ -144,9 +140,6 @@
 		if ( r.pos.x < 0 ) 
 		{
-			std::stringstream error_msg;
-			error_msg << "Atlas full while loading glyphs, "
-				<< "r.pos.x: " << r.pos.x << " code: "
-				<< c; 
-			NV_THROW( std::runtime_error, error_msg.str().c_str() );
+			NV_LOG_ERROR( "Atlas full while loading glyphs, r.pos.x: ", r.pos.x, " code: ", c );
+			NV_THROW( std::runtime_error, "Atlas full while loading glyphs" );
 		}
 		if (depth == 4)
Index: trunk/src/gui/gui_gfx_renderer.cc
===================================================================
--- trunk/src/gui/gui_gfx_renderer.cc	(revision 365)
+++ trunk/src/gui/gui_gfx_renderer.cc	(revision 367)
@@ -6,6 +6,4 @@
 
 #include "nv/gui/gui_gfx_renderer.hh"
-
-#include <glm/gtc/matrix_transform.hpp>
 
 #include "nv/interface/device.hh"
Index: trunk/src/lua/lua_aux.cc
===================================================================
--- trunk/src/lua/lua_aux.cc	(revision 365)
+++ trunk/src/lua/lua_aux.cc	(revision 367)
@@ -7,5 +7,4 @@
 #include "nv/lua/lua_aux.hh"
 
-#include <utility>
 #include "nv/lua/lua_raw.hh"
 #include "nv/core/random.hh"
@@ -117,6 +116,6 @@
 			int arg1 = static_cast< int >( luaL_checkinteger( L, 1 ) );
 			int arg2 = static_cast< int >( luaL_checkinteger( L, 2 ) );
-			if (arg2 < arg1) std::swap( arg2, arg1 );
-			lua_pushinteger( L, nv::random::get().srange( arg1, arg2 ) );
+			int result = ( arg2 >= arg1 ? nv::random::get().srange( arg1, arg2 ) : nv::random::get().srange( arg2, arg1 ) );
+			lua_pushinteger( L, result );
 		}
 	}
Index: trunk/src/lua/lua_state.cc
===================================================================
--- trunk/src/lua/lua_state.cc	(revision 365)
+++ trunk/src/lua/lua_state.cc	(revision 367)
@@ -356,12 +356,4 @@
 }
 
-int lua::state::load_stream( std::istream& stream, string_ref name )
-{
-	NV_LOG_NOTICE( "Loading Lua stream '", name, "'");
-	return load_string( std::string(
-		(std::istreambuf_iterator<char>(stream)),
-		std::istreambuf_iterator<char>()), name );
-}
-
 int lua::state::load_file( string_ref filename )
 {
@@ -380,16 +372,4 @@
 	}
 	return do_current( name, rvalues ) == 0;
-}
-
-bool lua::state::do_stream( std::istream& stream, string_ref name )
-{
-	lua::stack_guard( this );
-	int result = load_stream(stream,name);
-	if (result)
-	{
-		NV_LOG_WARNING( "Failed to open stream ", name, ": ", lua_tostring( m_state, -1 ) );
-		return false;
-	}
-	return do_current( name ) == 0;
 }
 
Index: trunk/src/sdl/sdl_audio.cc
===================================================================
--- trunk/src/sdl/sdl_audio.cc	(revision 365)
+++ trunk/src/sdl/sdl_audio.cc	(revision 367)
@@ -7,6 +7,5 @@
 #include "nv/sdl/sdl_audio.hh"
 
-#include <glm/gtx/vector_angle.hpp>
-#include "nv/lib/sdl.hh"
+#include "nv/core/math.hh"
 #include "nv/lib/sdl_mixer.hh"
 #include "nv/core/logging.hh"
Index: trunk/src/sdl/sdl_window.cc
===================================================================
--- trunk/src/sdl/sdl_window.cc	(revision 365)
+++ trunk/src/sdl/sdl_window.cc	(revision 367)
@@ -9,4 +9,5 @@
 #include "nv/lib/sdl.hh"
 #include "nv/sdl/sdl_input.hh"
+#include "nv/gl/gl_context.hh"
 
 using namespace nv;
