src/newgrf_storage.cpp
branchNewGRF_ports
changeset 6870 ca3fd1fbe311
child 6872 1c4a4a609f85
equal deleted inserted replaced
6869:76282d3b748d 6870:ca3fd1fbe311
       
     1 /* $Id$ */
       
     2 
       
     3 /** @file newgrf_storage.cpp Functionality related to the temporary and persistent storage arrays for NewGRFs. */
       
     4 
       
     5 #include "stdafx.h"
       
     6 #include "helpers.hpp"
       
     7 #include "newgrf_storage.h"
       
     8 #include <set>
       
     9 
       
    10 /** The changed storage arrays */
       
    11 static std::set<BaseStorageArray*> _changed_storage_arrays;
       
    12 
       
    13 void AddChangedStorage(BaseStorageArray *storage)
       
    14 {
       
    15 	_changed_storage_arrays.insert(storage);
       
    16 }
       
    17 
       
    18 void ClearStorageChanges(bool keep_changes)
       
    19 {
       
    20 	/* Loop over all changes arrays */
       
    21 	for (std::set<BaseStorageArray*>::iterator it = _changed_storage_arrays.begin(); it != _changed_storage_arrays.end(); it++) {
       
    22 		(*it)->ClearChanges(keep_changes);
       
    23 	}
       
    24 
       
    25 	/* And then clear that array */
       
    26 	_changed_storage_arrays.clear();
       
    27 }