1 /* $Id: newgrf_town.h 26085 2013-11-24 14:41:19Z frosch $ */
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
10 /** @file newgrf_town.h Functions to handle the town part of NewGRF towns. */
15 #include "town_type.h"
16 #include "newgrf_spritegroup.h"
19 * Scope resolver for a town.
20 * @note Currently there is no direct town resolver; we only need to get town
21 * variable results from inside stations, house tiles and industries,
22 * and to check the town's persistent storage.
24 struct TownScopeResolver
: public ScopeResolver
{
25 Town
*t
; ///< %Town of the scope.
26 bool readonly
; ///< When set, persistent storage of the town is read-only,
29 * Resolver of a town scope.
30 * @param ro Surrounding resolver.
31 * @param t %Town of the scope.
32 * @param readonly Scope may change persistent storage of the town.
34 TownScopeResolver(ResolverObject
&ro
, Town
*t
, bool readonly
)
35 : ScopeResolver(ro
), t(t
), readonly(readonly
)
39 virtual uint32
GetVariable(byte variable
, uint32 parameter
, bool *available
) const;
40 virtual void StorePSA(uint reg
, int32 value
);
43 /** Resolver of town properties. */
44 struct TownResolverObject
: public ResolverObject
{
45 TownScopeResolver town_scope
; ///< Scope resolver specific for towns.
47 TownResolverObject(const struct GRFFile
*grffile
, Town
*t
, bool readonly
);
49 /* virtual */ ScopeResolver
*GetScope(VarSpriteGroupScope scope
= VSG_SCOPE_SELF
, byte relative
= 0)
52 case VSG_SCOPE_SELF
: return &town_scope
;
53 default: return ResolverObject::GetScope(scope
, relative
);
58 #endif /* NEWGRF_TOWN_H */