(svn r27724) -Cleanup: Remove pointless usage of IsOpenTTDBaseGRF. System GRFs are...
[openttd.git] / src / newgrf_town.h
blob145571e8ae829779729326451601ac40104bf0d1
1 /* $Id$ */
3 /*
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/>.
8 */
10 /** @file newgrf_town.h Functions to handle the town part of NewGRF towns. */
12 #ifndef NEWGRF_TOWN_H
13 #define NEWGRF_TOWN_H
15 #include "town_type.h"
16 #include "newgrf_spritegroup.h"
18 /**
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,
28 TownScopeResolver(ResolverObject &ro, Town *t, bool readonly);
30 virtual uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
31 virtual void StorePSA(uint reg, int32 value);
34 /** Resolver of town properties. */
35 struct TownResolverObject : public ResolverObject {
36 TownScopeResolver town_scope; ///< Scope resolver specific for towns.
38 TownResolverObject(const struct GRFFile *grffile, Town *t, bool readonly);
40 /* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
42 switch (scope) {
43 case VSG_SCOPE_SELF: return &town_scope;
44 default: return ResolverObject::GetScope(scope, relative);
49 #endif /* NEWGRF_TOWN_H */