summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-02-20 21:00:24 +0000
committerfrosch <frosch@openttd.org>2011-02-20 21:00:24 +0000
commit77fa68c1da6f870137d686200d3962f91e3915d9 (patch)
tree97a4135988cb07404b6feb66933e5c912568718b /src/network
parent0eaa2ffa630d7ec21447af34ed9e7cbef76ccc50 (diff)
downloadopenttd-77fa68c1da6f870137d686200d3962f91e3915d9.tar.xz
(svn r22123) -Fix [FS#4522]: CommandQueue::Pop() did not update 'last'; popping the last item caused the queue to disconnect unless there was only one item.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_command.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/network/network_command.cpp b/src/network/network_command.cpp
index 8e1fa077b..d68021205 100644
--- a/src/network/network_command.cpp
+++ b/src/network/network_command.cpp
@@ -81,13 +81,16 @@ CommandPacket *CommandQueue::Pop(bool ignore_paused)
{
CommandPacket **prev = &this->first;
CommandPacket *ret = this->first;
+ CommandPacket *prev_item = NULL;
if (ignore_paused && _pause_mode != PM_UNPAUSED) {
while (ret != NULL && !IsCommandAllowedWhilePaused(ret->cmd)) {
+ prev_item = ret;
prev = &ret->next;
ret = ret->next;
}
}
if (ret != NULL) {
+ if (ret == this->last) this->last = prev_item;
*prev = ret->next;
this->count--;
}