diff options
author | yexo <yexo@openttd.org> | 2011-12-11 11:47:08 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2011-12-11 11:47:08 +0000 |
commit | b4fdba2fb3afcb80e419c048504a118ec8376c09 (patch) | |
tree | 036ce622e3bfe2b3176bfe3eecab55f9a943051b /src/openttd.cpp | |
parent | 0143f00d6fbe33f1de293c4149bf8ad05bac4d8a (diff) | |
download | openttd-b4fdba2fb3afcb80e419c048504a118ec8376c09.tar.xz |
(svn r23490) -Add [FS#2750]: OpenBrowser function to open a browser on major OSes
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index a902d197d..f6b00e421 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -359,6 +359,15 @@ void MakeNewgameSettingsLive() } } +void OpenBrowser(const char *url) +{ + /* Make sure we only accept urls that are sure to open a browser. */ + if (strstr(url, "http://") != url && strstr(url, "https://") != url) return; + + extern void OSOpenBrowser(const char *url); + OSOpenBrowser(url); +} + /** Callback structure of statements to be executed after the NewGRF scan. */ struct AfterNewGRFScan : NewGRFScanCallback { Year startyear; ///< The start year. |