Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Problem
There's long been interest in being able to "broadcast" your status of playing OpenTTD and possibly being in a multiplayer server, to friends on Discord and similar social platforms. This is even more relevant with the recent Steam release, where features that could allow friends to join your current game, or you to directly send invites, would be popular.
Description
This PR adds a generic interface for OpenTTD to load a "social plugin", an external dynamic library that implements whatever integration. This PR does not integrate with anything in itself. This level of indirection is to avoid having to potentially link OpenTTD directly with proprietary libraries that might not be compatible with GPL.
A proof-of-concept integration for Discord is here: https://github.com/nielsmh/ottd-discord
Limitations
Can only load one social plugin currently, it might be better to support loading and updating any number of social plugins, for example to have Steam and Discord integrations active at the same time.
Needs a per-platform loader for the social plugins, that finds and loads the dynamic libraries. Currently only implemented for Win32.
Support for game invites is not complete, some more specification is needed there.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.
The bug fix is important enough to be backported? (label: 'backport requested')This PR affects the save game format? (label 'savegame upgrade')This PR affects the NewGRF API? (label 'needs review: NewGRF')