Daniele Bartolini 7 лет назад
Родитель
Сommit
a90fea2bdc

+ 1 - 1
src/core/error/error.cpp

@@ -11,7 +11,7 @@
 #include <stdarg.h>
 #include <stdlib.h> // exit
 
-namespace { const crown::log_internal::System ERROR = { "Error" }; }
+namespace { const crown::log_internal::System ERROR = { "error" }; }
 
 namespace crown
 {

+ 1 - 1
src/device/device.cpp

@@ -59,7 +59,7 @@
 
 #define MAX_SUBSYSTEMS_HEAP 8 * 1024 * 1024
 
-namespace { const crown::log_internal::System DEVICE = { "Device" }; }
+namespace { const crown::log_internal::System DEVICE = { "device" }; }
 
 namespace crown
 {

+ 1 - 1
src/lua/lua_environment.cpp

@@ -13,7 +13,7 @@
 #include "resource/resource_manager.h"
 #include <stdarg.h>
 
-namespace { const crown::log_internal::System LUA = { "Lua" }; }
+namespace { const crown::log_internal::System LUA = { "lua" }; }
 
 namespace crown
 {

+ 2 - 2
src/resource/compile_options.h

@@ -22,7 +22,7 @@
 #define DATA_COMPILER_ASSERT_RESOURCE_EXISTS(type, name, opts) \
 	DATA_COMPILER_ASSERT(opts.resource_exists(type, name)      \
 		, opts                                                 \
-		, "Resource does not exist: '%s.%s'"                   \
+		, "Resource not found: '%s.%s'"                        \
 		, name                                                 \
 		, type                                                 \
 		)
@@ -30,7 +30,7 @@
 #define DATA_COMPILER_ASSERT_FILE_EXISTS(name, opts) \
 	DATA_COMPILER_ASSERT(opts.file_exists(name)      \
 		, opts                                       \
-		, "File does not exist: '%s'"                \
+		, "File not found: '%s'"                     \
 		, name                                       \
 		)
 

+ 19 - 24
src/resource/data_compiler.cpp

@@ -38,7 +38,7 @@
 #include "resource/types.h"
 #include "resource/unit_resource.h"
 
-namespace { const crown::log_internal::System COMPILER = { "Compiler" }; }
+namespace { const crown::log_internal::System DATA_COMPILER = { "data_compiler" }; }
 
 namespace crown
 {
@@ -89,14 +89,8 @@ static void console_command_compile(ConsoleServer& cs, TCPSocket client, const c
 		cs.send(client, string_stream::c_str(ss));
 	}
 
-	logi(COMPILER, "Compiling '%s'", id.c_str());
 	bool succ = ((DataCompiler*)user_data)->compile(data_dir.c_str(), platform.c_str());
 
-	if (succ)
-		logi(COMPILER, "Compiled '%s'", id.c_str());
-	else
-		loge(COMPILER, "Failed to compile '%s'", id.c_str());
-
 	{
 		TempAllocator512 ta;
 		StringStream ss(ta);
@@ -367,12 +361,12 @@ bool DataCompiler::compile(const char* data_dir, const char* platform)
 
 		path::join(path, CROWN_DATA_DIRECTORY, dst_path.c_str());
 
-		logi(COMPILER, "%s", src_path.c_str());
+		logi(DATA_COMPILER, "%s", src_path.c_str());
 
 		if (!can_compile(_type))
 		{
-			loge(COMPILER, "Unknown resource type: '%s'", type);
-			loge(COMPILER, "Append extension to " CROWN_DATAIGNORE " to ignore the type");
+			loge(DATA_COMPILER, "Unknown resource type: '%s'", type);
+			loge(DATA_COMPILER, "Append extension to " CROWN_DATAIGNORE " to ignore the type");
 			success = false;
 			break;
 		}
@@ -400,33 +394,34 @@ bool DataCompiler::compile(const char* data_dir, const char* platform)
 
 		if (!success)
 		{
-			loge(COMPILER, "Error");
+			loge(DATA_COMPILER, "Failed to compile data");
 			break;
 		}
 		else
 		{
+			loge(DATA_COMPILER, "Data compiled");
 			if (!map::has(_data_index, dst_path))
 				map::set(_data_index, dst_path, src_path);
 		}
 	}
 
-	// Write index
+	// Write data index
 	{
 		File* file = data_filesystem.open("data_index.sjson", FileOpenMode::WRITE);
-		if (!file)
-			return false;
+		if (file)
+		{
+			StringStream ss(default_allocator());
 
-		StringStream ss(default_allocator());
+			auto cur = map::begin(_data_index);
+			auto end = map::end(_data_index);
+			for (; cur != end; ++cur)
+			{
+				ss << "\"" << cur->pair.first.c_str() << "\" = \"" << cur->pair.second.c_str() << "\"\n";
+			}
 
-		auto cur = map::begin(_data_index);
-		auto end = map::end(_data_index);
-		for (; cur != end; ++cur)
-		{
-			ss << "\"" << cur->pair.first.c_str() << "\" = \"" << cur->pair.second.c_str() << "\"\n";
+			file->write(string_stream::c_str(ss), strlen32(string_stream::c_str(ss)));
+			data_filesystem.close(*file);
 		}
-
-		file->write(string_stream::c_str(ss), strlen32(string_stream::c_str(ss)));
-		data_filesystem.close(*file);
 	}
 
 	return success;
@@ -460,7 +455,7 @@ bool DataCompiler::can_compile(StringId64 type)
 
 void DataCompiler::error(const char* msg, va_list args)
 {
-	logev(COMPILER, msg, args);
+	logev(DATA_COMPILER, msg, args);
 	longjmp(_jmpbuf, 1);
 }
 

+ 1 - 1
src/resource/resource_loader.cpp

@@ -16,7 +16,7 @@
 #include "device/log.h"
 #include "resource/resource_loader.h"
 
-namespace { const crown::log_internal::System RESOURCE_LOADER = { "ResourceLoader" }; }
+namespace { const crown::log_internal::System RESOURCE_LOADER = { "resource_loader" }; }
 
 namespace crown
 {

+ 1 - 1
src/world/physics_world_bullet.cpp

@@ -46,7 +46,7 @@
 #include <LinearMath/btDefaultMotionState.h>
 #include <LinearMath/btIDebugDraw.h>
 
-namespace { const crown::log_internal::System PHYSICS = { "Physics" }; }
+namespace { const crown::log_internal::System PHYSICS = { "physics" }; }
 
 namespace crown
 {

+ 1 - 1
src/world/sound_world_al.cpp

@@ -18,7 +18,7 @@
 #include <AL/al.h>
 #include <AL/alc.h>
 
-namespace { const crown::log_internal::System SOUND = { "Sound" }; }
+namespace { const crown::log_internal::System SOUND = { "sound" }; }
 
 namespace crown
 {