Skip to content

Commit e4c249b

Browse files
committed
Merge branch 'dev' of https://github.com/OpenXRay/xray-16 into opengl
# Conflicts: # src/xrEngine/x_ray.cpp
2 parents a4b56cd + 7efe143 commit e4c249b

27 files changed

+1049
-4033
lines changed

src/Common/object_type_traits.h

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#define object_type_traits_h_included
1010
#pragma once
1111

12+
#include <type_traits>
13+
1214
//#define USE_BOOST
1315

1416
#ifdef USE_BOOST
@@ -28,32 +30,12 @@
2830

2931
template <bool expression, typename T1, typename T2>
3032
struct _if {
31-
template <bool>
32-
struct selector {
33-
typedef T2 result;
34-
};
35-
36-
template <>
37-
struct selector<true> {
38-
typedef T1 result;
39-
};
40-
41-
typedef typename selector<expression>::result result;
33+
using result = typename std::conditional<expression, T1, T2>::type;
4234
};
4335

4436
template <typename T1, typename T2>
4537
struct is_type {
46-
template <typename T>
47-
struct selector {
48-
enum { value = false, };
49-
};
50-
51-
template <>
52-
struct selector<T1> {
53-
enum { value = true, };
54-
};
55-
56-
enum { value = selector<T2>::value, };
38+
enum { value = std::is_same<T1,T2>::value, };
5739
};
5840

5941
template <typename T>
@@ -102,13 +84,7 @@
10284

10385
template <typename T>
10486
struct is_void {
105-
template <typename P>
106-
struct select {enum { value = false}; };
107-
108-
template <>
109-
struct select<void> {enum { value = true}; };
110-
111-
enum { value = select<T>::value};
87+
enum { value = std::is_same<void,T>::value };
11288
};
11389

11490
template <typename T> struct is_const{

src/xrCore/Animation/Envelope.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ void CEnvelope::LoadA(IReader& F)
239239
}
240240
// behavior <pre> <post>
241241
F.r_string(buf, sizeof(buf));
242-
int cnt = sscanf(buf, "Behaviors %d %d", behavior[0], behavior[1]);
242+
int cnt = sscanf(buf, "Behaviors %d %d", &behavior[0], &behavior[1]);
243243
R_ASSERT(cnt == 2);
244244
}
245245
}

src/xrCore/Crypto/xr_dsa_signer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "stdafx.h"
22
#include "xr_dsa_signer.h"
3+
#include <ctime>
34

45
xr_dsa_signer::xr_dsa_signer(u8 const p_number[crypto::xr_dsa::public_key_length],
56
u8 const q_number[crypto::xr_dsa::private_key_length],

src/xrCore/FTimer.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,17 @@ void CStatTimer::FrameEnd()
2222
else result = 0.99f*result + 0.01f*_time;
2323
}
2424

25-
XRCORE_API pauseMngr g_pauseMngr;
25+
XRCORE_API pauseMngr *g_pauseMngr()
26+
{
27+
static pauseMngr *manager = nullptr;
28+
29+
if (!manager)
30+
{
31+
manager = new pauseMngr();
32+
}
2633

34+
return manager;
35+
}
2736

2837
pauseMngr::pauseMngr() :m_paused(FALSE)
2938
{

src/xrCore/FTimer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class XRCORE_API pauseMngr
1616
void UnRegister(CTimer_paused* t);
1717
};
1818

19-
extern XRCORE_API pauseMngr g_pauseMngr;
19+
extern XRCORE_API pauseMngr *g_pauseMngr();
2020

2121
class XRCORE_API CTimerBase
2222
{
@@ -161,8 +161,8 @@ class XRCORE_API CTimer_paused_ex : public CTimer
161161
class XRCORE_API CTimer_paused : public CTimer_paused_ex
162162
{
163163
public:
164-
CTimer_paused() { g_pauseMngr.Register(this); }
165-
virtual ~CTimer_paused() { g_pauseMngr.UnRegister(this); }
164+
CTimer_paused() { g_pauseMngr()->Register(this); }
165+
virtual ~CTimer_paused() { g_pauseMngr()->UnRegister(this); }
166166
};
167167

168168
extern XRCORE_API BOOL g_bEnableStatGather;

src/xrCore/ModuleLookup.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include "stdafx.h"
2+
3+
#include "ModuleLookup.hpp"
4+
5+
#define WIN32_LEAN_AND_MEAN
6+
#include <windows.h>
7+
8+
namespace XRay {
9+
HMODULE LoadLibrary(const char *libraryFileName, bool log)
10+
{
11+
if (log)
12+
Log("Loading DLL:", libraryFileName);
13+
return ::LoadLibraryA(libraryFileName);
14+
}
15+
16+
void UnloadLibrary(HMODULE libraryHandle)
17+
{
18+
FreeLibrary(libraryHandle);
19+
}
20+
21+
void *GetProcAddress(HMODULE libraryHandle, const char *procName)
22+
{
23+
return ::GetProcAddress(libraryHandle, procName);
24+
}
25+
26+
}

src/xrCore/ModuleLookup.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#pragma once
2+
3+
#include "xrCore.h"
4+
5+
namespace XRay {
6+
XRCORE_API HMODULE LoadLibrary(const char *libraryFileName, bool log = true);
7+
XRCORE_API void UnloadLibrary(HMODULE libraryHandle);
8+
XRCORE_API void *GetProcAddress(HMODULE libraryHandle, const char *procName);
9+
}

src/xrCore/log.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void __cdecl Msg(const char* format, ...)
9797
va_list mark;
9898
string2048 buf;
9999
va_start(mark, format);
100-
int sz = _vsnprintf(buf, sizeof(buf) - 1, format, mark);
100+
int sz = std::vsnprintf(buf, sizeof(buf) - 1, format, mark);
101101
buf[sizeof(buf) - 1] = 0;
102102
va_end(mark);
103103
if (sz) Log(buf);

src/xrCore/lzo1x_d3.cpp

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)