driver.cpp
Go to the documentation of this file.00001
00002
00005 #include "stdafx.h"
00006 #include "openttd.h"
00007 #include "debug.h"
00008 #include "driver.h"
00009
00010 #include "sound/sound_driver.hpp"
00011 #include "music/music_driver.hpp"
00012 #include "video/video_driver.hpp"
00013
00014 VideoDriver *_video_driver;
00015 char _ini_videodriver[32];
00016 int _num_resolutions;
00017 uint16 _resolutions[32][2];
00018 uint16 _cur_resolution[2];
00019
00020 SoundDriver *_sound_driver;
00021 char _ini_sounddriver[32];
00022
00023 MusicDriver *_music_driver;
00024 char _ini_musicdriver[32];
00025
00026 char _ini_blitter[32];
00027
00028 static const char* GetDriverParam(const char* const* parm, const char* name)
00029 {
00030 size_t len;
00031
00032 if (parm == NULL) return NULL;
00033
00034 len = strlen(name);
00035 for (; *parm != NULL; parm++) {
00036 const char* p = *parm;
00037
00038 if (strncmp(p, name, len) == 0) {
00039 if (p[len] == '=') return p + len + 1;
00040 if (p[len] == '\0') return p + len;
00041 }
00042 }
00043 return NULL;
00044 }
00045
00046 bool GetDriverParamBool(const char* const* parm, const char* name)
00047 {
00048 return GetDriverParam(parm, name) != NULL;
00049 }
00050
00051 int GetDriverParamInt(const char* const* parm, const char* name, int def)
00052 {
00053 const char* p = GetDriverParam(parm, name);
00054 return p != NULL ? atoi(p) : def;
00055 }