mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-20 04:59:11 +00:00
(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:
@@ -81,13 +81,16 @@ CommandPacket *CommandQueue::Pop(bool ignore_paused)
|
|||||||
{
|
{
|
||||||
CommandPacket **prev = &this->first;
|
CommandPacket **prev = &this->first;
|
||||||
CommandPacket *ret = this->first;
|
CommandPacket *ret = this->first;
|
||||||
|
CommandPacket *prev_item = NULL;
|
||||||
if (ignore_paused && _pause_mode != PM_UNPAUSED) {
|
if (ignore_paused && _pause_mode != PM_UNPAUSED) {
|
||||||
while (ret != NULL && !IsCommandAllowedWhilePaused(ret->cmd)) {
|
while (ret != NULL && !IsCommandAllowedWhilePaused(ret->cmd)) {
|
||||||
|
prev_item = ret;
|
||||||
prev = &ret->next;
|
prev = &ret->next;
|
||||||
ret = ret->next;
|
ret = ret->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
|
if (ret == this->last) this->last = prev_item;
|
||||||
*prev = ret->next;
|
*prev = ret->next;
|
||||||
this->count--;
|
this->count--;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user