1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +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:
Michał Janiszewski
2016-05-24 15:07:03 +02:00
parent 65a1d0c70d
commit 9b4d385ab5

View File

@@ -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;