Skip to content

Commit

Permalink
Use one LevelCompilerLogger for all modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
intorr committed Jan 24, 2018
1 parent f92f37b commit 5d4b21a
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 82 deletions.
2 changes: 1 addition & 1 deletion src/utils/xrAI/xrAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Factory_Create* create_entity = 0;
Factory_Destroy* destroy_entity = 0;

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

CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
va_list args;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/xrDO_Light/xrDO_Light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#pragma comment(lib, "comctl32.lib")
#pragma comment(lib, "winmm.LIB")

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

CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
va_list args;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/xrLC/xrLC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

CBuild* pBuild = NULL;
u32 version = 0;
ILevelCompilerLogger& Logger = LevelCompilerLoggerWindow();
ILevelCompilerLogger& Logger = LevelCompilerLoggerWindow::instance();

CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
va_list args;
Expand Down
49 changes: 0 additions & 49 deletions src/utils/xrLCUtil/LevelCompilerLoggerConsole.cpp

This file was deleted.

19 changes: 0 additions & 19 deletions src/utils/xrLCUtil/LevelCompilerLoggerConsole.hpp

This file was deleted.

6 changes: 6 additions & 0 deletions src/utils/xrLCUtil/LevelCompilerLoggerWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,9 @@ void LevelCompilerLoggerWindow::Success(const char* msg)

void LevelCompilerLoggerWindow::Failure(const char* msg) { MessageBox(logWindow, msg, "Error!", MB_OK | MB_ICONERROR); }
HWND LevelCompilerLoggerWindow::GetWindow() const { return logWindow; }

LevelCompilerLoggerWindow & LevelCompilerLoggerWindow::instance()
{
static LevelCompilerLoggerWindow instance;
return instance;
}
4 changes: 3 additions & 1 deletion src/utils/xrLCUtil/LevelCompilerLoggerWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ class XRLCUTIL_API LevelCompilerLoggerWindow : public ILevelCompilerLogger
bool bPhaseChange = false;
u32 phase_total_time = 0;

public:
protected:
LevelCompilerLoggerWindow();
public:
virtual void Initialize(const char* name) override;
virtual void Destroy() override;
virtual void clMsg(const char* format, ...) override;
Expand All @@ -43,6 +44,7 @@ class XRLCUTIL_API LevelCompilerLoggerWindow : public ILevelCompilerLogger
virtual void Success(const char* msg) override;
virtual void Failure(const char* msg) override;
HWND GetWindow() const;
static LevelCompilerLoggerWindow& instance();

private:
static void LogThreadProc(void* context);
Expand Down
2 changes: 0 additions & 2 deletions src/utils/xrLCUtil/xrLCUtil.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="LevelCompilerLoggerConsole.cpp" />
<ClCompile Include="LevelCompilerLoggerWindow.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
Expand All @@ -181,7 +180,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="ILevelCompilerLogger.hpp" />
<ClInclude Include="LevelCompilerLoggerConsole.hpp" />
<ClInclude Include="LevelCompilerLoggerWindow.hpp" />
<ClInclude Include="pch.hpp" />
<ClInclude Include="xrThread.hpp" />
Expand Down
6 changes: 0 additions & 6 deletions src/utils/xrLCUtil/xrLCUtil.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
<ClCompile Include="LevelCompilerLoggerWindow.cpp">
<Filter>Log</Filter>
</ClCompile>
<ClCompile Include="LevelCompilerLoggerConsole.cpp">
<Filter>Log</Filter>
</ClCompile>
<ClCompile Include="xrLCUtil.cpp" />
</ItemGroup>
<ItemGroup>
Expand All @@ -45,9 +42,6 @@
<ClInclude Include="LevelCompilerLoggerWindow.hpp">
<Filter>Log</Filter>
</ClInclude>
<ClInclude Include="LevelCompilerLoggerConsole.hpp">
<Filter>Log</Filter>
</ClInclude>
<ClInclude Include="xrLCUtil.hpp" />
</ItemGroup>
<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/utils/xrLC_Light/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ void xrLight()
// Start threads, wait, continue --- perform all the work
CThreadManager Threads(ProxyStatus, ProxyProgress);
CTimer start_time;
start_time.Start();
u32 stride = range / NUM_THREADS;
u32 last = range - stride * (NUM_THREADS - 1);
for (u32 thID = 0; thID < NUM_THREADS; thID++)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/xrLC_Light/stdafx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"
#include "utils/xrLCUtil/LevelCompilerLoggerConsole.hpp"
#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"

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

CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
va_list args;
Expand Down

0 comments on commit 5d4b21a

Please sign in to comment.