mirror of https://github.com/OpenTTD/OpenTTD.git
(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.
This commit is contained in:
parent
0eaa2ffa63
commit
77fa68c1da
|
@ -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--;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue