OpenTTD Source  20241121-master-g67a0fccfad
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 */
@ PLATFORM_NOT_RUNNING
The plugin failed to initialize because the Social Platform is not running.
@ UNSUPPORTED_API
The plugin does not support the current API version.
@ RUNNING
The plugin is successfully loaded and running.
@ FAILED
The plugin failed to initialize.
@ DUPLICATE
Another plugin of the same Social Platform is already loaded.
@ INVALID_SIGNATURE
The signature of the plugin is invalid.
@ UNLOADED
The plugin is unloaded upon request.
std::string basepath
Base path of the plugin.
State state
Result of the plugin's init function.
std::string social_platform
Social platform this plugin is for.
std::string name
Name of the plugin.
std::string version
Version of the plugin.
static void EventEnterScenarioEditor(uint map_width, uint map_height)
Event: user entered the Scenario Editor.
static void EventEnterSingleplayer(uint map_width, uint map_height)
Event: user entered a singleplayer game.
static std::vector< SocialIntegrationPlugin * > GetPlugins()
Get the list of loaded social integration plugins.
static void RunCallbacks()
Allow any social integration library to handle their own events.
static void EventEnterMultiplayer(uint map_width, uint map_height)
Event: user entered a multiplayer game.
static void Shutdown()
Shutdown the social integration system, and all social integration plugins that are loaded.
static void EventEnterMainMenu()
Event: user entered the main menu.
static void EventJoiningMultiplayer()
Event: user is joining a multiplayer game.
static void Initialize()
Initialize the social integration system, loading any social integration plugins that are available.