2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file social_integration.h Interface definitions for game to report/respond to social integration. */
10 #ifndef SOCIAL_INTEGRATION_H
11 #define SOCIAL_INTEGRATION_H
13 class SocialIntegrationPlugin
{
16 RUNNING
, ///< The plugin is successfully loaded and running.
18 FAILED
, ///< The plugin failed to initialize.
19 PLATFORM_NOT_RUNNING
, ///< The plugin failed to initialize because the Social Platform is not running.
20 UNLOADED
, ///< The plugin is unloaded upon request.
21 DUPLICATE
, ///< Another plugin of the same Social Platform is already loaded.
22 UNSUPPORTED_API
, ///< The plugin does not support the current API version.
23 INVALID_SIGNATURE
, ///< The signature of the plugin is invalid.
26 std::string basepath
; ///< Base path of the plugin.
28 std::string social_platform
= "unknown"; ///< Social platform this plugin is for.
29 std::string name
= ""; ///< Name of the plugin.
30 std::string version
= ""; ///< Version of the plugin.
32 State state
= FAILED
; ///< Result of the plugin's init function.
34 SocialIntegrationPlugin(const std::string
&basepath
) : basepath(basepath
) {}
37 class SocialIntegration
{
40 * Get the list of loaded social integration plugins.
42 static std::vector
<SocialIntegrationPlugin
*> GetPlugins();
45 * Initialize the social integration system, loading any social integration plugins that are available.
47 static void Initialize();
50 * Shutdown the social integration system, and all social integration plugins that are loaded.
52 static void Shutdown();
55 * Allow any social integration library to handle their own events.
57 static void RunCallbacks();
60 * Event: user entered the main menu.
62 static void EventEnterMainMenu();
65 * Event: user entered the Scenario Editor.
67 static void EventEnterScenarioEditor(uint map_width
, uint map_height
);
70 * Event: user entered a singleplayer game.
72 static void EventEnterSingleplayer(uint map_width
, uint map_height
);
75 * Event: user entered a multiplayer game.
77 static void EventEnterMultiplayer(uint map_width
, uint map_height
);
80 * Event: user is joining a multiplayer game.
82 static void EventJoiningMultiplayer();
85 #endif /* SOCIAL_INTEGRATION_H */