src/newgrf_storage.cpp
author rubidium
Sat, 20 Oct 2007 17:11:02 +0000
changeset 8261 ed2ea3ac3edc
parent 8105 8f7fcf4d2b7e
child 6872 1c4a4a609f85
permissions -rw-r--r--
(svn r11314) -Fix [FS#1356]: stop following a vehicle when you sell/destroyed it.
/* $Id$ */

/** @file newgrf_storage.cpp Functionality related to the temporary and persistent storage arrays for NewGRFs. */

#include "stdafx.h"
#include "helpers.hpp"
#include "newgrf_storage.h"
#include <set>

/** The changed storage arrays */
static std::set<BaseStorageArray*> _changed_storage_arrays;

void AddChangedStorage(BaseStorageArray *storage)
{
	_changed_storage_arrays.insert(storage);
}

void ClearStorageChanges(bool keep_changes)
{
	/* Loop over all changes arrays */
	for (std::set<BaseStorageArray*>::iterator it = _changed_storage_arrays.begin(); it != _changed_storage_arrays.end(); it++) {
		(*it)->ClearChanges(keep_changes);
	}

	/* And then clear that array */
	_changed_storage_arrays.clear();
}