diff --git a/.gitignore b/.gitignore index b35e1969..c2b14e19 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,18 @@ src/*.xcodeproj/*.xcworkspace/xcuserdata src/*.xcodeproj/*.mode* src/*.xcodeproj/*.pbxuser +# Visual Studio Junk Files +src/*.vsproj/*sdf +src/*.vsproj/*/*.user +src/*.vsproj/*.suo +src/*.vsproj/*.aps +src/*.vsproj/*/*.aps +src/*.vsproj/*/Debug/ +src/*.vsproj/*/Release/ +src/*.vsproj/Debug/ +src/*.vsproj/Release/ +src/*.vsproj/*/ipch/ + # Shader Builder projects # It's an sqlite3 database and not particularly important, so exclude it src/tools/*.sbproj diff --git a/src/BoE.vsproj/Blades of Exile.sln b/src/BoE.vsproj/Blades of Exile.sln new file mode 100644 index 00000000..d27b876d --- /dev/null +++ b/src/BoE.vsproj/Blades of Exile.sln @@ -0,0 +1,49 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Game\Blades of Exile", "Game\Blades of Exile.vcxproj", "{A0C19353-478B-4F21-9FE3-FA8EE4D15147}" + ProjectSection(ProjectDependencies) = postProject + {1347FE79-73BD-4176-9280-0FE39E3534E2} = {1347FE79-73BD-4176-9280-0FE39E3534E2} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common\Common", "Common\Common.vcxproj", "{1347FE79-73BD-4176-9280-0FE39E3534E2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PcEdit\Char Editor", "PcEdit\Char Editor.vcxproj", "{3A6D88AD-45CD-4736-85F7-5E602ECB3D3C}" + ProjectSection(ProjectDependencies) = postProject + {1347FE79-73BD-4176-9280-0FE39E3534E2} = {1347FE79-73BD-4176-9280-0FE39E3534E2} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ScenEdit\Scen Editor", "ScenEdit\Scen Editor.vcxproj", "{87C53CC0-ED7A-4BF8-8844-FCA34401C1CA}" + ProjectSection(ProjectDependencies) = postProject + {1347FE79-73BD-4176-9280-0FE39E3534E2} = {1347FE79-73BD-4176-9280-0FE39E3534E2} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A0C19353-478B-4F21-9FE3-FA8EE4D15147}.Debug|Win32.ActiveCfg = Debug|Win32 + {A0C19353-478B-4F21-9FE3-FA8EE4D15147}.Debug|Win32.Build.0 = Debug|Win32 + {A0C19353-478B-4F21-9FE3-FA8EE4D15147}.Release|Win32.ActiveCfg = Release|Win32 + {A0C19353-478B-4F21-9FE3-FA8EE4D15147}.Release|Win32.Build.0 = Release|Win32 + {1347FE79-73BD-4176-9280-0FE39E3534E2}.Debug|Win32.ActiveCfg = Debug|Win32 + {1347FE79-73BD-4176-9280-0FE39E3534E2}.Debug|Win32.Build.0 = Debug|Win32 + {1347FE79-73BD-4176-9280-0FE39E3534E2}.Release|Win32.ActiveCfg = Release|Win32 + {1347FE79-73BD-4176-9280-0FE39E3534E2}.Release|Win32.Build.0 = Release|Win32 + {3A6D88AD-45CD-4736-85F7-5E602ECB3D3C}.Debug|Win32.ActiveCfg = Debug|Win32 + {3A6D88AD-45CD-4736-85F7-5E602ECB3D3C}.Debug|Win32.Build.0 = Debug|Win32 + {3A6D88AD-45CD-4736-85F7-5E602ECB3D3C}.Release|Win32.ActiveCfg = Release|Win32 + {3A6D88AD-45CD-4736-85F7-5E602ECB3D3C}.Release|Win32.Build.0 = Release|Win32 + {87C53CC0-ED7A-4BF8-8844-FCA34401C1CA}.Debug|Win32.ActiveCfg = Debug|Win32 + {87C53CC0-ED7A-4BF8-8844-FCA34401C1CA}.Debug|Win32.Build.0 = Debug|Win32 + {87C53CC0-ED7A-4BF8-8844-FCA34401C1CA}.Release|Win32.ActiveCfg = Release|Win32 + {87C53CC0-ED7A-4BF8-8844-FCA34401C1CA}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/BoE.vsproj/Common/Common.vcxproj b/src/BoE.vsproj/Common/Common.vcxproj new file mode 100644 index 00000000..4a856cce --- /dev/null +++ b/src/BoE.vsproj/Common/Common.vcxproj @@ -0,0 +1,177 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {1347FE79-73BD-4176-9280-0FE39E3534E2} + Common + + + + StaticLibrary + true + v120 + MultiByte + + + Application + false + v120 + true + MultiByte + + + + + + + + + + + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;TIXML_USE_TICPP;%(PreprocessorDefinitions) + ..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;%(AdditionalIncludeDirectories) + false + /FS %(AdditionalOptions) + + + Windows + true + opengl32.lib;sfml-system.lib;sfml-window.lib;sfml-graphics.lib;sfml-audio.lib;zlib.lib;%(AdditionalDependencies) + false + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + \ No newline at end of file diff --git a/src/BoE.vsproj/Common/Common.vcxproj.filters b/src/BoE.vsproj/Common/Common.vcxproj.filters new file mode 100644 index 00000000..6af471e9 --- /dev/null +++ b/src/BoE.vsproj/Common/Common.vcxproj.filters @@ -0,0 +1,326 @@ + + + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {243e7be1-5ae2-447e-a151-1f024281fc3e} + + + {e57ca16d-7be8-4847-8a66-2255b728c9ac} + + + {f35d1cde-8f80-49ab-8f96-3fa8a44ce491} + + + {606f67f8-5f1e-4b19-b417-0757fa8544ef} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {71426284-8f6d-42cb-8685-4d92d8e96879} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {f41285d1-bf7b-4650-b2e5-0f816e52bac2} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {28d415a1-e037-4a8b-bbdb-a6553b192bc3} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {17e8463f-156d-44db-9607-b2b5b0c426bb} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {a6d8701d-a0e3-4429-8eec-3d0bad13c3f5} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {b705522f-daf8-4db2-9cec-f5ae249e595e} + + + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + Classes\Header Files + + + DialogXML\TinyXML + + + DialogXML\TinyXML + + + DialogXML\TinyXML + + + DialogXML\TinyXML + + + DialogXML\Header Files + + + DialogXML\Header Files + + + DialogXML\Header Files + + + DialogXML\Header Files + + + DialogXML\Header Files + + + DialogXML\Header Files + + + DialogXML\Header Files + + + DialogXML\Header Files + + + DialogXML\Header Files + + + DialogXML\Header Files + + + DialogXML\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + Tools\Header Files + + + + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + Classes\Source Files + + + DialogXML\TinyXML + + + DialogXML\TinyXML + + + DialogXML\TinyXML + + + DialogXML\TinyXML + + + DialogXML\TinyXML + + + DialogXML\Source Files + + + DialogXML\Source Files + + + DialogXML\Source Files + + + DialogXML\Source Files + + + DialogXML\Source Files + + + DialogXML\Source Files + + + DialogXML\Source Files + + + DialogXML\Source Files + + + DialogXML\Source Files + + + Tools\Source Files + + + Tools\Source Files + + + Tools\Source Files + + + Tools\Source Files + + + Tools\Source Files + + + Tools\Source Files + + + Tools\Source Files + + + Tools\Source Files + + + Tools\Source Files + + + Tools\Source Files + + + \ No newline at end of file diff --git a/src/BoE.vsproj/Game/Blades of Exile.rc b/src/BoE.vsproj/Game/Blades of Exile.rc new file mode 100644 index 00000000..02a7f919 Binary files /dev/null and b/src/BoE.vsproj/Game/Blades of Exile.rc differ diff --git a/src/BoE.vsproj/Game/Blades of Exile.vcxproj b/src/BoE.vsproj/Game/Blades of Exile.vcxproj new file mode 100644 index 00000000..225e595e --- /dev/null +++ b/src/BoE.vsproj/Game/Blades of Exile.vcxproj @@ -0,0 +1,150 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {A0C19353-478B-4F21-9FE3-FA8EE4D15147} + Win32Proj + BladesofExile + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + true + + + false + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;TIXML_USE_TICPP;%(PreprocessorDefinitions) + + + ..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;%(AdditionalIncludeDirectories) + + + Windows + true + opengl32.lib;sfml-system.lib;sfml-window.lib;sfml-graphics.lib;sfml-audio.lib;zlib.lib;%(AdditionalDependencies) + mainCRTStartup + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {1347fe79-73bd-4176-9280-0fe39e3534e2} + false + true + false + true + true + + + + + + \ No newline at end of file diff --git a/src/BoE.vsproj/Game/Blades of Exile.vcxproj.filters b/src/BoE.vsproj/Game/Blades of Exile.vcxproj.filters new file mode 100644 index 00000000..7f56b160 --- /dev/null +++ b/src/BoE.vsproj/Game/Blades of Exile.vcxproj.filters @@ -0,0 +1,163 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + + + Resource Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/src/BoE.vsproj/Game/Resource.h b/src/BoE.vsproj/Game/Resource.h new file mode 100644 index 00000000..56170d5c --- /dev/null +++ b/src/BoE.vsproj/Game/Resource.h @@ -0,0 +1,31 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Blades of Exile.rc +// + +#define IDS_APP_TITLE 103 + +#define IDR_MAINFRAME 128 +#define IDD_BLADESOFEXILE_DIALOG 102 +#define IDD_ABOUTBOX 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDI_BLADESOFEXILE 107 +#define IDI_SMALL 108 +#define IDC_BLADESOFEXILE 109 +#define IDC_MYICON 2 +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#endif +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/src/BoE.vsproj/PcEdit/Char Editor.rc b/src/BoE.vsproj/PcEdit/Char Editor.rc new file mode 100644 index 00000000..c9df6392 Binary files /dev/null and b/src/BoE.vsproj/PcEdit/Char Editor.rc differ diff --git a/src/BoE.vsproj/PcEdit/Char Editor.vcxproj b/src/BoE.vsproj/PcEdit/Char Editor.vcxproj new file mode 100644 index 00000000..cc54f084 --- /dev/null +++ b/src/BoE.vsproj/PcEdit/Char Editor.vcxproj @@ -0,0 +1,116 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {3A6D88AD-45CD-4736-85F7-5E602ECB3D3C} + Win32Proj + CharEditor + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;TIXML_USE_TICPP;%(PreprocessorDefinitions) + ..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;%(AdditionalIncludeDirectories) + + + Windows + true + opengl32.lib;sfml-system.lib;sfml-window.lib;sfml-graphics.lib;sfml-audio.lib;zlib.lib;%(AdditionalDependencies) + mainCRTStartup + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + {1347fe79-73bd-4176-9280-0fe39e3534e2} + false + true + false + true + true + + + + + + + + + \ No newline at end of file diff --git a/src/BoE.vsproj/PcEdit/Char Editor.vcxproj.filters b/src/BoE.vsproj/PcEdit/Char Editor.vcxproj.filters new file mode 100644 index 00000000..0402c0a4 --- /dev/null +++ b/src/BoE.vsproj/PcEdit/Char Editor.vcxproj.filters @@ -0,0 +1,67 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/src/BoE.vsproj/PcEdit/resource.h b/src/BoE.vsproj/PcEdit/resource.h new file mode 100644 index 00000000..cb01612f Binary files /dev/null and b/src/BoE.vsproj/PcEdit/resource.h differ diff --git a/src/BoE.vsproj/ScenEdit/Scen Editor.rc b/src/BoE.vsproj/ScenEdit/Scen Editor.rc new file mode 100644 index 00000000..d0dfe5f8 Binary files /dev/null and b/src/BoE.vsproj/ScenEdit/Scen Editor.rc differ diff --git a/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj b/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj new file mode 100644 index 00000000..b3ef575e --- /dev/null +++ b/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj @@ -0,0 +1,122 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {87C53CC0-ED7A-4BF8-8844-FCA34401C1CA} + Win32Proj + ScenEditor + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;TIXML_USE_TICPP;%(PreprocessorDefinitions) + ..\..\tools\resmgr;..\..\tools\gzstream;..\..\tools;..\..\dialogxml\xml-parser;..\..\dialogxml;..\..\classes;..\..;%(AdditionalIncludeDirectories) + + + Windows + true + opengl32.lib;sfml-system.lib;sfml-window.lib;sfml-graphics.lib;sfml-audio.lib;zlib.lib;%(AdditionalDependencies) + mainCRTStartup + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {1347fe79-73bd-4176-9280-0fe39e3534e2} + false + true + false + true + true + + + + + + + + + \ No newline at end of file diff --git a/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj.filters b/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj.filters new file mode 100644 index 00000000..b9437549 --- /dev/null +++ b/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj.filters @@ -0,0 +1,85 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Resource Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/src/BoE.vsproj/ScenEdit/resource.h b/src/BoE.vsproj/ScenEdit/resource.h new file mode 100644 index 00000000..21698fb9 Binary files /dev/null and b/src/BoE.vsproj/ScenEdit/resource.h differ diff --git a/src/BoE.vsproj/targetver.h b/src/BoE.vsproj/targetver.h new file mode 100644 index 00000000..36a3cc0e --- /dev/null +++ b/src/BoE.vsproj/targetver.h @@ -0,0 +1,6 @@ +#pragma once + +// This ensures functions unavailable in Windows XP will not be available at compile time + +#define _WIN32_WINNT 0x0601 +#include diff --git a/src/boe.dlgutil.cpp b/src/boe.dlgutil.cpp index 524444fb..7a9fcc4b 100644 --- a/src/boe.dlgutil.cpp +++ b/src/boe.dlgutil.cpp @@ -1292,7 +1292,7 @@ static void put_scen_info(cDialog& me) { } } -static static bool pick_a_scen_event_filter(cDialog& me, std::string item_hit, eKeyMod) { +static bool pick_a_scen_event_filter(cDialog& me, std::string item_hit, eKeyMod) { if(item_hit == "cancel") { me.setResult(-1); me.toast(false); diff --git a/src/boe.fileio.cpp b/src/boe.fileio.cpp index 21c3d79d..e8e95b7a 100644 --- a/src/boe.fileio.cpp +++ b/src/boe.fileio.cpp @@ -147,7 +147,7 @@ void finish_load_party(){ loaded_yet = true; // TODO: Why is this still a C-string? - strcpy (last_load_file, file_to_load.filename().c_str()); + strcpy (last_load_file, file_to_load.filename().string().c_str()); store_file_reply = file_to_load; add_string_to_buf("Load: Game loaded. "); @@ -500,7 +500,7 @@ bool load_scenario_header(fs::path file/*,short header_entry*/){ bool mac_header = true; // TODO: Rewrite using ifstream, or maybe ifstream_buf - FILE* file_id = fopen(file.c_str(), "rb"); + FILE* file_id = fopen(file.string().c_str(), "rb"); if(file_id == NULL) { return false; } diff --git a/src/boe.graphics.cpp b/src/boe.graphics.cpp index 0ee25c7a..59805cff 100644 --- a/src/boe.graphics.cpp +++ b/src/boe.graphics.cpp @@ -172,7 +172,7 @@ void adjust_window_mode() { if(display_mode == 5) { ul.x = 14; ul.y = 2; mainPtr.create(sf::VideoMode(605,430,32), "Blades of Exile", sf::Style::Titlebar | sf::Style::Close, winSettings); - mainPtr.setPosition({(desktop.width - 605) / 2, (desktop.height - 430) / 2}); + mainPtr.setPosition({static_cast((desktop.width - 605) / 2), static_cast((desktop.height - 430) / 2)}); r = rectangle(mainPtr); } else { diff --git a/src/boe.infodlg.cpp b/src/boe.infodlg.cpp index 18f3cfb8..7e30de37 100644 --- a/src/boe.infodlg.cpp +++ b/src/boe.infodlg.cpp @@ -1,5 +1,6 @@ #include +#include //#include "item.h" @@ -29,9 +30,9 @@ short mage_spell_pos = 0,priest_spell_pos = 0,skill_pos = 0; -extern short skill_cost[20]; -extern short skill_max[20]; -extern short skill_g_cost[20]; +extern std::map skill_cost; +extern std::map skill_max; +extern std::map skill_g_cost; extern const char* skill_ids[19]; //extern party_record_type party; extern short cur_town_talk_loaded; @@ -138,19 +139,19 @@ void display_spells(eSkill mode,short force_spell,cDialog* parent) { static void put_skill_info(cDialog& me) { std::string store_text; - short pos; + eSkill pos; - pos = skill_pos; + pos = eSkill(skill_pos); - store_text = get_str("skills",pos * 2 + 1); + store_text = get_str("skills",skill_pos * 2 + 1); me["name"].setText(store_text.c_str()); me["skp"].setTextToNum(skill_cost[pos]); me["gold"].setTextToNum(skill_g_cost[pos]); me["max"].setTextToNum(skill_max[pos]); - store_text = get_str("skills", pos * 2 + 2); + store_text = get_str("skills", skill_pos * 2 + 2); me["desc"].setText(store_text); - store_text = get_str("tips", 1 + pos); + store_text = get_str("tips", 1 + skill_pos); me["tips"].setText(store_text); } diff --git a/src/boe.party.cpp b/src/boe.party.cpp index f17bb063..b0c0588c 100644 --- a/src/boe.party.cpp +++ b/src/boe.party.cpp @@ -2291,7 +2291,7 @@ eSpell pick_spell(short pc_num,eSkill type) { // 70 - no spell OW spell num else key = {false, static_cast('a' + i), mod_none}; cLed& led = dynamic_cast(castSpell[id]); led.attachKey(key); - castSpell.addLabelFor(id, {i > 25 ? toupper(key.c) : key.c}, LABEL_LEFT, 8, true); + castSpell.addLabelFor(id, {static_cast(i > 25 ? toupper(key.c) : key.c)}, LABEL_LEFT, 8, true); led.setState((pc_can_cast_spell(pc_casting,cSpell::fromNum(type,on_which_spell_page == 0 ? i : spell_index[i]))) ? led_red : led_green); led.attachClickHandler(std::bind(pick_spell_select_led, _1, _2, _3, type, std::ref(dark), std::ref(former_spell))); diff --git a/src/classes/creatlist.h b/src/classes/creatlist.h index 8ebe52b5..e3491f1d 100644 --- a/src/classes/creatlist.h +++ b/src/classes/creatlist.h @@ -39,6 +39,8 @@ public: cCreature& operator[](size_t n); const cCreature& operator[](size_t n) const; cPopulation() : which_town(200) {} + // Apparently Visual Studio needs this to work + cPopulation& operator=(const cPopulation& other) = default; }; -#endif \ No newline at end of file +#endif diff --git a/src/classes/item.h b/src/classes/item.h index ff515956..5eac85d9 100644 --- a/src/classes/item.h +++ b/src/classes/item.h @@ -106,4 +106,4 @@ public: } short_item_record_type; */ -#endif \ No newline at end of file +#endif diff --git a/src/classes/location.h b/src/classes/location.h index 3624fc35..a0f38d97 100644 --- a/src/classes/location.h +++ b/src/classes/location.h @@ -91,4 +91,4 @@ rectangle rect(); rectangle rect(location tl, location br); rectangle rect(int top, int left, int bottom, int right); -#endif \ No newline at end of file +#endif diff --git a/src/classes/monster.h b/src/classes/monster.h index 204a6686..ce0f826b 100644 --- a/src/classes/monster.h +++ b/src/classes/monster.h @@ -191,4 +191,4 @@ std::istream& operator >> (std::istream& in, eRace& e); std::ostream& operator << (std::ostream& out, eMonstAbil e); std::istream& operator >> (std::istream& in, eMonstAbil& e); std::ostream& operator<<(std::ostream& out, const cMonster::cAttack& att); -#endif \ No newline at end of file +#endif diff --git a/src/classes/outdoors.h b/src/classes/outdoors.h index e11a6027..b157b33b 100644 --- a/src/classes/outdoors.h +++ b/src/classes/outdoors.h @@ -77,4 +77,4 @@ public: void append(legacy::outdoor_record_type& old, const cScenario& scenario); }; -#endif \ No newline at end of file +#endif diff --git a/src/classes/party.h b/src/classes/party.h index a30162b0..87ad3ad4 100644 --- a/src/classes/party.h +++ b/src/classes/party.h @@ -167,4 +167,4 @@ bool operator==(const cParty::cEncNote& one, const cParty::cEncNote& two); std::istream& operator>>(std::istream& in, eEncNoteType& type); std::ostream& operator<<(std::ostream& out, eEncNoteType type); -#endif \ No newline at end of file +#endif diff --git a/src/classes/pc.h b/src/classes/pc.h index bf163c8f..386a261f 100644 --- a/src/classes/pc.h +++ b/src/classes/pc.h @@ -63,4 +63,4 @@ void operator -= (eMainStatus& stat, eMainStatus othr); std::ostream& operator << (std::ostream& out, eMainStatus e); std::istream& operator >> (std::istream& in, eMainStatus& e); -#endif \ No newline at end of file +#endif diff --git a/src/classes/regtown.h b/src/classes/regtown.h index 429cfe84..07913e30 100644 --- a/src/classes/regtown.h +++ b/src/classes/regtown.h @@ -85,4 +85,4 @@ public: void readTerrainFrom(std::istream& file); }; -#endif \ No newline at end of file +#endif diff --git a/src/classes/scenario.h b/src/classes/scenario.h index f4357ce6..98ff0c19 100644 --- a/src/classes/scenario.h +++ b/src/classes/scenario.h @@ -124,4 +124,4 @@ public: // OBoE Current Version const unsigned long long OBOE_CURRENT_VERSION = 0x010000; // MMmmff; M - major, m - minor, f - bugfix -#endif \ No newline at end of file +#endif diff --git a/src/classes/special.h b/src/classes/special.h index 5b21e293..0c5c0ef9 100644 --- a/src/classes/special.h +++ b/src/classes/special.h @@ -11,6 +11,7 @@ #include #include +#include #include "simpletypes.h" #include "location.h" @@ -67,4 +68,4 @@ std::ostream& operator << (std::ostream& out, eSpecType& e); std::istream& operator >> (std::istream& in, eSpecType& e); const node_properties_t& operator* (eSpecType t); -#endif \ No newline at end of file +#endif diff --git a/src/classes/talking.h b/src/classes/talking.h index b88799ca..1cc6526d 100644 --- a/src/classes/talking.h +++ b/src/classes/talking.h @@ -28,8 +28,9 @@ public: public: short personality,type; char link1[4],link2[4]; - short extras[4] = {-1,-1,-1,-1}; + short extras[4]; std::string str1, str2; + cNode() {std::fill(extras, extras + 4, -1);} }; unsigned char strlens[200]; cPersonality people[10]; @@ -39,4 +40,4 @@ public: void writeTo(std::ostream& file) const; }; -#endif \ No newline at end of file +#endif diff --git a/src/classes/terrain.h b/src/classes/terrain.h index a6b727bd..7b0c3ac2 100644 --- a/src/classes/terrain.h +++ b/src/classes/terrain.h @@ -55,4 +55,4 @@ std::istream& operator >> (std::istream& in, eTerSpec& e); std::ostream& operator << (std::ostream& out, eTerObstruct& e); std::istream& operator >> (std::istream& in, eTerObstruct& e); -#endif \ No newline at end of file +#endif diff --git a/src/classes/tmpltown.h b/src/classes/tmpltown.h index eda8e957..583833ba 100644 --- a/src/classes/tmpltown.h +++ b/src/classes/tmpltown.h @@ -115,4 +115,4 @@ public: // city_ter_rect_type city_ter_rect[10]; //}; -#endif \ No newline at end of file +#endif diff --git a/src/classes/town.h b/src/classes/town.h index aa347fca..e09fcf3e 100644 --- a/src/classes/town.h +++ b/src/classes/town.h @@ -137,4 +137,4 @@ public: virtual void readTerrainFrom(std::istream& file) = 0; }; -#endif \ No newline at end of file +#endif diff --git a/src/classes/universe.h b/src/classes/universe.h index c9484d3f..8bc252b6 100644 --- a/src/classes/universe.h +++ b/src/classes/universe.h @@ -134,7 +134,8 @@ public: void append(legacy::out_info_type& old); - ter_num_t(& operator [] (size_t i))[96]; + typedef ter_num_t arr_96[96]; + arr_96& operator [] (size_t i); ter_num_t& operator [] (location loc); void writeTo(std::ostream& file) const; void readFrom(std::istream& file); @@ -166,4 +167,4 @@ public: explicit cUniverse(long party_type = 'dflt'); }; -#endif \ No newline at end of file +#endif diff --git a/src/classes/vehicle.h b/src/classes/vehicle.h index 73c72e6d..14889e02 100644 --- a/src/classes/vehicle.h +++ b/src/classes/vehicle.h @@ -48,4 +48,4 @@ typedef struct { } boat_record_type; */ -#endif \ No newline at end of file +#endif diff --git a/src/dialogxml/dialog.cpp b/src/dialogxml/dialog.cpp index 5a7dfacf..b82d9142 100644 --- a/src/dialogxml/dialog.cpp +++ b/src/dialogxml/dialog.cpp @@ -178,8 +178,10 @@ template<> pair cDialog::parse(Element& who /*pict*/){ class dlogStringFilter : public boost::iterator_facade { friend class boost::iterator_core_access; +public: using value_type = std::string::value_type; using iter_type = std::string::iterator; +private: bool found_nl; iter_type base; bool equal(const dlogStringFilter& other) const { @@ -834,7 +836,7 @@ void cDialog::loadFromFile(std::string path){ try{ printf("Loading dialog from: %s\n", cPath.c_str()); TiXmlBase::SetCondenseWhiteSpace(false); - Document xml(cPath.c_str()); + Document xml(cPath.string().c_str()); xml.LoadFile(); Iterator attr; @@ -1524,3 +1526,5 @@ cControl& cDialog::getControl(std::string id) { } throw std::invalid_argument(id + " does not exist in dialog " + fname); } + +const char*const xBadVal::CONTENT = ""; diff --git a/src/dialogxml/dialog.hpp b/src/dialogxml/dialog.hpp index 188b9c9b..a6e44378 100644 --- a/src/dialogxml/dialog.hpp +++ b/src/dialogxml/dialog.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include "ticpp.h" #include "dialog.keys.hpp" @@ -258,7 +259,7 @@ class xBadVal : std::exception { const char* msg; public: /// A magic value to indicate errors in an element's content, rather than an attribute's content. - static constexpr const char*const CONTENT = ""; + static const char*const CONTENT; /// Construct a new exception. /// @param t The tag name of the element with the invalid value. /// @param n The name of the attribute with the invalid value. diff --git a/src/dialogxml/dlogutil.cpp b/src/dialogxml/dlogutil.cpp index f35657c8..8147a5cf 100644 --- a/src/dialogxml/dlogutil.cpp +++ b/src/dialogxml/dlogutil.cpp @@ -385,7 +385,7 @@ void cThreeChoice::init_buttons(cBasicButtonType btn1, cBasicButtonType btn2, cB btn->attachKey(btns[i]->defaultKey); btn->setText(btns[i]->label); btn->setBtnType(btns[i]->type); - btn->attachClickHandler(std::bind(&cChoiceDlog::onClick,this,_1,_2)); + btn->attachClickHandler(std::bind(&cThreeChoice::onClick,this,_1,_2)); switch(btns[i]->type){ case BTN_HELP: cur_btn_rect.bottom = cur_btn_rect.top + 13; diff --git a/src/dialogxml/dlogutil.hpp b/src/dialogxml/dlogutil.hpp index 27e69433..81d015bc 100644 --- a/src/dialogxml/dlogutil.hpp +++ b/src/dialogxml/dlogutil.hpp @@ -14,6 +14,7 @@ #include #include +#include #include #include "graphtool.h" // for pic_num_t #include "soundtool.h" // for snd_num_t diff --git a/src/dialogxml/pict.cpp b/src/dialogxml/pict.cpp index 30594f93..ffb022c1 100644 --- a/src/dialogxml/pict.cpp +++ b/src/dialogxml/pict.cpp @@ -68,8 +68,8 @@ std::map& cPict::drawPict(){ } void cPict::attachClickHandler(click_callback_t f) throw(){ - if(f == NULL){ - onClick = NULL; + if(f == nullptr){ + onClick = nullptr; clickable = false; }else{ onClick = f; @@ -82,7 +82,7 @@ void cPict::attachFocusHandler(focus_callback_t) throw(xHandlerNotSupported){ } bool cPict::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods){ - if(onClick != NULL) return onClick(me,id,mods); + if(onClick != nullptr) return onClick(me,id,mods); else return false; } diff --git a/src/pcedit/pc.action.cpp b/src/pcedit/pc.action.cpp index 1d80f56e..ebe534ce 100644 --- a/src/pcedit/pc.action.cpp +++ b/src/pcedit/pc.action.cpp @@ -30,7 +30,7 @@ extern cUniverse univ; //extern long ed_flag,ed_key; extern sf::RenderWindow mainPtr; -extern bool file_in_mem; +extern fs::path file_in_mem; //extern long register_flag; extern sf::Texture pc_gworld; @@ -63,7 +63,7 @@ bool handle_action(sf::Event event) { the_point = {event.mouseButton.x, event.mouseButton.y}; - if(!file_in_mem) + if(file_in_mem.empty()) return false; for(i = 0; i < 6; i++) diff --git a/src/pcedit/pc.global.cpp b/src/pcedit/pc.global.cpp deleted file mode 100644 index 2ee62ee6..00000000 --- a/src/pcedit/pc.global.cpp +++ /dev/null @@ -1,85 +0,0 @@ -//#include -#include -#include "ed.global.h" -#include "math.h" - -extern short give_delays; - -short get_ran (short times,short min,short max) -{ - long int store; - short i, to_ret = 0; - - for (i = 1; i < times + 1; i++) { - store = Random(); - to_ret = to_ret + min + (((store + 32767) * (max - min + 1)) / 65536); - } - return to_ret; -} - -Boolean same_point(location p1,location p2) -{ - if ((p1.x == p2.x) & (p1.y == p2.y)) - return TRUE; - else return FALSE; -} - -short move_to_zero(short val) -{ - if (val < 0) - return val + 1; - if (val > 0) - return val - 1; - return val; -} - -short max(short a,short b) -{ - if (a > b) - return a; - else return b; -} - -short min(short a,short b) -{ - if (a < b) - return a; - else return b; -} - -short minmax(short min,short max,short k) -{ - if (k < min) - return min; - if (k > max) - return max; - return k; -} - -short s_pow(short x,short y) -{ - return (short) pow((double) x, (double) y); -} - -short a_v(short x) -{ - if (x < 0) - return (-1 * x); - else return x; -} -short ex_abs(short x) -{ - if (x < 0) - return (-1 * x); - else return x; -} - -void BoEpause(short length) -{ - unsigned long dummy,len; - - len = (unsigned long)length; - - if (give_delays == 0) - Delay(len, &dummy); -} \ No newline at end of file diff --git a/src/scenedit/scen.fileio.cpp b/src/scenedit/scen.fileio.cpp index 061fcc4b..c3c3f567 100644 --- a/src/scenedit/scen.fileio.cpp +++ b/src/scenedit/scen.fileio.cpp @@ -12,7 +12,7 @@ #include "fileio.h" #include "dlogutil.hpp" -#import +#include using std::endl; #define DONE_BUTTON_ITEM 1 diff --git a/src/scenedit/scen.graphics.cpp b/src/scenedit/scen.graphics.cpp index cdc377cf..078fa655 100644 --- a/src/scenedit/scen.graphics.cpp +++ b/src/scenedit/scen.graphics.cpp @@ -454,7 +454,7 @@ void draw_lb_slot (short which,short mode) { from_rect = blue_button_from; if(mode > 0) from_rect.offset(from_rect.right - from_rect.left,0); - rect_draw_some_item(editor_mixed,from_rect,left_buttons[which][1],(location){0,0}); + rect_draw_some_item(editor_mixed,from_rect,left_buttons[which][1],location{0,0}); } if(left_button_status[which] % 10 == 3) text_rect.left += 16; diff --git a/src/scenedit/scen.townout.cpp b/src/scenedit/scen.townout.cpp index f48965d3..ff1801d6 100644 --- a/src/scenedit/scen.townout.cpp +++ b/src/scenedit/scen.townout.cpp @@ -430,12 +430,11 @@ static bool outdoor_details_event_filter(cDialog& me, std::string, eKeyMod) { } void outdoor_details() { - char temp_str[256]; - cDialog out_dlg("edit-outdoor-details"); out_dlg["okay"].attachClickHandler(outdoor_details_event_filter); - snprintf(temp_str,256,"X = %d, Y = %d",cur_out.x,cur_out.y); - out_dlg["loc"].setText(temp_str); + std::ostringstream str_out; + str_out << "X = " << cur_out.x << ", Y = " << cur_out.y; + out_dlg["loc"].setText(str_out.str()); out_dlg["comment"].setText(current_terrain->comment); out_dlg["name"].setText(current_terrain->out_name); diff --git a/src/tools/cursors.h b/src/tools/cursors.h index 7f8d9275..2dd9e863 100644 --- a/src/tools/cursors.h +++ b/src/tools/cursors.h @@ -9,6 +9,8 @@ #ifndef BOE_CURSORS_H #define BOE_CURSORS_H +#include + enum cursor_type { wand_curs = 0, eyedropper_curs = 1, @@ -41,7 +43,7 @@ enum cursor_type { class Cursor { void* ptr; public: - Cursor(const char* imgPath, float hotSpotX, float hotSpotY); + Cursor(std::string imgPath, float hotSpotX, float hotSpotY); ~Cursor(); void apply(); }; diff --git a/src/tools/fileio.cpp b/src/tools/fileio.cpp index c1bcdff3..880b82a9 100644 --- a/src/tools/fileio.cpp +++ b/src/tools/fileio.cpp @@ -98,7 +98,7 @@ bool load_scenario_v1(fs::path file_to_load, cScenario& scenario){ legacy::scenario_data_type *temp_scenario = new legacy::scenario_data_type; legacy::scen_item_data_type *item_data = new legacy::scen_item_data_type; // TODO: Convert this (and all the others in this file) to use C++ streams - FILE* file_id = fopen(file_to_load.c_str(),"rb"); + FILE* file_id = fopen(file_to_load.string().c_str(),"rb"); if(file_id == NULL) { // TODO: The third parameter to oopsError is supposed to specify whether we're in the scenario editor or the game, but I don't think this code knows that. // TODO: Alternatively, nuke oopsError and just use giveError. It's more informative, anyway. @@ -233,7 +233,7 @@ bool load_town_v1(fs::path scen_file, short which_town, cTown& the_town, legacy: legacy::ave_tr_type ave_t; legacy::tiny_tr_type tiny_t; - FILE* file_id = fopen(scen_file.c_str(), "rb"); + FILE* file_id = fopen(scen_file.string().c_str(), "rb"); if(file_id == NULL) { oopsError(14, 0, 0); return false; @@ -387,7 +387,7 @@ bool load_outdoors_v1(fs::path scen_file, location which_out,cOutdoors& the_out, char temp_str[256]; legacy::outdoor_record_type store_out; - FILE* file_id = fopen(scen_file.c_str(), "rb"); + FILE* file_id = fopen(scen_file.string().c_str(), "rb"); if(file_id == NULL) { oopsError(32, 0, 0); return false; @@ -526,6 +526,7 @@ bool load_party(fs::path file_to_load, cUniverse& univ){ bool maps_there = false; bool in_scen = false; enum {old_mac, old_win, new_oboe, unknown} format; + typedef unsigned short ushort; long len; short vers,n; @@ -544,7 +545,7 @@ bool load_party(fs::path file_to_load, cUniverse& univ){ }; // but if the first flag is 0x0B0E, we have a new-format save // the three flags still follow that. - FILE* file_id = fopen(file_to_load.c_str(), "rb"); + FILE* file_id = fopen(file_to_load.string().c_str(), "rb"); if(file_id == NULL) { cChoiceDlog("load-game-fail").show(); return false; @@ -783,7 +784,7 @@ bool load_party_v2(fs::path file_to_load, cUniverse& univ, bool town_restore, bo fout.close(); } - igzstream zin(tempPath.c_str()); + igzstream zin(tempPath.string().c_str()); tarball partyIn; partyIn.readFrom(zin); zin.close(); @@ -805,7 +806,7 @@ bool load_party_v2(fs::path file_to_load, cUniverse& univ, bool town_restore, bo } uint16_t magic; fin.read((char*)&magic, 2); - fin.read((char*)&univ.party.setup, sizeof(cParty::setup)); + fin.read((char*)&univ.party.setup, sizeof(univ.party.setup)); if(magic == 0x0E0B) // should be 0x0B0E! for(auto& i : univ.party.setup) for(auto& j : i) @@ -886,7 +887,7 @@ bool save_party(fs::path dest_file, const cUniverse& univ) { std::ostream& fout = partyOut.newFile("save/setup.dat"); static uint16_t magic = 0x0B0E; fout.write((char*)&magic, 2); - fout.write((char*)&univ.party.setup, sizeof(cParty::setup)); + fout.write((char*)&univ.party.setup, sizeof(univ.party.setup)); } // Then write the data for each of the party members @@ -928,7 +929,7 @@ bool save_party(fs::path dest_file, const cUniverse& univ) { // Write out the compressed data fs::path tempPath = tempDir/"savetemp.exg"; - ogzstream zout(tempPath.c_str()); + ogzstream zout(tempPath.string().c_str()); partyOut.writeTo(zout); zout.close(); diff --git a/src/tools/graphtool.cpp b/src/tools/graphtool.cpp index e1a79141..465ec518 100644 --- a/src/tools/graphtool.cpp +++ b/src/tools/graphtool.cpp @@ -12,6 +12,9 @@ #ifdef __APPLE__ #include #else +#ifdef _WIN32 +#include +#endif #include #endif @@ -912,12 +915,12 @@ m_pic_index_t m_pic_index[] = { }; // TODO: Put these classes in a header? -class Ellipse : public sf::Shape { +class EllipseShape : public sf::Shape { float divSz; int points; float a, b; public: - explicit Ellipse(sf::Vector2f size, unsigned int points = 30) : points(points) { + explicit EllipseShape(sf::Vector2f size, unsigned int points = 30) : points(points) { a = size.x / 2.0f; b = size.y / 2.0f; divSz = 2 * pi() / points; @@ -936,12 +939,12 @@ public: // TODO: Additional functions? }; -class RoundRect : public sf::Shape { +class RoundRectShape : public sf::Shape { float divSz; int points; float w,h,r; public: - RoundRect(sf::Vector2f size, float cornerRadius, unsigned int points = 32) : points(points / 4) { + RoundRectShape(sf::Vector2f size, float cornerRadius, unsigned int points = 32) : points(points / 4) { w = size.x; h = size.y; r = cornerRadius; @@ -1017,22 +1020,22 @@ void frame_rect(sf::RenderTarget& target, rectangle rect, sf::Color colour) { } void fill_roundrect(sf::RenderTarget& target, rectangle rect, int rad, sf::Color colour) { - RoundRect fill(sf::Vector2f(rect.width(), rect.height()), rad); + RoundRectShape fill(sf::Vector2f(rect.width(), rect.height()), rad); fill_shape(target, fill, rect.left, rect.top, colour); } void frame_roundrect(sf::RenderTarget& target, rectangle rect, int rad, sf::Color colour) { - RoundRect frame(sf::Vector2f(rect.width(), rect.height()), rad); + RoundRectShape frame(sf::Vector2f(rect.width(), rect.height()), rad); frame_shape(target, frame, rect.left, rect.top, colour); } void fill_circle(sf::RenderTarget& target, rectangle rect, sf::Color colour) { - Ellipse fill(sf::Vector2f(rect.width(), rect.height())); + EllipseShape fill(sf::Vector2f(rect.width(), rect.height())); fill_shape(target, fill, rect.left, rect.top, colour); } void frame_circle(sf::RenderTarget& target, rectangle rect, sf::Color colour) { - Ellipse frame(sf::Vector2f(rect.width(), rect.height())); + EllipseShape frame(sf::Vector2f(rect.width(), rect.height())); frame_shape(target, frame, rect.left, rect.top, colour); } @@ -1050,7 +1053,7 @@ void frame_region(sf::RenderWindow& target, Region& region, sf::Color colour) { } void Region::addEllipse(rectangle frame) { - Ellipse* ellipse = new Ellipse(sf::Vector2f(frame.width(), frame.height())); + EllipseShape* ellipse = new EllipseShape(sf::Vector2f(frame.width(), frame.height())); ellipse->setFillColor(sf::Color::Black); shapes.push_back(std::shared_ptr(ellipse)); } diff --git a/src/tools/resmgr/restypes.hpp b/src/tools/resmgr/restypes.hpp index 8d6b2c51..6cc42326 100644 --- a/src/tools/resmgr/restypes.hpp +++ b/src/tools/resmgr/restypes.hpp @@ -69,7 +69,7 @@ namespace ResMgr { } } // TODO: Handle errors? - CursorRsrc* cur = new Cursor(fpath.c_str(),x,y); + CursorRsrc* cur = new Cursor(fpath.string(),x,y); return cur; throw xResMgrErr("Failed to load GIF cursor: " + fname); } diff --git a/src/tools/soundtool.cpp b/src/tools/soundtool.cpp index 93cfc523..b71e0de2 100644 --- a/src/tools/soundtool.cpp +++ b/src/tools/soundtool.cpp @@ -115,7 +115,7 @@ void play_sound(short which, short how_many_times) { // if < 0, play asynch if(how_many_times > 1) play_sound(which, how_many_times - 1); // TODO: Since sounds are handled by SFML, all this Windows-specific code shouldn't be needed -#if defined(WIN32) +#if 0 //defined(WIN32) short i,num_fails = 0; char snd_name[30]; bool asyn = false,a_sound_did_get_played = false; @@ -233,7 +233,7 @@ void play_sound(short which, short how_many_times) { // if < 0, play asynch #endif } -#ifdef WIN32 +#if 0 //def WIN32 void kill_sound() { sndPlaySound(NULL,0); } @@ -255,7 +255,7 @@ void flip_sound() { } -#ifdef WIN32 +#if 0 //def WIN32 void sound_pause(long len) { long t1,t2; @@ -323,4 +323,4 @@ void load_sounds(HMODULE handle) { } } } -#endif \ No newline at end of file +#endif diff --git a/src/tools/specials_parse.cpp b/src/tools/specials_parse.cpp index 7889d551..20835348 100644 --- a/src/tools/specials_parse.cpp +++ b/src/tools/specials_parse.cpp @@ -8,6 +8,8 @@ //#define BOOST_SPIRIT_DEBUG +#ifndef _MSC_VER // TODO: Figure out why this won't compile in Visual Studio + #include "special_parse.hpp" #include @@ -18,6 +20,11 @@ #include "special.h" +#ifdef _MSC_VER +#define BOOST_PHOENIX_LIMIT 10 +#define _VARIADIC_MAX 10 +#endif + namespace ph = boost::phoenix; qi::symbols opcode; @@ -229,3 +236,5 @@ void test_special_parse(std::string file) { } fout.close(); } + +#endif diff --git a/src/tools/tarball.cpp b/src/tools/tarball.cpp index 89c36c70..ed1c2bde 100644 --- a/src/tools/tarball.cpp +++ b/src/tools/tarball.cpp @@ -8,6 +8,13 @@ #include "tarball.hpp" #include +#include +#include + +#ifdef _MSC_VER +// For some bizarre reason, Visual Studio doesn't declare snprintf in +#define snprintf _snprintf_s +#endif tarball::header_posix_ustar tarball::generateTarHeader(const std::string& fileName, unsigned long long fileSize, bool directory){ static_assert(sizeof(header_posix_ustar) == 512, "Uh-oh! Padding in the tarball header!"); diff --git a/src/tools/tarball.hpp b/src/tools/tarball.hpp index 5590c558..f0c31c11 100644 --- a/src/tools/tarball.hpp +++ b/src/tools/tarball.hpp @@ -36,6 +36,13 @@ class tarball { header_posix_ustar header; std::string filename; std::stringstream contents; + // This seems to be necessary to compile in Visual Studio + // Seemingly, stringstream is non-copyable. + tarfile() {} + tarfile(tarfile& other) { + contents.str(""); + contents << other.contents.str(); + } }; std::deque files; static header_posix_ustar generateTarHeader(const std::string& fileName, unsigned long long fileSize, bool directory=false);