Skip to content

Commit 7a05d41

Browse files
author
nitrocaster
committed
Move CThread and CThreadManager to new xrUtil library.
1 parent 98aef2a commit 7a05d41

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1090
-366
lines changed

src/engine.sln

Lines changed: 670 additions & 1 deletion
Large diffs are not rendered by default.

src/utils/xrAI/compiler_cover.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "stdafx.h"
22
#include "compiler.h"
33
#include "xrCDB/Intersect.hpp"
4-
#include "xrThread.h"
4+
#include "utils/xrUtil/xrThread.hpp"
55
#include <mmsystem.h>
66

77
#include "quadtree.h"
@@ -238,7 +238,7 @@ class CoverThread : public CThread
238238
typedef float Cover[4];
239239

240240
public:
241-
CoverThread (u32 ID, u32 _start, u32 _end) : CThread(ID)
241+
CoverThread (u32 ID, u32 _start, u32 _end) : CThread(ID, clMsg)
242242
{
243243
Nstart = _start;
244244
Nend = _end;
@@ -574,7 +574,7 @@ void xrCover (bool pure_covers)
574574

575575
// Start threads, wait, continue --- perform all the work
576576
u32 start_time = timeGetTime();
577-
CThreadManager Threads;
577+
CThreadManager Threads(Status, Progress);
578578
u32 stride = g_nodes.size()/NUM_THREADS;
579579
u32 last = g_nodes.size()-stride*(NUM_THREADS-1);
580580
for (u32 thID=0; thID<NUM_THREADS; thID++) {

src/utils/xrAI/compiler_light.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "stdafx.h"
22
#include "compiler.h"
33
#include "xrCDB/Intersect.hpp"
4-
#include "xrThread.h"
4+
#include "utils/xrUtil/xrThread.hpp"
55
#include <mmsystem.h>
66

77
const int LIGHT_Count =2;
@@ -78,7 +78,7 @@ class LightThread : public CThread
7878
{
7979
u32 Nstart, Nend;
8080
public:
81-
LightThread (u32 ID, u32 _start, u32 _end) : CThread(ID)
81+
LightThread (u32 ID, u32 _start, u32 _end) : CThread(ID, clMsg)
8282
{
8383
Nstart = _start;
8484
Nend = _end;

src/utils/xrAI/game_spawn_constructor.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ extern LPCSTR generate_temp_file_name (LPCSTR header0, LPCSTR header1, string_
2121

2222
#define NO_MULTITHREADING
2323

24-
CGameSpawnConstructor::CGameSpawnConstructor (LPCSTR name, LPCSTR output, LPCSTR start, bool no_separator_check)
24+
CGameSpawnConstructor::CGameSpawnConstructor (LPCSTR name, LPCSTR output, LPCSTR start, bool no_separator_check) :
2525
#ifdef PROFILE_CRITICAL_SECTIONS
26-
:m_critical_section(MUTEX_PROFILE_ID(CGameSpawnConstructor))
26+
m_critical_section(MUTEX_PROFILE_ID(CGameSpawnConstructor)),
2727
#endif // PROFILE_CRITICAL_SECTIONS
28+
m_thread_manager(Status, Progress)
2829
{
2930
load_spawns (name,no_separator_check);
3031
process_spawns ();

src/utils/xrAI/game_spawn_constructor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include "alife_space.h"
1212
#include "xr_graph_merge.h"
13-
#include "xrthread.h"
13+
#include "utils/xrUtil/xrThread.hpp"
1414
#include "graph_abstract.h"
1515
#include "xrServer_Object_Base.h"
1616
#include "spawn_constructor_space.h"

src/utils/xrAI/level_spawn_constructor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#pragma once
1010

11-
#include "xrthread.h"
11+
#include "utils/xrUtil/xrThread.hpp"
1212
#include "spawn_constructor_space.h"
1313

1414
class CLevelGraph;

src/utils/xrAI/level_spawn_constructor_inline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#pragma once
1010

1111
IC CLevelSpawnConstructor::CLevelSpawnConstructor (const CGameGraph::SLevel &level, CGameSpawnConstructor *game_spawn_constructor, bool no_separator_check) :
12-
CThread (level.id())
12+
CThread (level.id(), clMsg)
1313
{
1414
m_level = level;
1515
m_game_spawn_constructor = game_spawn_constructor;

src/utils/xrAI/vertex_path.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99
#pragma once
1010

1111
template <bool bEuclidianHeuristics = true>
12-
struct CVertexPath {
13-
12+
struct CVertexPath
13+
{
1414
#pragma pack(push,1)
1515
template <template <typename _T> class T1>
16-
struct DataStoragePath {
17-
struct _vertex : public T1<_vertex> {
18-
};
16+
struct DataStoragePath
17+
{
18+
struct _vertex : public T1<_vertex>
19+
{};
1920
};
2021
#pragma pack(pop)
2122

2223
template <template <typename _T> class _vertex>
23-
class CDataStorage {
24+
class CDataStorage
25+
{
2426
public:
2527
typedef typename DataStoragePath<_vertex>::_vertex CGraphVertex;
2628
typedef typename CGraphVertex::_index_type _index_type;

src/utils/xrAI/xrAI.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#pragma comment(lib,"xrcdb.LIB")
2424
#pragma comment(lib,"MagicFM.LIB")
2525
#pragma comment(lib,"xrCore.LIB")
26+
#pragma comment(lib, "xrUtil.lib")
2627

2728
extern LPCSTR LEVEL_GRAPH_NAME;
2829

src/utils/xrAI/xrAI.vcxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@
303303
<ClCompile Include="verify_level_graph.cpp" />
304304
<ClCompile Include="xrAI.cpp" />
305305
<ClCompile Include="xrCrossTable.cpp" />
306-
<ClCompile Include="xrThread.cpp" />
307306
<ClCompile Include="xr_graph_merge.cpp" />
308307
<ClCompile Include="_buildnodes_view.cpp">
309308
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@@ -481,7 +480,6 @@
481480
<ClInclude Include="xrAI.h" />
482481
<ClInclude Include="xrCrossTable.h" />
483482
<ClInclude Include="xrShaderTypes.h" />
484-
<ClInclude Include="xrThread.h" />
485483
<ClInclude Include="xr_graph_merge.h" />
486484
<ClInclude Include="_d3d_extensions.h" />
487485
</ItemGroup>

0 commit comments

Comments
 (0)