mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Switch to Visual Studio 2015 compiler. Test some features with Delegate class
This commit is contained in:
+10
-11
@@ -3,34 +3,33 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
|
||||
typedef std::function<void()> Functor; // std::function<void(ArgT...)>
|
||||
typedef std::vector<Functor> FunctorCollection;
|
||||
|
||||
// template <typename ...ArgT>
|
||||
template <typename ...ArgT>
|
||||
class Delegate {
|
||||
public:
|
||||
Delegate() : _functors() {} // Delegate<ArgT...>()
|
||||
using Functor = std::function<void(ArgT...)>;
|
||||
using FunctorCollection = std::vector<Functor>;
|
||||
|
||||
Delegate<ArgT...>() {}
|
||||
|
||||
void add(Functor func) {
|
||||
_functors.emplace_back(std::move(func));
|
||||
}
|
||||
|
||||
/*void add(const Delegate<ArgT...>& other)
|
||||
void add(const Delegate<ArgT...>& other)
|
||||
{
|
||||
for (auto& func : other.functors())
|
||||
{
|
||||
add(func);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void clear() {
|
||||
_functors.clear();
|
||||
}
|
||||
|
||||
void invoke() { // invoke(ArgT... args)
|
||||
for (auto it = _functors.begin(); it != _functors.end(); ++it) {
|
||||
(*it)(); // args...
|
||||
void invoke(ArgT... args) {
|
||||
for (auto& func : _functors) {
|
||||
func(args...);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "..\main.h"
|
||||
|
||||
#include "..\Delegate.h"
|
||||
#include "..\FalloutEngine\Fallout2.h"
|
||||
#include "..\InputFuncs.h"
|
||||
#include "..\Logging.h"
|
||||
@@ -43,7 +44,7 @@
|
||||
#include "Sound.h"
|
||||
#include "ExtraSaveSlots.h"
|
||||
|
||||
//static Delegate OnBeforeLoadGame;
|
||||
static Delegate<> OnBeforeLoadGame;
|
||||
//static Delegate OnAfterLoadGame;
|
||||
|
||||
#define MAX_GLOBAL_SIZE (MaxGlobalVars * 12 + 4)
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win2K|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@@ -35,7 +35,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#define TARGETVERSION "Fallout 2 v1.02 US"
|
||||
|
||||
#define LEGAL_COPYRIGHT "Copyright (C) 2006-2017, sfall team"
|
||||
|
||||
#define VERSION_MAJOR 4
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_BUILD 0
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "FileDescription", "sfall, built for " TARGETVERSION
|
||||
VALUE "FileVersion", VERSION_STRING
|
||||
VALUE "InternalName", "sfall"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2006-2017, Timeslip"
|
||||
VALUE "LegalCopyright", LEGAL_COPYRIGHT
|
||||
VALUE "ProductName", "sfall"
|
||||
VALUE "ProductVersion", VERSION_STRING
|
||||
END
|
||||
|
||||
Reference in New Issue
Block a user