summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-11-25 21:09:00 +0000
committerrubidium <rubidium@openttd.org>2008-11-25 21:09:00 +0000
commit5ebb48fa8633dc90e7fd6343f117d513f682dc1e (patch)
tree8f56ace83113a8c96887be195a473b1132beb9e5 /src/video
parent285d1846aebfc5bf3b874ff5d431a568e6a49da2 (diff)
downloadopenttd-5ebb48fa8633dc90e7fd6343f117d513f682dc1e.tar.xz
(svn r14631) -Add: support for Allegro as sound backend.
Diffstat (limited to 'src/video')
-rw-r--r--src/video/allegro_v.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/video/allegro_v.cpp b/src/video/allegro_v.cpp
index a70a2709c..f69c7121e 100644
--- a/src/video/allegro_v.cpp
+++ b/src/video/allegro_v.cpp
@@ -374,9 +374,14 @@ static void PollEvent()
}
}
+/** There are multiple modules that might be using Allegro and
+ * Allegro can only be initiated once. */
+int _allegro_count = 0;
+
const char *VideoDriver_Allegro::Start(const char * const *parm)
{
- if (install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) return NULL;
+ if (_allegro_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) return NULL;
+ _allegro_count++;
install_timer();
install_mouse();
@@ -391,7 +396,7 @@ const char *VideoDriver_Allegro::Start(const char * const *parm)
void VideoDriver_Allegro::Stop()
{
- allegro_exit();
+ if (--_allegro_count == 0) allegro_exit();
}
#if defined(UNIX) || defined(__OS2__) || defined(PSP)
@@ -431,7 +436,7 @@ void VideoDriver_Allegro::MainLoop()
#else
/* Speedup when pressing tab, except when using ALT+TAB
* to switch to another application */
- if (keys[KEY_TAB] && (key_shifts & KB_ALT_FLAG) == 0)
+ if (key[KEY_TAB] && (key_shifts & KB_ALT_FLAG) == 0)
#endif
{
if (!_networking && _game_mode != GM_MENU) _fast_forward |= 2;