diff --git a/OpenGTA-win/OpenGTA-win.vcxproj b/OpenGTA-win/OpenGTA-win.vcxproj
index fe9e8fb..205ba9f 100755
--- a/OpenGTA-win/OpenGTA-win.vcxproj
+++ b/OpenGTA-win/OpenGTA-win.vcxproj
@@ -92,15 +92,15 @@
Disabled
true
true
- ../../libs/boost-gil-extension;../../tes-engine;../../eigen;../../boost_1_67_0/;../../libs/jpeg-9;../../libs/jpeg-9/vc10;../../libs/lpng1510;..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include;..\..\loki-0.1.7\include\loki;..\opensteer\include
+ ../../libs/boost-gil-extension;../../tes-engine;../../eigen;../../boost_1_67_0/;../../libs/jpeg-9;../../libs/jpeg-9/vc10;../../libs/lpng1510;..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include;..\opensteer\include;..\replaceLoki
WIN32;_WINDOWS;TARGET_WIN32;_WIN32_WINNT=0x0501;WIN32_LEAN_AND_MEAN;EIGEN_DONT_ALIGN_STATICALLY;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)
false
MultiThreadedDebugDLL
Console
- ../../tes-engine/windows/Engine/x64/Debug;../../boost_1_67_0/stage/lib;..\..\SDL2-2.0.8\lib\x64;..\..\loki-0.1.7\lib;..\..\physfs-3.0.1\build\install\lib
- libjpeg.lib;libpng.lib;Engine.lib;physfs.lib;loki_D.lib;SDL2.lib;SDL2main.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ ../../tes-engine/windows/Engine/x64/Debug;../../boost_1_67_0/stage/lib;..\..\SDL2-2.0.8\lib\x64;..\..\physfs-3.0.1\build\install\lib
+ libjpeg.lib;libpng.lib;Engine.lib;physfs.lib;SDL2.lib;SDL2main.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
@@ -128,7 +128,7 @@
true
true
true
- ../../libs/boost-gil-extension;../../tes-engine;../../eigen;../../boost_1_67_0/;../../libs/jpeg-9;../../libs/jpeg-9/vc10;../../libs/lpng1510;..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include;..\..\loki-0.1.7\include\loki;..\opensteer\include
+ ../../libs/boost-gil-extension;../../tes-engine;../../eigen;../../boost_1_67_0/;../../libs/jpeg-9;../../libs/jpeg-9/vc10;../../libs/lpng1510;..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include;..\opensteer\include;..\replaceLoki
WIN32;NDEBUG;_WINDOWS;TARGET_WIN32;_WIN32_WINNT=0x0501;WIN32_LEAN_AND_MEAN;EIGEN_DONT_ALIGN_STATICALLY;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)
false
@@ -241,6 +241,7 @@
+
diff --git a/OpenGTA-win/OpenGTA-win.vcxproj.filters b/OpenGTA-win/OpenGTA-win.vcxproj.filters
index 1e9e2b2..6e18958 100755
--- a/OpenGTA-win/OpenGTA-win.vcxproj.filters
+++ b/OpenGTA-win/OpenGTA-win.vcxproj.filters
@@ -404,6 +404,9 @@
Source Files
+
+ Source Files
+
diff --git a/blockdata.h b/blockdata.h
old mode 100644
new mode 100755
index acb80ec..b96472d
--- a/blockdata.h
+++ b/blockdata.h
@@ -35,8 +35,7 @@ namespace OpenGTA {
static float lid_normal_data[numBlockTypes][3];
};
- typedef Loki::SingletonHolder BlockDataHolder;
+ typedef Loki::SingletonHolder BlockDataHolder;
}
#define SLOPE_RAW_DATA OpenGTA::BlockDataHolder::Instance().slope_raw_data
diff --git a/dataholder.cpp b/dataholder.cpp
old mode 100644
new mode 100755
index c1bf89e..626c33a
--- a/dataholder.cpp
+++ b/dataholder.cpp
@@ -24,6 +24,7 @@
#include "log.h"
#include "cistring.h"
+
namespace OpenGTA {
template<> ActiveStyle::ActiveData() {
m_data = 0;
diff --git a/dataholder.h b/dataholder.h
old mode 100644
new mode 100755
index f2c0ded..edbc476
--- a/dataholder.h
+++ b/dataholder.h
@@ -57,16 +57,13 @@ namespace OpenGTA {
/** Singleton: Graphics
*/
- typedef Loki::SingletonHolder< ActiveStyle, Loki::CreateUsingNew, Loki::DefaultLifetime,
- Loki::SingleThreaded> StyleHolder;
+ typedef Loki::SingletonHolder< ActiveStyle> StyleHolder;
/** Singleton: Map
*/
- typedef Loki::SingletonHolder< ActiveMap, Loki::CreateUsingNew, Loki::DefaultLifetime,
- Loki::SingleThreaded> MapHolder;
+ typedef Loki::SingletonHolder< ActiveMap> MapHolder;
/** Singleton: Message strings
*/
- typedef Loki::SingletonHolder< MainMsgLookup, Loki::CreateUsingNew, Loki::DefaultLifetime,
- Loki::SingleThreaded> MainMsgHolder;
+ typedef Loki::SingletonHolder< MainMsgLookup> MainMsgHolder;
}
diff --git a/font_cache.h b/font_cache.h
old mode 100644
new mode 100755
index cd0b357..4542db1
--- a/font_cache.h
+++ b/font_cache.h
@@ -59,8 +59,7 @@ namespace OpenGTA {
OpenGL::DrawableFont* createFont(const std::string & file, const uint32_t & scale);
};
- typedef Loki::SingletonHolder FontCacheHolder;
+ typedef Loki::SingletonHolder FontCacheHolder;
}
#endif
diff --git a/game_objects.cpp b/game_objects.cpp
index 130a384..f8fa8ff 100755
--- a/game_objects.cpp
+++ b/game_objects.cpp
@@ -25,11 +25,10 @@
#include "dataholder.h"
#include "cell_iterator.h"
#include "timer.h"
-#include "Functor.h"
#include "plane.h"
#include "ai.h"
#include "localplayer.h"
-
+#include
#include "log.h"
@@ -464,7 +463,9 @@ activeWeapon = chooseWeapon;
return;
}
anim.set(Util::Animation::PLAY_FORWARD, Util::Animation::FCALLBACK);
- Loki::Functor cmd(this, &Pedestrian::die);
+
+ std::function cmd = std::bind(&Pedestrian::die, this);
+
anim.setCallback(cmd);
isDead++;
}
@@ -473,7 +474,7 @@ activeWeapon = chooseWeapon;
isDead = 1;
switchToAnim(45);
anim.set(Util::Animation::PLAY_FORWARD, Util::Animation::FCALLBACK);
- Loki::Functor cmd(this, &Pedestrian::die);
+ std::function cmd = std::bind(&Pedestrian::die, this);
anim.setCallback(cmd);
}
diff --git a/game_objects.h b/game_objects.h
old mode 100644
new mode 100755
index 021b287..f6bc4c5
--- a/game_objects.h
+++ b/game_objects.h
@@ -31,6 +31,7 @@
#include "entity_controller.h"
#include "OpenSteer/Proximity.h"
#include "util/set.h"
+#include
namespace OpenGTA {
diff --git a/gl_camera.h b/gl_camera.h
old mode 100644
new mode 100755
index f315462..a806b29
--- a/gl_camera.h
+++ b/gl_camera.h
@@ -45,7 +45,6 @@ namespace OpenGL {
};
using namespace Loki;
- typedef SingletonHolder CameraHolder;
+ typedef SingletonHolder CameraHolder;
}
#endif
diff --git a/gl_screen.h b/gl_screen.h
index fb0fba3..051736b 100755
--- a/gl_screen.h
+++ b/gl_screen.h
@@ -75,7 +75,7 @@ namespace OpenGL {
};
using namespace Loki;
- typedef SingletonHolder ScreenHolder;
+ typedef SingletonHolder ScreenHolder;
}
#endif
diff --git a/gl_spritecache.h b/gl_spritecache.h
old mode 100644
new mode 100755
index 35d1753..3be486c
--- a/gl_spritecache.h
+++ b/gl_spritecache.h
@@ -75,8 +75,7 @@ namespace OpenGL {
bool doScale2x;
};
- typedef Loki::SingletonHolder SpriteCacheHolder;
+ typedef Loki::SingletonHolder SpriteCacheHolder;
}
#endif
diff --git a/localplayer.h b/localplayer.h
old mode 100644
new mode 100755
index 5e78d8c..19b7c68
--- a/localplayer.h
+++ b/localplayer.h
@@ -52,8 +52,7 @@ namespace OpenGTA {
PedController * pc_ptr;
};
- typedef Loki::SingletonHolder LocalPlayer;
+ typedef Loki::SingletonHolder LocalPlayer;
}
#endif
diff --git a/read_gry.cpp b/read_gry.cpp
old mode 100644
new mode 100755
index 6a4f02b..6b3ba96
--- a/read_gry.cpp
+++ b/read_gry.cpp
@@ -11,6 +11,7 @@
#include
#include
#include
+#include
#include "opengta.h"
#include "buffercache.h"
#include "log.h"
@@ -292,7 +293,7 @@ namespace OpenGTA {
fd = PHYSFS_openRead(style.c_str());
if (fd == NULL) {
std::string style2(style);
- transform(style2.begin(), style2.end(), style2.begin(), tolower);
+ std::transform(style2.begin(), style2.end(), style2.begin(), tolower);
fd = PHYSFS_openRead(style2.c_str());
}
if (fd == NULL) {
diff --git a/replaceLoki/Singleton.h b/replaceLoki/Singleton.h
new file mode 100755
index 0000000..fa224fe
--- /dev/null
+++ b/replaceLoki/Singleton.h
@@ -0,0 +1,32 @@
+#ifndef SINGLETON_H_INCLUDED
+#define SINGLETON_H_INCLUDED
+
+#include
+#include
+#include
+#include
+
+namespace Loki
+{
+
+ template
+ struct SingletonHolder
+ {
+ static T& Instance()
+ {
+ static std::once_flag onceFlag;
+
+ static std::unique_ptr singleton;
+
+ std::call_once(onceFlag,
+ [] {
+ singleton = std::make_unique();
+ });
+
+ return *singleton.get();
+ }
+ };
+
+}
+
+#endif
\ No newline at end of file
diff --git a/spritemanager.h b/spritemanager.h
old mode 100644
new mode 100755
index cb18f54..5dd92a9
--- a/spritemanager.h
+++ b/spritemanager.h
@@ -186,8 +186,7 @@ namespace OpenGTA {
};
- typedef Loki::SingletonHolder SpriteManagerHolder;
+ typedef Loki::SingletonHolder SpriteManagerHolder;
}
#endif
diff --git a/util/animation.h b/util/animation.h
old mode 100644
new mode 100755
index 1fc3675..5b26e6e
--- a/util/animation.h
+++ b/util/animation.h
@@ -23,7 +23,7 @@
#ifndef UTIL_ANIMATION_H
#define UTIL_ANIMATION_H
#include
-#include "Functor.h"
+#include
#include "log.h"
namespace Util {
@@ -56,7 +56,7 @@ namespace Util {
inline const OnDone & getDone() const { return onDone; }
void jumpToFrame(const uint16_t num, const Status andDo);
void update(const uint32_t & nowTicks);
- typedef Loki::Functor CallbackType;
+ typedef std::function CallbackType;
void setCallback(CallbackType & cb) { callback = cb; }
uint16_t currentFrame;
diff --git a/util/buffercache.h b/util/buffercache.h
old mode 100644
new mode 100755
index cb8e7fb..dd76aa1
--- a/util/buffercache.h
+++ b/util/buffercache.h
@@ -110,7 +110,6 @@ namespace Util {
/** Instance of BufferCache.
*/
- typedef SingletonHolder BufferCacheHolder;
+ typedef SingletonHolder BufferCacheHolder;
}
#endif
diff --git a/util/file_helper.cpp b/util/file_helper.cpp
old mode 100644
new mode 100755
index 702bb72..2eee179
--- a/util/file_helper.cpp
+++ b/util/file_helper.cpp
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
#include "m_exceptions.h"
#include "file_helper.h"
#include "buffercache.h"
diff --git a/util/file_helper.h b/util/file_helper.h
old mode 100644
new mode 100755
index 31b4df3..5088653
--- a/util/file_helper.h
+++ b/util/file_helper.h
@@ -47,8 +47,7 @@ namespace Util {
std::string userHomeDir;
};
- typedef Loki::SingletonHolder FileHelperHolder;
+ typedef Loki::SingletonHolder FileHelperHolder;
}
#define GET_FILE_HELPER Util::FileHelperHolder::Instance()
diff --git a/util/gui.h b/util/gui.h
old mode 100644
new mode 100755
index b8b60ed..913eec3
--- a/util/gui.h
+++ b/util/gui.h
@@ -85,8 +85,7 @@ namespace GUI {
};
- typedef Loki::SingletonHolder ManagerHolder;
+ typedef Loki::SingletonHolder ManagerHolder;
class Animation : public Util::Animation {
public:
@@ -196,7 +195,8 @@ namespace GUI {
void receive(SDL_MouseButtonEvent & mb_event);
SDL_Color innerColor;
float value;
- typedef Loki::Functor SC_Functor;
+ //typedef Loki::Functor SC_Functor;
+ typedef std::function SC_Functor;
SC_Functor changeCB;
};
diff --git a/util/map_helper.cpp b/util/map_helper.cpp
index b2ba74f..c813b40 100755
--- a/util/map_helper.cpp
+++ b/util/map_helper.cpp
@@ -1,7 +1,18 @@
#include "map_helper.h"
#include "log.h"
+#include
+#include
+#include
+
namespace Util {
+
+ SpriteCreationArea::SpriteCreationArea()
+ {
+ std::srand(unsigned(std::time(0)));
+ }
+
+
void SpriteCreationArea::setRects(const SDL_Rect & allowed, const SDL_Rect & denied) {
validRects = std::make_pair(allowed, denied);
onScreen = denied;
@@ -23,8 +34,9 @@ namespace Util {
}
TupleOfUint8 SpriteCreationArea::getValidCoord() {
- uint32_t x = rnd.nextUint(validRects.first.w) + validRects.first.x;
- uint32_t y = rnd.nextUint(validRects.first.h) + validRects.first.y;
+ uint32_t x = std::rand() % validRects.first.w + validRects.first.x;
+ uint32_t y = std::rand() % validRects.first.h + validRects.first.y;
+
return std::make_pair(x, y);
}
diff --git a/util/map_helper.h b/util/map_helper.h
index 55f6ef8..2a70925 100755
--- a/util/map_helper.h
+++ b/util/map_helper.h
@@ -6,7 +6,7 @@
#include
#include // yasli/random.h needs it
#include "math3d.h"
-#include "yasli/random.h"
+//#include "yasli/random.h"
namespace Util {
typedef std::pair TupleOfRects;
@@ -15,11 +15,11 @@ namespace Util {
class SpriteCreationArea {
public:
+ SpriteCreationArea();
//ListOfTupleOfRects validTuple;
TupleOfRects validRects;
void setRects(const SDL_Rect & allowed, const SDL_Rect & denied);
TupleOfUint8 getValidCoord();
- Random rnd;
bool isOnScreen(const Vector3D & p);
bool isOffScreen(const Vector3D & p);
private:
diff --git a/util/sample_cache.h b/util/sample_cache.h
old mode 100644
new mode 100755
index 81072fa..2808c9e
--- a/util/sample_cache.h
+++ b/util/sample_cache.h
@@ -70,8 +70,7 @@ namespace Audio {
m_map.clear();
}
- typedef Loki::SingletonHolder< SampleCache , Loki::CreateUsingNew,
- Loki::DefaultLifetime, Loki::SingleThreaded> SampleCacheHolder;
+ typedef Loki::SingletonHolder< SampleCache> SampleCacheHolder;
}
#endif
diff --git a/util/sound_mixer.h b/util/sound_mixer.h
old mode 100644
new mode 100755
index 0f5f02b..8f23d67
--- a/util/sound_mixer.h
+++ b/util/sound_mixer.h
@@ -28,8 +28,7 @@ namespace Audio {
Audio::SoundDevice::OPEN); }
};
- typedef Loki::SingletonHolder MixerHolder;
+ typedef Loki::SingletonHolder MixerHolder;
}
#endif
diff --git a/util/sound_music_player.h b/util/sound_music_player.h
old mode 100644
new mode 100755
index e29b618..eb57d35
--- a/util/sound_music_player.h
+++ b/util/sound_music_player.h
@@ -25,11 +25,12 @@
#ifdef WITH_SOUND
#include
-#include "Functor.h"
+#include
namespace Audio {
static int music_volume = 127;
- typedef Loki::Functor MusicFinishedCallbackType;
+ //typedef Loki::Functor MusicFinishedCallbackType;
+ typedef std::function MusicFinishedCallbackType;
struct MusicPlayerCtrl {
static bool isPlaying;
diff --git a/util/timer.h b/util/timer.h
old mode 100644
new mode 100755
index 37cc5f9..bb2c9b5
--- a/util/timer.h
+++ b/util/timer.h
@@ -24,7 +24,7 @@
#define OGTA_TIMER_H
#include