diff --git a/src/gamestate/commands.cpp b/src/gamestate/commands.cpp index 3fc48c93a..73e87356a 100644 --- a/src/gamestate/commands.cpp +++ b/src/gamestate/commands.cpp @@ -4289,8 +4289,9 @@ void notify_player_picks_nation(sys::state& state, dcon::nation_id source, dcon: add_to_command_queue(state, p); } bool can_notify_player_picks_nation(sys::state& state, dcon::nation_id source, dcon::nation_id target) { - // Invalid OR rebel nation - if(!bool(target) || target == state.national_definitions.rebel_id) + if(source == target) //redundant + return false; + if(!bool(target) || target == state.national_definitions.rebel_id) //Invalid OR rebel nation return false; // TODO: Support Co-op (one day) return state.world.nation_get_is_player_controlled(target) == false; diff --git a/src/network/network.cpp b/src/network/network.cpp index 4cd6a4c08..e9c6e4506 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -421,6 +421,18 @@ static void send_post_handshake_commands(sys::state& state, network::client_data std::vector tmp = client.send_buffer; client.send_buffer.clear(); if(state.mode == sys::game_mode_type::pick_nation) { + /* Send the savefile to the newly connected client (if not a new game) */ + if(!state.network_state.is_new_game) { + command::payload c; + memset(&c, 0, sizeof(command::payload)); + c.type = command::command_type::notify_save_loaded; + c.source = state.local_player_nation; + c.data.notify_save_loaded.target = client.playing_as; + network::broadcast_save_to_clients(state, c, state.network_state.current_save_buffer.get(), state.network_state.current_save_length, state.network_state.current_save_checksum); +#ifndef NDEBUG + state.console_log("host:send:cmd: (new(2)->save_loaded)"); +#endif + } { /* Tell this client about every other client */ command::payload c; memset(&c, 0, sizeof(c)); @@ -444,18 +456,6 @@ static void send_post_handshake_commands(sys::state& state, network::client_data } } } - /* Send the savefile to the newly connected client (if not a new game) */ - if(!state.network_state.is_new_game) { - command::payload c; - memset(&c, 0, sizeof(command::payload)); - c.type = command::command_type::notify_save_loaded; - c.source = state.local_player_nation; - c.data.notify_save_loaded.target = client.playing_as; - network::broadcast_save_to_clients(state, c, state.network_state.current_save_buffer.get(), state.network_state.current_save_length, state.network_state.current_save_checksum); -#ifndef NDEBUG - state.console_log("host:send:cmd: (new(2)->save_loaded)"); -#endif - } } else if(state.mode == sys::game_mode_type::in_game || state.mode == sys::game_mode_type::select_states) { { /* Tell this client about every other client */ command::payload c; @@ -960,7 +960,7 @@ void kick_player(sys::state& state, client_data& client) { void switch_player(sys::state& state, dcon::nation_id new_n, dcon::nation_id old_n) { state.network_state.map_of_player_names.insert_or_assign(new_n.index(), state.network_state.map_of_player_names[old_n.index()]); - if(state.network_mode != sys::network_mode_type::host) { + if(state.network_mode == sys::network_mode_type::host) { for(auto& client : state.network_state.clients) { if(!client.is_active()) continue;