Daniele Bartolini 11 年之前
父节点
当前提交
82126166d3

+ 4 - 4
engine/audio/sound_world_al.cpp

@@ -22,7 +22,7 @@
 namespace crown
 {
 
-#if defined(CROWN_DEBUG)
+#if CROWN_DEBUG
 	static const char* al_error_to_string(ALenum error)
 	{
 		switch (error)
@@ -35,13 +35,13 @@ namespace crown
 		}
 	}
 
-	#define AL_CHECK(function)\
+#	define AL_CHECK(function)\
 		function;\
 		do { ALenum error; CE_ASSERT((error = alGetError()) == AL_NO_ERROR,\
 				"OpenAL error: %s", al_error_to_string(error)); } while (0)
 #else
-	#define AL_CHECK(function) function;
-#endif
+#	define AL_CHECK(function) function;
+#endif // CROWN_DEBUG
 
 /// Global audio-related functions
 namespace audio_globals

+ 2 - 2
engine/audio/sound_world_sles.cpp

@@ -21,7 +21,7 @@
 namespace crown
 {
 
-#if defined(CROWN_DEBUG)
+#if CROWN_DEBUG
 	static const char* sles_error_to_string(SLresult result)
 	{
 		switch (result)
@@ -47,7 +47,7 @@ namespace crown
 				CE_ASSERT(result == SL_RESULT_SUCCESS, "OpenSL|ES error: %s", sles_error_to_string(result)); } while (0)
 #else
 	#define SL_CHECK(function) function;
-#endif
+#endif // CROWN_DEBUG
 
 namespace audio_globals
 {

+ 4 - 0
engine/config.h

@@ -9,6 +9,10 @@
 
 #include "platform.h"
 
+#ifndef CROWN_DEBUG
+#	define CROWN_DEBUG 0
+#endif // CROWN_DEBUG
+
 #if !defined(CROWN_SOUND_OPENAL) \
 	&& !defined(CROWN_SOUND_OPENSLES)\
 	&& !defined(CROWN_SOUND_NULL)

+ 2 - 2
engine/console_server.cpp

@@ -230,9 +230,9 @@ namespace console_server_globals
 
 	void update()
 	{
-#if defined(CROWN_DEBUG)
+#if CROWN_DEBUG
 		_console->update();
-#endif // defined(CROWN_DEBUG)
+#endif // CROWN_DEBUG
 	}
 
 	ConsoleServer& console()

+ 1 - 1
engine/core/containers/container_types.h

@@ -158,7 +158,7 @@ struct SortMap
 	};
 
 	Array<Entry> _data;
-#ifdef CROWN_DEBUG
+#if CROWN_DEBUG
 	bool _is_sorted;
 #endif
 };

+ 5 - 5
engine/core/containers/sort_map.h

@@ -121,7 +121,7 @@ namespace sort_map
 	{
 		std::sort(array::begin(m._data), array::end(m._data),
 			sort_map_internal::CompareEntry<TKey, TValue, Compare>());
-#ifdef CROWN_DEBUG
+#if CROWN_DEBUG
 		m._is_sorted = true;
 #endif // CROWN_DEBUG
 	}
@@ -142,7 +142,7 @@ namespace sort_map
 		{
 			m._data[result.item_i].value = val;
 		}
-#ifdef CROWN_DEBUG
+#if CROWN_DEBUG
 		m._is_sorted = false;
 #endif // CROWN_DEBUG
 	}
@@ -160,7 +160,7 @@ namespace sort_map
 			m._data[result.item_i] = m._data[array::size(m._data) - 1];
 			array::pop_back(m._data);
 		}
-#ifdef CROWN_DEBUG
+#if CROWN_DEBUG
 		m._is_sorted = false;
 #endif // CROWN_DEBUG
 	}
@@ -169,7 +169,7 @@ namespace sort_map
 	inline void clear(SortMap<TKey, TValue, Compare>& m)
 	{
 		array::clear(m._data);
-#ifdef CROWN_DEBUG
+#if CROWN_DEBUG
 		m._is_sorted = true;
 #endif // CROWN_DEBUG
 	}
@@ -190,7 +190,7 @@ namespace sort_map
 template <typename TKey, typename TValue, typename Compare>
 inline SortMap<TKey, TValue, Compare>::SortMap(Allocator& a)
 	: _data(a)
-#ifdef CROWN_DEBUG
+#if CROWN_DEBUG
 	, _is_sorted(true)
 #endif // CROWN_DEBUG
 {

+ 2 - 2
engine/core/error.h

@@ -15,12 +15,12 @@ namespace error
 } // namespace error
 } // namespace crown
 
-#if defined(CROWN_DEBUG)
+#if CROWN_DEBUG
 	#define CE_ASSERT(condition, msg, ...) do { if (!(condition)) {\
 		crown::error::abort(__FILE__, __LINE__, "\nAssertion failed: %s\n\t" msg "\n", #condition, ##__VA_ARGS__); }} while (0)
 #else
 	#define CE_ASSERT(...) ((void)0)
-#endif
+#endif // CROWN_DEBUG
 
 #define CE_ASSERT_NOT_NULL(x) CE_ASSERT(x != NULL, #x " must be not null")
 #define CE_FATAL(msg) CE_ASSERT(false, msg)

+ 2 - 2
engine/core/log.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#if defined(CROWN_DEBUG)
+#if CROWN_DEBUG
 
 #include "console_server.h"
 #include "string_utils.h"
@@ -45,4 +45,4 @@ namespace log_internal
 	#define CE_LOGD(msg, ...) ((void)0)
 	#define CE_LOGE(msg, ...) ((void)0)
 	#define CE_LOGW(msg, ...) ((void)0)
-#endif // defined(CROWN_DEBUG)
+#endif // CROWN_DEBUG

+ 2 - 2
engine/core/profiler.h

@@ -80,7 +80,7 @@ namespace profiler_globals
 } // namespace profiler_globals
 } // namespace crown
 
-#ifdef CROWN_DEBUG
+#if CROWN_DEBUG
 	#define ENTER_PROFILE_SCOPE(name) profiler::enter_profile_scope(name)
 	#define LEAVE_PROFILE_SCOPE() profiler::leave_profile_scope(name)
 	#define RECORD_FLOAT(name, value) profiler::record_float(name, value)
@@ -94,4 +94,4 @@ namespace profiler_globals
 	#define RECORD_VECTOR3(name, value) ((void)0)
 	#define ALLOCATE_MEMORY(name, size) ((void)0)
 	#define DEALLOCATE_MEMORY(name, size) ((void)0)
-#endif
+#endif // CROWN_DEBUG

+ 2 - 2
engine/lua/lua_assert.h

@@ -8,9 +8,9 @@
 #include "config.h"
 #include "lua.hpp"
 
-#if defined(CROWN_DEBUG)
+#if CROWN_DEBUG
 	#define LUA_ASSERT(condition, stack, msg, ...) do { if (!(condition)) {\
 		stack.push_fstring("\nLua assertion failed: %s\n\t" msg "\n", #condition, ##__VA_ARGS__); lua_error(stack.state()); }} while (0);
 #else
 	#define LUA_ASSERT(...) ((void)0)
-#endif
+#endif // CROWN_DEBUG

+ 2 - 2
engine/lua/lua_stack.h

@@ -15,7 +15,7 @@
 #include "color4.h"
 #include "lua.hpp"
 
-#if defined(CROWN_DEBUG)
+#if CROWN_DEBUG
 	static void* checkudata(lua_State* L, int index, const char* expected)
 	{
 		luaL_checktype(L, index, LUA_TUSERDATA);
@@ -48,7 +48,7 @@
 	#define CHECKINTEGER(stack, index) lua_tointeger(stack, index)
 	#define CHECKNUMBER(stack, index) lua_tonumber(stack, index)
 	#define CHECKSTRING(stack, index) lua_tostring(stack, index)
-#endif
+#endif // CROWN_DEBUG
 
 namespace crown
 {

+ 1 - 1
engine/physics/physics_world.cpp

@@ -237,7 +237,7 @@ PhysicsWorld::PhysicsWorld(World& world)
 
 	m_resource = (PhysicsConfigResource*) device()->resource_manager()->get("physics_config", "global");
 
-#if defined(CROWN_DEBUG)
+#if CROWN_DEBUG
 	m_scene->setVisualizationParameter(PxVisualizationParameter::eSCALE, 1);
 	m_scene->setVisualizationParameter(PxVisualizationParameter::eACTOR_AXES, 1);
 	m_scene->setVisualizationParameter(PxVisualizationParameter::eCOLLISION_SHAPES, 1);

+ 2 - 2
engine/resource/lua_resource.cpp

@@ -13,11 +13,11 @@
 #include "array.h"
 #include "compile_options.h"
 
-#if defined(CROWN_DEBUG)
+#if CROWN_DEBUG
 	#define LUAJIT_FLAGS "-bg" // Keep debug info
 #else
 	#define LUAJIT_FLAGS "-b"
-#endif
+#endif // CROWN_DEBUG
 
 namespace crown
 {

+ 1 - 1
genie/crown.lua

@@ -114,7 +114,7 @@ function crown_project(_name, _kind, _defines)
 			}
 			defines {
 				"_DEBUG",
-				"CROWN_DEBUG"
+				"CROWN_DEBUG=1"
 			}
 
 		configuration { "release" }