|
|
/* $Id$ */
|
|
|
|
|
|
/** @file queue.cpp Implementation of the Queue/Hash. */
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
#include "openttd.h"
|
|
|
#include "queue.h"
|
|
|
#include "core/alloc_func.hpp"
|
|
|
|
|
|
|
|
|
/*
|
|
|
* Insertion Sorter
|
|
|
*/
|
|
|
|
|
|
static void InsSort_Clear(Queue *q, bool free_values)
|
|
|
{
|
|
|
InsSortNode *node = q->data.inssort.first;
|
|
|
InsSortNode *prev;
|
|
|
|
|
|
while (node != NULL) {
|
|
|
if (free_values) free(node->item);
|
|
|
prev = node;
|
|
|
node = node->next;
|
|
|
free(prev);
|
|
|
}
|
|
|
q->data.inssort.first = NULL;
|
|
|
}
|
|
|
|
|
|
static void InsSort_Free(Queue *q, bool free_values)
|
|
|
{
|