Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 5d05e5c

Browse files
authored
Merge pull request #191 from cortex-command-community/C++17
C++17
2 parents e821315 + 0449215 commit 5d05e5c

File tree

13 files changed

+36
-36
lines changed

13 files changed

+36
-36
lines changed

Activities/GameActivity.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -951,9 +951,7 @@ class GameActivity:
951951

952952

953953
// Comparison functor for sorting objective points by their y pos using STL's sort
954-
struct ObjPointYPosComparison:
955-
public std::binary_function<ObjectivePoint &, ObjectivePoint &, bool>
956-
{
954+
struct ObjPointYPosComparison {
957955
bool operator()(ObjectivePoint &rhs, ObjectivePoint &lhs) { return rhs.m_ScenePos.m_Y < lhs.m_ScenePos.m_Y; }
958956
};
959957

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
137137

138138
### Changed
139139

140+
- Codebase now uses the C++17 standard.
141+
140142
- Updated game framework from Allegro 4.2.3.1 to Allegro 4.4.3.1.
141143

142144
- Major cleanup and reformatting in the `Managers` folder.

Main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ int main(int argc, char *argv[]) {
18021802
InitMainMenu();
18031803

18041804
std::string screenshotSaveDir = g_System.GetWorkingDirectory() + "/" + c_ScreenshotDirectory;
1805-
if (!std::experimental::filesystem::exists(screenshotSaveDir)) { g_System.MakeDirectory(screenshotSaveDir); }
1805+
if (!std::filesystem::exists(screenshotSaveDir)) { g_System.MakeDirectory(screenshotSaveDir); }
18061806

18071807
if (g_ConsoleMan.LoadWarningsExist()) {
18081808
g_ConsoleMan.PrintString("WARNING: References to files that could not be located or failed to load detected during module loading!\nSee \"LoadWarningLog.txt\" for a list of bad references.");
@@ -1811,7 +1811,7 @@ int main(int argc, char *argv[]) {
18111811
g_ConsoleMan.SetEnabled(true);
18121812
} else {
18131813
// Delete an existing log if there are no warnings so there's less junk in the root folder.
1814-
if (std::experimental::filesystem::exists(g_System.GetWorkingDirectory() + "/LogLoadingWarning.txt")) { std::remove("LogLoadingWarning.txt"); }
1814+
if (std::filesystem::exists(g_System.GetWorkingDirectory() + "/LogLoadingWarning.txt")) { std::remove("LogLoadingWarning.txt"); }
18151815
}
18161816

18171817
if (!g_NetworkServer.IsServerModeEnabled()) {

Managers/FrameMan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ namespace RTE {
660660
// Check for the file namebase001.bmp; if it exists, try 002, etc.
661661
char *fileExtension = { (modeToSave == SaveBitmapMode::SingleBitmap || modeToSave == SaveBitmapMode::ScenePreviewDump) ? ".bmp" : ".png" };
662662
sprintf_s(fullFileName, sizeof(fullFileName), "%s/%s%03i%s", c_ScreenshotDirectory, nameBase, fileNumber++, fileExtension);
663-
if (!std::experimental::filesystem::exists(fullFileName)) {
663+
if (!std::filesystem::exists(fullFileName)) {
664664
break;
665665
}
666666
}

Managers/MovableMan.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ const string MovableMan::m_ClassName = "MovableMan";
3131

3232

3333
// Comparison functor for sorting movable objects by their X position using STL's sort
34-
struct MOXPosComparison:
35-
public std::binary_function<MovableObject *, MovableObject *, bool>
36-
{
34+
struct MOXPosComparison {
3735
bool operator()(MovableObject *pRhs, MovableObject *pLhs) { return pRhs->GetPos().m_X < pLhs->GetPos().m_X; }
3836
};
3937

@@ -1862,7 +1860,7 @@ void MovableMan::Update()
18621860

18631861
// DEATH //////////////////////////////////////////////////////////
18641862
// Transfer dead actors from Actor list to particle list
1865-
aIt = partition(m_Actors.begin(), m_Actors.end(), std::not1(std::mem_fun(&Actor::IsDead)));
1863+
aIt = partition(m_Actors.begin(), m_Actors.end(), std::not_fn(std::mem_fn(&Actor::IsDead)));
18661864
amidIt = aIt;
18671865

18681866
// Move dead Actor to particles list
@@ -1889,7 +1887,7 @@ void MovableMan::Update()
18891887

18901888
// ITEM SETTLE //////////////////////////////////////////////////////////
18911889
// Transfer excess items to particle list - use stable partition, item orde is important
1892-
iIt = stable_partition(m_Items.begin(), m_Items.end(), std::not1(std::mem_fun(&MovableObject::ToSettle)));
1890+
iIt = stable_partition(m_Items.begin(), m_Items.end(), std::not_fn(std::mem_fn(&MovableObject::ToSettle)));
18931891
imidIt = iIt;
18941892

18951893
// Move force-settled items to particles list
@@ -1909,7 +1907,7 @@ void MovableMan::Update()
19091907
// DELETE //////////////////////////////////////////////////////////
19101908
// Only delete after all travels & updates are done
19111909
// Actors
1912-
aIt = partition(m_Actors.begin(), m_Actors.end(), std::not1(std::mem_fun(&MovableObject::ToDelete)));
1910+
aIt = partition(m_Actors.begin(), m_Actors.end(), std::not_fn(std::mem_fn(&MovableObject::ToDelete)));
19131911
amidIt = aIt;
19141912

19151913
while (aIt != m_Actors.end())
@@ -1938,15 +1936,15 @@ void MovableMan::Update()
19381936
m_Actors.erase(amidIt, m_Actors.end());
19391937

19401938
// Items
1941-
iIt = stable_partition(m_Items.begin(), m_Items.end(), std::not1(std::mem_fun(&MovableObject::ToDelete)));
1939+
iIt = stable_partition(m_Items.begin(), m_Items.end(), std::not_fn(std::mem_fn(&MovableObject::ToDelete)));
19421940
imidIt = iIt;
19431941

19441942
while (iIt != m_Items.end())
19451943
delete *(iIt++);
19461944
m_Items.erase(imidIt, m_Items.end());
19471945

19481946
// Particles
1949-
parIt = partition(m_Particles.begin(), m_Particles.end(), std::not1(std::mem_fun(&MovableObject::ToDelete)));
1947+
parIt = partition(m_Particles.begin(), m_Particles.end(), std::not_fn(std::mem_fn(&MovableObject::ToDelete)));
19501948
midIt = parIt;
19511949

19521950
while (parIt != m_Particles.end())
@@ -1958,7 +1956,7 @@ void MovableMan::Update()
19581956
// Only settle after all updates and deletions are done
19591957
if (m_SettlingEnabled)
19601958
{
1961-
parIt = partition(m_Particles.begin(), m_Particles.end(), std::not1(std::mem_fun(&MovableObject::ToSettle)));
1959+
parIt = partition(m_Particles.begin(), m_Particles.end(), std::not_fn(std::mem_fn(&MovableObject::ToSettle)));
19621960
midIt = parIt;
19631961

19641962
while (parIt != m_Particles.end())

Menus/BuyMenuGUI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,7 @@ void BuyMenuGUI::CategoryChange(bool focusOnCategoryTabs)
18761876
pItemBitmap = pModule->GetIcon() ? new AllegroBitmap(pModule->GetIcon()) : 0;
18771877
// Passing in ownership of the bitmap, making uppercase the name
18781878
string name = pModule->GetFriendlyName();
1879-
transform(name.begin(), name.end(), name.begin(), std::pointer_to_unary_function<int, int>(toupper));
1879+
transform(name.begin(), name.end(), name.begin(), ::toupper);
18801880
m_pShopList->AddItem(name, m_aExpandedModules[moduleID] ? "-" : "+", pItemBitmap, 0, moduleID);
18811881
}
18821882

Menus/LoadingGUI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ namespace RTE {
195195
if (slashPos) { *(++slashPos) = 0; }
196196

197197
// If that file's directory doesn't exist yet, then create it, and all its parent directories above if need be
198-
for (int nested = 0; !std::experimental::filesystem::exists(outputDirName) && slashPos; ++nested) {
198+
for (int nested = 0; !std::filesystem::exists(outputDirName) && slashPos; ++nested) {
199199
// Keep making new working copies of the path that we can dice up
200200
strcpy_s(parentDirName, sizeof(parentDirName), outputDirName[0] == '.' ? &(outputDirName[2]) : outputDirName);
201201
// Start off at the beginning
@@ -224,7 +224,7 @@ namespace RTE {
224224
} else {
225225
// Validate so only certain file types are extracted: .ini .txt .lua .cfg .bmp .png .jpg .jpeg .wav .ogg .mp3
226226
// Get the file extension
227-
std::string fileExtension = std::experimental::filesystem::path(outputFileName).extension().string();
227+
std::string fileExtension = std::filesystem::path(outputFileName).extension().string();
228228
std::transform(fileExtension.begin(), fileExtension.end(), fileExtension.begin(), ::tolower);
229229
const char *ext = fileExtension.c_str();
230230
// Validate only certain file types to be included! .ini .txt .lua .cfg .bmp .png .jpg .jpeg .wav .ogg .mp3

Menus/ObjectPickerGUI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ void ObjectPickerGUI::UpdateObjectsList(bool selectTop)
12791279
pItemBitmap = pModule->GetIcon() ? new AllegroBitmap(pModule->GetIcon()) : 0;
12801280
// Passing in ownership of the bitmap, making uppercase the name
12811281
string name = pModule->GetFriendlyName();
1282-
transform(name.begin(), name.end(), name.begin(), std::pointer_to_unary_function<int, int>(toupper));
1282+
transform(name.begin(), name.end(), name.begin(), ::toupper);
12831283
m_pObjectsList->AddItem(name, m_aExpandedModules[moduleID] ? "-" : "+", pItemBitmap, 0, moduleID);
12841284
}
12851285

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ First you need to download the necessary files:
1111

1212
1. Install the necessary tools.
1313
You'll probably want [Visual Studio Community Edition](https://visualstudio.microsoft.com/downloads/) (we mostly use 2017 but 2019 should be fine).
14-
You also need to have [Visual C++ Redistributable for Visual Studio 2015 (x86)](https://www.microsoft.com/en-us/download/confirmation.aspx?id=48145&6B49FDFB-8E5B-4B07-BC31-15695C5A2143=1) installed in order to run the compiled builds.
14+
You also need to have [Visual C++ Redistributable for Visual Studio 2017 (x86)](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) installed in order to run the compiled builds.
1515
You may also want to check out the list of recommended Visual Studio plugins [here](https://github.com/cortex-command-community/Cortex-Command-Community-Project-Source/wiki/Information,-Recommended-Plugins-and-Useful-Links).
1616

1717
2. Clone this Source Repository and the [Data Repository](https://github.com/cortex-command-community/Cortex-Command-Community-Project-Data) in neighboring folders.

RTEA.vcxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
<ForcedIncludeFiles>%(ForcedIncludeFiles);StandardIncludes.h;</ForcedIncludeFiles>
9494
<MultiProcessorCompilation>true</MultiProcessorCompilation>
9595
<PrecompiledHeaderFile>StandardIncludes.h</PrecompiledHeaderFile>
96-
<LanguageStandard>stdcpp14</LanguageStandard>
96+
<LanguageStandard>stdcpp17</LanguageStandard>
9797
<IntrinsicFunctions>true</IntrinsicFunctions>
9898
</ClCompile>
9999
<Link>
@@ -138,7 +138,7 @@
138138
<ForcedIncludeFiles>%(ForcedIncludeFiles);StandardIncludes.h;</ForcedIncludeFiles>
139139
<MultiProcessorCompilation>true</MultiProcessorCompilation>
140140
<PrecompiledHeaderFile>StandardIncludes.h</PrecompiledHeaderFile>
141-
<LanguageStandard>stdcpp14</LanguageStandard>
141+
<LanguageStandard>stdcpp17</LanguageStandard>
142142
<IntrinsicFunctions>true</IntrinsicFunctions>
143143
</ClCompile>
144144
<Link>
@@ -191,7 +191,7 @@
191191
<OmitFramePointers>true</OmitFramePointers>
192192
<MultiProcessorCompilation>true</MultiProcessorCompilation>
193193
<PrecompiledHeaderFile>StandardIncludes.h</PrecompiledHeaderFile>
194-
<LanguageStandard>stdcpp14</LanguageStandard>
194+
<LanguageStandard>stdcpp17</LanguageStandard>
195195
</ClCompile>
196196
<Link>
197197
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;ole32.lib;dinput8.lib;ddraw.lib;dxguid.lib;winmm.lib;dsound.lib;ws2_32.lib;legacy_stdio_definitions.lib;zlibwapi.lib;libpng16_static.lib;liblz4.lib;fmod_vc.lib;alleg.lib;loadpng.lib;lua51.lib;luabind.x86.release.lib;RakNet_LibStatic_Release_Win32.lib;libboost_thread-vc141-mt-x32-1_55.lib;libboost_date_time-vc141-mt-x32-1_55.lib;libboost_system-vc141-mt-x32-1_55.lib;libboost_chrono-vc141-mt-x32-1_55.lib;%(AdditionalDependencies)</AdditionalDependencies>

0 commit comments

Comments
 (0)