mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r2591) Codechange: [network] Cleanup NetworkHandleCommandQueue
This commit is contained in:
parent
bd974bb443
commit
11d9f50115
@ -1485,27 +1485,13 @@ bool NetworkServer_ReadPackets(NetworkClientState *cs)
|
||||
|
||||
// Handle the local command-queue
|
||||
void NetworkHandleCommandQueue(NetworkClientState *cs) {
|
||||
if (cs->command_queue != NULL) {
|
||||
CommandPacket *cp;
|
||||
CommandPacket *cp_prev;
|
||||
|
||||
cp = cs->command_queue;
|
||||
cp_prev = NULL;
|
||||
|
||||
while (cp != NULL) {
|
||||
while ( (cp = cs->command_queue) != NULL) {
|
||||
SEND_COMMAND(PACKET_SERVER_COMMAND)(cs, cp);
|
||||
|
||||
if (cp_prev != NULL) {
|
||||
cp_prev->next = cp->next;
|
||||
free(cp);
|
||||
cp = cp_prev->next;
|
||||
} else {
|
||||
// This means we are at our first packet
|
||||
cs->command_queue = cp->next;
|
||||
free(cp);
|
||||
cp = cs->command_queue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user