Skip to content

Commit f46bdeb

Browse files
authored
Merge pull request #2063 from ZombieFreak115/main
Fix pre-emptive command validation in MP
2 parents ad0ab92 + 7704850 commit f46bdeb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/network/network.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,13 +1381,12 @@ int server_process_handshake(sys::state& state, network::client_data& client) {
13811381
return r;
13821382
}
13831383

1384-
int server_process_commands(sys::state& state, network::client_data& client) {
1384+
int server_process_client_commands(sys::state& state, network::client_data& client) {
13851385
int r = socket_recv(client.socket_fd, &client.recv_buffer, sizeof(client.recv_buffer), &client.recv_count, [&]() {
13861386
switch(client.recv_buffer.type) {
13871387
// client can notify the host that they are loaded without needing to check the num of clients loading
13881388
case command::command_type::notify_player_fully_loaded:
1389-
if(client.recv_buffer.source == client.playing_as
1390-
&& command::can_perform_command(state, client.recv_buffer)) {
1389+
if(client.recv_buffer.source == client.playing_as) {
13911390
state.network_state.outgoing_commands.push(client.recv_buffer);
13921391
}
13931392
break;
@@ -1408,7 +1407,6 @@ int server_process_commands(sys::state& state, network::client_data& client) {
14081407
/* Has to be from the nation of the client proper - and early
14091408
discard invalid commands, and no clients must be currently loading */
14101409
if(client.recv_buffer.source == client.playing_as
1411-
&& command::can_perform_command(state, client.recv_buffer)
14121410
&& !network::check_any_players_loading(state)) {
14131411
state.network_state.outgoing_commands.push(client.recv_buffer);
14141412
}
@@ -1443,7 +1441,7 @@ static void receive_from_clients(sys::state& state) {
14431441

14441442
int commandspertick = 0;
14451443
while(r == 0 && commandspertick < 10) {
1446-
r = server_process_commands(state, client);
1444+
r = server_process_client_commands(state, client);
14471445
commandspertick++;
14481446
}
14491447

0 commit comments

Comments
 (0)