Skip to content

Commit 9b8cc35

Browse files
committed
set LanguageStandard=stdcpp14 for xrGame. Fix building other projects with stdcpp17
1 parent c163d32 commit 9b8cc35

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

src/utils/xrAI/level_spawn_constructor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "xrServerEntities/clsid_game.h"
1313
#include "xrServerEntities/xrMessages.h"
1414
#include "factory_api.h"
15+
#include <random>
1516

1617
#define IGNORE_ZERO_SPAWN_POSITIONS
1718

@@ -482,7 +483,9 @@ void CLevelSpawnConstructor::generate_artefact_spawn_positions()
482483
#endif
483484
}
484485
else*/
485-
std::random_shuffle(l_tpaStack.begin(), l_tpaStack.end());
486+
std::random_device rd;
487+
std::mt19937 g(rd());
488+
std::shuffle(l_tpaStack.begin(), l_tpaStack.end(), g);
486489

487490
zone->m_artefact_position_offset = m_level_points.size();
488491
m_level_points.resize(zone->m_artefact_position_offset + zone->m_artefact_spawn_count);

src/utils/xrAI/xr_graph_merge.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "game_graph_builder.h"
1717
#include "xrServerEntities/xrMessages.h"
1818
#include <direct.h>
19+
#include <random>
1920

2021
extern LPCSTR GAME_CONFIG;
2122

@@ -357,7 +358,9 @@ class CLevelGameGraph
357358

358359
R_ASSERT2(!l_dwaNodes.empty(), "Can't create at least one death point for specified graph point");
359360

360-
std::random_shuffle(l_dwaNodes.begin(), l_dwaNodes.end());
361+
std::random_device rd;
362+
std::mt19937 g(rd());
363+
std::shuffle(l_dwaNodes.begin(), l_dwaNodes.end(), g);
361364

362365
u32 m = l_dwaNodes.size() > 10 ? std::min(iFloor(.1f * l_dwaNodes.size()), 255) : l_dwaNodes.size(),
363366
l_dwStartIndex = m_tpLevelPoints.size();

src/utils/xrLC/xrLight.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "stdafx.h"
22
#include "build.h"
3+
#include <random>
34

45
#include "utils/xrLC_Light/xrdeflector.h"
56
#include "utils/xrLCUtil/xrThread.hpp"
@@ -73,7 +74,9 @@ void CBuild::LMapsLocal()
7374

7475
// Randomize deflectors
7576
#ifndef NET_CMP
76-
std::random_shuffle(lc_global_data()->g_deflectors().begin(), lc_global_data()->g_deflectors().end());
77+
std::random_device rd;
78+
std::mt19937 g(rd());
79+
std::shuffle(lc_global_data()->g_deflectors().begin(), lc_global_data()->g_deflectors().end(), g);
7780
#endif
7881

7982
#ifndef NET_CMP

src/utils/xrLC_Light/fitter.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ void vfOptimizeParameters(xr_vector<xr_vector<REAL>>& A, xr_vector<xr_vector<REA
8383
{
8484
dPreviousFunctional = dFunctional;
8585
dafGradient(daEvalResults, daGradient, B, dNormaFactor);
86-
std::transform(
87-
daGradient.begin(), daGradient.end(), daGradient.begin(), std::bind2nd(std::multiplies<REAL>(), -dAlpha));
88-
std::transform(daDelta.begin(), daDelta.end(), daDelta.begin(), std::bind2nd(std::multiplies<REAL>(), dBeta));
86+
std::transform(daGradient.begin(), daGradient.end(), daGradient.begin(),
87+
std::bind(std::multiplies<REAL>(), std::placeholders::_1, -dAlpha));
88+
std::transform(daDelta.begin(), daDelta.end(), daDelta.begin(),
89+
std::bind(std::multiplies<REAL>(), std::placeholders::_1, dBeta));
8990
std::transform(daGradient.begin(), daGradient.end(), daDelta.begin(), daDelta.begin(), std::plus<REAL>());
9091
std::transform(C.begin(), C.end(), daDelta.begin(), C.begin(), std::plus<REAL>());
9192
std::transform(D.begin(), D.end(), daDelta.begin(), D.begin(), std::plus<REAL>());
@@ -95,7 +96,8 @@ void vfOptimizeParameters(xr_vector<xr_vector<REAL>>& A, xr_vector<xr_vector<REA
9596

9697
if (dPreviousFunctional < dFunctional)
9798
{
98-
std::transform(daDelta.begin(), daDelta.end(), daDelta.begin(), std::bind2nd(std::multiplies<REAL>(), -1.f));
99+
std::transform(daDelta.begin(), daDelta.end(), daDelta.begin(),
100+
std::bind(std::multiplies<REAL>(), std::placeholders::_1, -1.f));
99101
std::transform(C.begin(), C.end(), daDelta.begin(), C.begin(), std::plus<REAL>());
100102
std::transform(D.begin(), D.end(), daDelta.begin(), D.begin(), std::plus<REAL>());
101103
}

src/xrGame/xrGame.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
</PropertyGroup>
9898
<ItemDefinitionGroup>
9999
<ClCompile>
100-
<LanguageStandard>stdcpp17</LanguageStandard>
100+
<LanguageStandard>stdcpp14</LanguageStandard>
101101
</ClCompile>
102102
</ItemDefinitionGroup>
103103
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

0 commit comments

Comments
 (0)