aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorThierry Crozat2017-04-24 00:28:37 +0100
committerThierry Crozat2017-04-24 01:06:40 +0100
commit438f23f2723b384098828fde3cf2b6b20fca9bc7 (patch)
treec2746d6c06380c5ad1f2f623d8d2ff09907e70d7 /backends
parent3849a3e90e6e679e35f8ec4517ce38d2a0c5d098 (diff)
downloadscummvm-rg350-438f23f2723b384098828fde3cf2b6b20fca9bc7.tar.gz
scummvm-rg350-438f23f2723b384098828fde3cf2b6b20fca9bc7.tar.bz2
scummvm-rg350-438f23f2723b384098828fde3cf2b6b20fca9bc7.zip
SDL: Use dynamic cast instead of C cast to get screenshot path
Diffstat (limited to 'backends')
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp5
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp5
2 files changed, 8 insertions, 2 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 9b25f43f39..ccb2572d33 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -625,7 +625,10 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
if (event.kbd.keycode == Common::KEYCODE_s) {
Common::String filename;
- Common::String screenshotsPath = ((OSystem_SDL *)g_system)->getScreenshotsPath();
+ Common::String screenshotsPath;
+ OSystem_SDL *sdl_g_system = dynamic_cast<OSystem_SDL*>(g_system);
+ if (sdl_g_system)
+ screenshotsPath = sdl_g_system->getScreenshotsPath();
for (int n = 0;; n++) {
SDL_RWops *file;
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 047941cb43..dd28f32bdc 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -2526,7 +2526,10 @@ bool SurfaceSdlGraphicsManager::notifyEvent(const Common::Event &event) {
if (event.kbd.hasFlags(Common::KBD_ALT) && event.kbd.keycode == 's') {
Common::String filename;
- Common::String screenshotsPath = ((OSystem_SDL *)g_system)->getScreenshotsPath();
+ Common::String screenshotsPath;
+ OSystem_SDL *sdl_g_system = dynamic_cast<OSystem_SDL*>(g_system);
+ if (sdl_g_system)
+ screenshotsPath = sdl_g_system->getScreenshotsPath();
for (int n = 0;; n++) {
SDL_RWops *file;