(svn r22567) -Codechange: Store persistent storages inside a pool.

This commit is contained in:
terkhen
2011-06-12 20:47:45 +00:00
parent 9f55abf51a
commit 00e5c1df18
23 changed files with 257 additions and 27 deletions

View File

@@ -158,7 +158,19 @@ void IndustryTileStorePSA(ResolverObject *object, uint pos, int32 value)
{
Industry *ind = object->u.industry.ind;
if (object->scope != VSG_SCOPE_PARENT || ind->index == INVALID_INDUSTRY) return;
ind->psa.StoreValue(pos, value);
if (ind->psa == NULL) {
/* There is no need to create a storage if the value is zero. */
if (value == 0) return;
/* Create storage on first modification. */
const IndustrySpec *indsp = GetIndustrySpec(ind->type);
uint32 grfid = (indsp->grf_prop.grffile != NULL) ? indsp->grf_prop.grffile->grfid : 0;
assert(PersistentStorage::CanAllocateItem());
ind->psa = new PersistentStorage(grfid);
}
ind->psa->StoreValue(pos, value);
}
static void NewIndustryTileResolver(ResolverObject *res, IndustryGfx gfx, TileIndex tile, Industry *indus)