mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-22 06:23:04 +01:00
Allow out-of-process edits to keymappings.json
Reloads keymappings.json on each client join. This allows for manual edits, so host can add keys without having to restart server for them to go live.
This commit is contained in:
@@ -1431,7 +1431,6 @@ void Network::SaveKeyMappings()
|
||||
|
||||
void Network::LoadKeyMappings()
|
||||
{
|
||||
group_list.clear();
|
||||
|
||||
utf8 path[MAX_PATH];
|
||||
|
||||
@@ -1441,6 +1440,7 @@ void Network::LoadKeyMappings()
|
||||
if (!platform_file_exists(path)) {
|
||||
return;
|
||||
}
|
||||
key_group_map.clear();
|
||||
|
||||
json_t * jsonKeyMappings = Json::ReadFromFile(path);
|
||||
|
||||
@@ -1900,6 +1900,8 @@ NetworkPlayer* Network::AddPlayer(const std::string &keyhash)
|
||||
newid = 0;
|
||||
}
|
||||
if (newid != -1) {
|
||||
// Load keys host may have added manually
|
||||
LoadKeyMappings();
|
||||
std::unique_ptr<NetworkPlayer> player(new NetworkPlayer); // change to make_unique in c++14
|
||||
player->id = newid;
|
||||
player->keyhash = keyhash;
|
||||
|
||||
Reference in New Issue
Block a user