Skip to content

Commit

Permalink
Throw away some macro redefinition warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
intorr committed Dec 31, 2017
1 parent 4bd0e3e commit fc17faa
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 139 deletions.
33 changes: 3 additions & 30 deletions src/utils/xrAI/StdAfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,8 @@ extern CThreadManager::ReportProgressFunc ProxyProgress;
#include "xrServerEntities/smart_cast.h"
#endif

// Used in:
// src\xrServerEntities\xrServer_Objects_ALife_Items.cpp
// src\xrServerEntities\xrServer_Objects_ALife_Monsters.cpp
#define READ_IF_EXISTS(ltx, method, section, name, default_value)\
(ltx->line_exist(section, name)) ? ltx->method(section, name) : default_value

#if XRAY_EXCEPTIONS
IC xr_string string2xr_string(LPCSTR s) { return s ? s : ""; }
#define THROW(xpr)\
if (!(xpr))\
{\
throw __FILE__LINE__ "\"" #xpr "\"";\
}
#define THROW2(xpr, msg0)\
if (!(xpr))\
{\
throw *shared_str(\
xr_string(__FILE__LINE__).append(" \"").append(#xpr).append(string2xr_string(msg0)).c_str());\
}
#define THROW3(xpr, msg0, msg1)\
if (!(xpr))\
{\
throw *shared_str(xr_string(__FILE__LINE__)\
.append(" \"")\
.append(#xpr)\
.append(string2xr_string(msg0))\
.append(", ")\
.append(string2xr_string(msg1))\
.c_str());\
}
#else
#define THROW VERIFY
#define THROW2 VERIFY2
#define THROW3 VERIFY3
#endif
2 changes: 0 additions & 2 deletions src/utils/xrAI/xr_graph_merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,6 @@ CGraphMerger::CGraphMerger(LPCSTR game_graph_id, LPCSTR name, bool rebuild)
Logger.Phase("Processing level graphs");

CInifile* Ini = new CInifile(INI_FILE);
if (!Ini->section_exist("levels"))
THROW(false);
R_ASSERT(Ini->section_exist("levels"));

tGraphHeader.m_guid = generate_guid();
Expand Down
34 changes: 1 addition & 33 deletions src/utils/xrDO_Light/StdAfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "utils/xrLCUtil/ILevelCompilerLogger.hpp"
#include "utils/xrLCUtil/xrThread.hpp"
#include "xrCore/cdecl_cast.hpp"
#include "xrScriptEngine/DebugMacros.hpp" // XXX: move debug macros to xrCore

extern ILevelCompilerLogger& Logger;
extern CThread::LogFunc ProxyMsg;
Expand All @@ -37,36 +38,3 @@ extern CThreadManager::ReportProgressFunc ProxyProgress;

#define READ_IF_EXISTS(ltx, method, section, name, default_value)\
(ltx->line_exist(section, name)) ? ltx->method(section, name) : default_value

#undef THROW

#if XRAY_EXCEPTIONS
IC xr_string string2xr_string(LPCSTR s) { return s ? s : ""; }
#define THROW(xpr)\
if (!(xpr))\
{\
throw __FILE__LINE__ "\"" #xpr "\"";\
}
#define THROW2(xpr, msg0)\
if (!(xpr))\
{\
throw xr_string(__FILE__LINE__).append(" \"").append(#xpr).append(string2xr_string(msg0));\
}
#define THROW3(xpr, msg0, msg1)\
if (!(xpr))\
{\
throw xr_string(__FILE__LINE__)\
.append(" \"")\
.append(#xpr)\
.append(string2xr_string(msg0))\
.append(", ")\
.append(string2xr_string(msg1));\
}
#else
#define THROW VERIFY
#define THROW2 VERIFY2
#define THROW3 VERIFY3
#endif

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
31 changes: 1 addition & 30 deletions src/utils/xrSE_Factory/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "Common/Common.hpp"
#include "xrCore/xrCore.h"
#include "xrScriptEngine/xrScriptEngine.hpp"
#include "xrScriptEngine/DebugMacros.hpp" // XXX: move debug macros to xrCore
#include "xrCDB/xrCDB.h"
#include "xrCore/_fbox.h"
#include "xrCore/_quaternion.h"
Expand All @@ -27,33 +28,3 @@

#define READ_IF_EXISTS(ltx, method, section, name, default_value)\
(ltx->line_exist(section, name)) ? ltx->method(section, name) : default_value

#if XRAY_EXCEPTIONS
IC xr_string string2xr_string(LPCSTR s) { return s ? s : ""; }
#define THROW(xpr)\
if (!(xpr))\
{\
throw __FILE__LINE__ "\"" #xpr "\"";\
}
#define THROW2(xpr, msg0)\
if (!(xpr))\
{\
throw *shared_str(\
xr_string(__FILE__LINE__).append(" \"").append(#xpr).append(string2xr_string(msg0)).c_str());\
}
#define THROW3(xpr, msg0, msg1)\
if (!(xpr))\
{\
throw *shared_str(xr_string(__FILE__LINE__)\
.append(" \"")\
.append(#xpr)\
.append(string2xr_string(msg0))\
.append(", ")\
.append(string2xr_string(msg1))\
.c_str());\
}
#else
#define THROW VERIFY
#define THROW2 VERIFY2
#define THROW3 VERIFY3
#endif
1 change: 1 addition & 0 deletions src/xrAICore/Navigation/a_star.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "xrAICore/Navigation/vertex_path.h"
#include "xrAICore/Navigation/data_storage_constructor.h"
#include "xrAICore/Navigation/dijkstra.h"
#include "xrScriptEngine/DebugMacros.hpp" // XXX: move debug macros to xrCore

template <typename TDistance, typename TVertexData>
struct AStarVertexData
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/GameObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "xrServer_Space.h"
#include "alife_space.h"
#include "xrScriptEngine/script_space_forward.hpp"
#include "xrScriptEngine/DebugMacros.hpp" // XXX: move debug macros to xrCore
#include "script_binder.h"
#include "Hit.h"
#include "game_object_space.h"
Expand Down
44 changes: 0 additions & 44 deletions src/xrGame/StdAfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,8 @@

#include "Common/Common.hpp"

#pragma warning(push)
#pragma warning(disable : 4995)
#include "xrEngine/stdafx.h"
#include "DPlay/dplay8.h"
#pragma warning(pop)

#pragma warning(4 : 4018)
#pragma warning(4 : 4244)
#pragma warning(disable : 4505)

#if XRAY_EXCEPTIONS
#define THROW(expr) \
do \
{ \
if (!(expr)) \
{ \
string4096 assertion_info; \
xrDebug::GatherInfo(assertion_info, DEBUG_INFO, #expr, 0, 0, 0); \
throw assertion_info; \
} \
} while (0)
#define THROW2(expr, msg0) \
do \
{ \
if (!(expr)) \
{ \
string4096 assertion_info; \
xrDebug::GatherInfo(assertion_info, DEBUG_INFO, #expr, msg0, 0, 0); \
throw assertion_info; \
} \
} while (0)
#define THROW3(expr, msg0, msg1) \
do \
{ \
if (!(expr)) \
{ \
string4096 assertion_info; \
xrDebug::GatherInfo(assertion_info, DEBUG_INFO, #expr, msg0, msg1, 0); \
throw assertion_info; \
} \
} while (0)
#else
#define THROW VERIFY
#define THROW2 VERIFY2
#define THROW3 VERIFY3
#endif

#pragma region
#include "xrEngine/gamefont.h"
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/alife_level_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "safe_map_iterator.h"
#include "xrServer_Objects_ALife.h"
#include "xrAICore/Navigation/game_graph.h"
#include "xrScriptEngine/DebugMacros.hpp" // XXX: move debug macros to xrCore
#include "ai_debug.h"

//#define FULL_LEVEL_UPDATE
Expand Down

0 comments on commit fc17faa

Please sign in to comment.