(svn r22563) -Codechange: Use a function for storing values inside the persistent storage.

This commit is contained in:
terkhen
2011-06-12 20:38:46 +00:00
parent dd8a436cbb
commit dc6218aa49
6 changed files with 45 additions and 7 deletions

View File

@@ -376,6 +376,19 @@ static void IndustrySetTriggers(const ResolverObject *object, int triggers)
ind->random_triggers = triggers;
}
/**
* Store a value into the object's persistent storage.
* @param object Object that we want to query.
* @param pos Position in the persistent storage to use.
* @param value Value to store.
*/
void IndustryStorePSA(ResolverObject *object, uint pos, int32 value)
{
Industry *ind = object->u.industry.ind;
if (object->scope != VSG_SCOPE_SELF || ind->index == INVALID_INDUSTRY) return;
ind->psa.Store(pos, value);
}
static void NewIndustryResolver(ResolverObject *res, TileIndex tile, Industry *indus, IndustryType type)
{
res->GetRandomBits = IndustryGetRandomBits;
@@ -383,8 +396,8 @@ static void NewIndustryResolver(ResolverObject *res, TileIndex tile, Industry *i
res->SetTriggers = IndustrySetTriggers;
res->GetVariable = IndustryGetVariable;
res->ResolveReal = IndustryResolveReal;
res->StorePSA = IndustryStorePSA;
res->psa = &indus->psa;
res->u.industry.tile = tile;
res->u.industry.ind = indus;
res->u.industry.gfx = INVALID_INDUSTRYTILE;