OpenTTD Source  14.0-beta3
social_integration.h
Go to the documentation of this file.
1 /*
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/>.
6  */
7 
10 #ifndef SOCIAL_INTEGRATION_H
11 #define SOCIAL_INTEGRATION_H
12 
14 public:
15  enum State {
17 
24  };
25 
26  std::string basepath;
27 
28  std::string social_platform = "unknown";
29  std::string name = "";
30  std::string version = "";
31 
33 
34  SocialIntegrationPlugin(const std::string &basepath) : basepath(basepath) {}
35 };
36 
38 public:
42  static std::vector<SocialIntegrationPlugin *> GetPlugins();
43 
47  static void Initialize();
48 
52  static void Shutdown();
53 
57  static void RunCallbacks();
58 
62  static void EventEnterMainMenu();
63 
67  static void EventEnterScenarioEditor(uint map_width, uint map_height);
68 
72  static void EventEnterSingleplayer(uint map_width, uint map_height);
73 
77  static void EventEnterMultiplayer(uint map_width, uint map_height);
78 
82  static void EventJoiningMultiplayer();
83 };
84 
85 #endif /* SOCIAL_INTEGRATION_H */
SocialIntegration
Definition: social_integration.h:37
SocialIntegrationPlugin::FAILED
@ FAILED
The plugin failed to initialize.
Definition: social_integration.h:18
SocialIntegrationPlugin::name
std::string name
Name of the plugin.
Definition: social_integration.h:29
SocialIntegration::EventEnterSingleplayer
static void EventEnterSingleplayer(uint map_width, uint map_height)
Event: user entered a singleplayer game.
Definition: social_integration.cpp:227
SocialIntegrationPlugin::state
State state
Result of the plugin's init function.
Definition: social_integration.h:32
SocialIntegrationPlugin::basepath
std::string basepath
Base path of the plugin.
Definition: social_integration.h:26
SocialIntegrationPlugin::INVALID_SIGNATURE
@ INVALID_SIGNATURE
The signature of the plugin is invalid.
Definition: social_integration.h:23
SocialIntegrationPlugin::UNLOADED
@ UNLOADED
The plugin is unloaded upon request.
Definition: social_integration.h:20
SocialIntegrationPlugin
Definition: social_integration.h:13
SocialIntegrationPlugin::DUPLICATE
@ DUPLICATE
Another plugin of the same Social Platform is already loaded.
Definition: social_integration.h:21
SocialIntegration::Shutdown
static void Shutdown()
Shutdown the social integration system, and all social integration plugins that are loaded.
Definition: social_integration.cpp:184
SocialIntegration::EventEnterMultiplayer
static void EventEnterMultiplayer(uint map_width, uint map_height)
Event: user entered a multiplayer game.
Definition: social_integration.cpp:234
SocialIntegrationPlugin::RUNNING
@ RUNNING
The plugin is successfully loaded and running.
Definition: social_integration.h:16
SocialIntegration::EventEnterScenarioEditor
static void EventEnterScenarioEditor(uint map_width, uint map_height)
Event: user entered the Scenario Editor.
Definition: social_integration.cpp:220
SocialIntegrationPlugin::version
std::string version
Version of the plugin.
Definition: social_integration.h:30
SocialIntegration::EventJoiningMultiplayer
static void EventJoiningMultiplayer()
Event: user is joining a multiplayer game.
Definition: social_integration.cpp:241
SocialIntegration::EventEnterMainMenu
static void EventEnterMainMenu()
Event: user entered the main menu.
Definition: social_integration.cpp:213
SocialIntegration::RunCallbacks
static void RunCallbacks()
Allow any social integration library to handle their own events.
Definition: social_integration.cpp:194
SocialIntegrationPlugin::UNSUPPORTED_API
@ UNSUPPORTED_API
The plugin does not support the current API version.
Definition: social_integration.h:22
SocialIntegration::Initialize
static void Initialize()
Initialize the social integration system, loading any social integration plugins that are available.
Definition: social_integration.cpp:160
SocialIntegrationPlugin::PLATFORM_NOT_RUNNING
@ PLATFORM_NOT_RUNNING
The plugin failed to initialize because the Social Platform is not running.
Definition: social_integration.h:19
SocialIntegrationPlugin::social_platform
std::string social_platform
Social platform this plugin is for.
Definition: social_integration.h:28
SocialIntegrationPlugin::State
State
Definition: social_integration.h:15
SocialIntegration::GetPlugins
static std::vector< SocialIntegrationPlugin * > GetPlugins()
Get the list of loaded social integration plugins.
Definition: social_integration.cpp:149