Skip to content

Commit cf1c617

Browse files
committed
Moved all log-related stuff to stdafx.
1 parent 5d4b21a commit cf1c617

File tree

11 files changed

+71
-113
lines changed

11 files changed

+71
-113
lines changed

src/utils/xrAI/StdAfx.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
11
#include "stdafx.h"
2+
#include "xrCore/cdecl_cast.hpp"
3+
#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"
4+
5+
ILevelCompilerLogger& Logger = LevelCompilerLoggerWindow::instance();
6+
7+
CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
8+
va_list args;
9+
va_start(args, format);
10+
Logger.clMsgV(format, args);
11+
va_end(args);
12+
});
13+
14+
CThreadManager::ReportStatusFunc ProxyStatus = cdecl_cast([](const char* format, ...) {
15+
va_list args;
16+
va_start(args, format);
17+
Logger.StatusV(format, args);
18+
va_end(args);
19+
});
20+
21+
CThreadManager::ReportProgressFunc ProxyProgress = cdecl_cast([](float progress) { Logger.Progress(progress); });

src/utils/xrAI/StdAfx.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#include <d3dx9.h>
1111
#include "Common/_d3d_extensions.h"
1212

13-
#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"
13+
#include "utils/xrLCUtil/ILevelCompilerLogger.hpp"
1414
#include "utils/xrLCUtil/xrThread.hpp"
1515

16-
extern LevelCompilerLoggerWindow& Logger;
16+
extern ILevelCompilerLogger& Logger;
1717
extern CThread::LogFunc ProxyMsg;
1818
extern CThreadManager::ReportStatusFunc ProxyStatus;
1919
extern CThreadManager::ReportProgressFunc ProxyProgress;

src/utils/xrAI/xrAI.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,13 @@
99

1010
#pragma comment(lib, "winmm.LIB")
1111

12-
#include "xrCore/cdecl_cast.hpp"
1312
#include "xrCore/ModuleLookup.hpp"
1413

1514
#include "factory_api.h"
1615

1716
Factory_Create* create_entity = 0;
1817
Factory_Destroy* destroy_entity = 0;
1918

20-
LevelCompilerLoggerWindow& Logger = LevelCompilerLoggerWindow::instance();
21-
22-
CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
23-
va_list args;
24-
va_start(args, format);
25-
Logger.clMsgV(format, args);
26-
va_end(args);
27-
});
28-
29-
CThreadManager::ReportStatusFunc ProxyStatus = cdecl_cast([](const char* format, ...) {
30-
va_list args;
31-
va_start(args, format);
32-
Logger.StatusV(format, args);
33-
va_end(args);
34-
});
35-
36-
CThreadManager::ReportProgressFunc ProxyProgress = cdecl_cast([](float progress) { Logger.Progress(progress); });
37-
3819
extern void xrCompiler(LPCSTR name, bool draft_mode, bool pure_covers, LPCSTR out_name);
3920
extern void verify_level_graph(LPCSTR name, bool verbose);
4021

@@ -184,7 +165,7 @@ void Startup(LPSTR lpCmdLine)
184165
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
185166
{
186167
xrDebug::Initialize(false);
187-
Core.Initialize("xrai", 0);
168+
Core.Initialize("xrAI");
188169

189170
Startup(lpCmdLine);
190171

src/utils/xrDO_Light/StdAfx.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
11
#include "stdafx.h"
2+
#include "xrCore/cdecl_cast.hpp"
3+
#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"
4+
5+
ILevelCompilerLogger& Logger = LevelCompilerLoggerWindow::instance();
6+
7+
CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
8+
va_list args;
9+
va_start(args, format);
10+
Logger.clMsgV(format, args);
11+
va_end(args);
12+
});
13+
14+
CThreadManager::ReportStatusFunc ProxyStatus = cdecl_cast([](const char* format, ...) {
15+
va_list args;
16+
va_start(args, format);
17+
Logger.StatusV(format, args);
18+
va_end(args);
19+
});
20+
21+
CThreadManager::ReportProgressFunc ProxyProgress = cdecl_cast([](float progress) { Logger.Progress(progress); });

src/utils/xrDO_Light/StdAfx.h

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,11 @@
11
#pragma once
22

33
#include "Common/Common.hpp"
4-
#include "xrCore/xrCore.h"
5-
6-
#pragma warning(push)
7-
#pragma warning(disable : 4995)
8-
#include <d3dx9.h>
9-
#include <commctrl.h>
10-
#pragma warning(pop)
11-
12-
#define ENGINE_API
13-
#define ECORE_API
14-
#define XR_EPROPS_API
15-
#include "xrCore/clsid.h"
16-
#include "xrCDB/xrCDB.h"
17-
#include "Common/_d3d_extensions.h"
18-
19-
#include <fcntl.h>
20-
#include <sys/types.h>
21-
#include <sys/stat.h>
22-
#include <io.h>
23-
#include <stdio.h>
24-
25-
#ifdef AI_COMPILER
26-
#include "smart_cast.h"
27-
#endif
284

295
#include "utils/xrLCUtil/ILevelCompilerLogger.hpp"
306
#include "utils/xrLCUtil/xrThread.hpp"
31-
#include "xrCore/cdecl_cast.hpp"
32-
#include "xrScriptEngine/DebugMacros.hpp" // XXX: move debug macros to xrCore
337

348
extern ILevelCompilerLogger& Logger;
359
extern CThread::LogFunc ProxyMsg;
3610
extern CThreadManager::ReportStatusFunc ProxyStatus;
3711
extern CThreadManager::ReportProgressFunc ProxyProgress;
38-
39-
#define READ_IF_EXISTS(ltx, method, section, name, default_value)\
40-
(ltx->line_exist(section, name)) ? ltx->method(section, name) : default_value

src/utils/xrDO_Light/xrDO_Light.cpp

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,19 @@
11
#include "stdafx.h"
2-
#include "process.h"
32

43
#include "utils/xrLC_Light/xrlc_light.h"
5-
#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"
6-
#include "xrCore/cdecl_cast.hpp"
7-
#include "utils/xrLCUtil/xrLCUtil.hpp"
84
//#pragma comment(linker,"/STACK:0x800000,0x400000")
95

10-
#pragma comment(lib, "comctl32.lib")
11-
#pragma comment(lib, "winmm.LIB")
12-
13-
ILevelCompilerLogger& Logger = LevelCompilerLoggerWindow::instance();
14-
15-
CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
16-
va_list args;
17-
va_start(args, format);
18-
Logger.clMsgV(format, args);
19-
va_end(args);
20-
});
21-
22-
CThreadManager::ReportStatusFunc ProxyStatus = cdecl_cast([](const char* format, ...) {
23-
va_list args;
24-
va_start(args, format);
25-
Logger.StatusV(format, args);
26-
va_end(args);
27-
});
28-
29-
CThreadManager::ReportProgressFunc ProxyProgress = cdecl_cast([](float progress) { Logger.Progress(progress); });
30-
316
static const char* h_str =
327
"The following keys are supported / required:\n"
338
"-? or -h == this help\n"
349
"-f<NAME> == compile level in gamedata\\levels\\<NAME>\\\n"
35-
"-o == modify build options\n"
3610
"\n"
3711
"NOTE: The last key is required for any functionality\n";
3812

3913
void Help() { MessageBox(0, h_str, "Command line options", MB_OK | MB_ICONINFORMATION); }
4014
void Startup(LPSTR lpCmdLine)
4115
{
4216
char cmd[512];
43-
// BOOL bModifyOptions = FALSE;
4417
bool bNet = false;
4518
xr_strcpy(cmd, lpCmdLine);
4619
_strlwr(cmd);
@@ -54,7 +27,6 @@ void Startup(LPSTR lpCmdLine)
5427
Help();
5528
return;
5629
}
57-
// if (strstr(cmd,"-o")) bModifyOptions = TRUE;
5830
if (strstr(cmd, "-net"))
5931
bNet = true;
6032
// Load project
@@ -65,7 +37,6 @@ void Startup(LPSTR lpCmdLine)
6537
xr_sprintf(temp, "%s - Detail Compiler", name);
6638
Logger.Initialize(temp);
6739

68-
// FS.update_path (name,"$game_levels$",name);
6940
FS.get_path("$level$")->_set(name);
7041

7142
CTimer dwStartupTime;
@@ -84,9 +55,9 @@ void Startup(LPSTR lpCmdLine)
8455

8556
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
8657
{
87-
// Initialize debugging
8858
xrDebug::Initialize(false);
8959
Core.Initialize("xrDO");
60+
9061
Startup(lpCmdLine);
9162

9263
return 0;

src/utils/xrLC/StdAfx.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
11
#include "stdafx.h"
2+
#include "xrCore/cdecl_cast.hpp"
3+
#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"
4+
5+
ILevelCompilerLogger& Logger = LevelCompilerLoggerWindow::instance();
6+
7+
CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
8+
va_list args;
9+
va_start(args, format);
10+
Logger.clMsgV(format, args);
11+
va_end(args);
12+
});
13+
14+
CThreadManager::ReportStatusFunc ProxyStatus = cdecl_cast([](const char* format, ...) {
15+
va_list args;
16+
va_start(args, format);
17+
Logger.StatusV(format, args);
18+
va_end(args);
19+
});
20+
21+
CThreadManager::ReportProgressFunc ProxyProgress = cdecl_cast([](float progress) { Logger.Progress(progress); });

src/utils/xrLC/StdAfx.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
#pragma once
2-
#include <memory>
3-
#include "Common/Common.hpp"
4-
#include "utils/xrLC_Light/xrLC_Light.h"
52

6-
#define ENGINE_API // fake, to enable sharing with engine
7-
// comment - ne figa oni ne sharyatsya
3+
#define ENGINE_API
84

9-
#define ECORE_API // fake, to enable sharing with editors
10-
#define XR_EPROPS_API
11-
#include "xrCore/clsid.h"
5+
#include "Common/Common.hpp"
6+
#include "utils/xrLC_Light/xrLC_Light.h"
127

138
#include "utils/xrLCUtil/ILevelCompilerLogger.hpp"
149
#include "utils/xrLCUtil/xrThread.hpp"
15-
#include "xrCore/cdecl_cast.hpp"
1610

1711
extern ILevelCompilerLogger& Logger;
1812
extern CThread::LogFunc ProxyMsg;

src/utils/xrLC/xrLC.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,18 @@
11
// xrLC.cpp : Defines the entry point for the application.
22
//
33
#include "stdafx.h"
4+
#include <memory>
45
#include "math.h"
56
#include "build.h"
67
#include "Common/FSMacros.hpp"
78
#include "utils/xrLC_Light/xrLC_GlobalData.h"
8-
#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"
99
#include "xrCore/ModuleLookup.hpp"
1010

1111
#pragma comment(lib, "d3dx9.lib")
1212
#pragma comment(lib, "FreeImage.lib")
1313

1414
CBuild* pBuild = NULL;
1515
u32 version = 0;
16-
ILevelCompilerLogger& Logger = LevelCompilerLoggerWindow::instance();
17-
18-
CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
19-
va_list args;
20-
va_start(args, format);
21-
Logger.clMsgV(format, args);
22-
va_end(args);
23-
});
24-
25-
CThreadManager::ReportStatusFunc ProxyStatus = cdecl_cast([](const char* format, ...) {
26-
va_list args;
27-
va_start(args, format);
28-
Logger.StatusV(format, args);
29-
va_end(args);
30-
});
31-
32-
CThreadManager::ReportProgressFunc ProxyProgress = cdecl_cast([](float progress) { Logger.Progress(progress); });
3316

3417
static const char* h_str =
3518
"The following keys are supported / required:\n"
@@ -155,6 +138,7 @@ int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
155138
g_using_smooth_groups = false;
156139

157140
Startup(lpCmdLine);
141+
158142
Core._destroy();
159143

160144
return 0;

src/utils/xrLC_Light/stdafx.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
// stdafx.cpp : source file that includes just the standard includes
2-
// xrLC_Light.pch will be the pre-compiled header
3-
// stdafx.obj will contain the pre-compiled type information
4-
51
#include "stdafx.h"
2+
#include "xrCore/cdecl_cast.hpp"
63
#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"
74

85
ILevelCompilerLogger& Logger = LevelCompilerLoggerWindow::instance();

0 commit comments

Comments
 (0)