00001 /* $Id: newgrf_town.h 24693 2012-11-10 20:46:39Z alberth $ */ 00002 00003 /* 00004 * This file is part of OpenTTD. 00005 * 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. 00006 * 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. 00007 * 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/>. 00008 */ 00009 00012 #ifndef NEWGRF_TOWN_H 00013 #define NEWGRF_TOWN_H 00014 00015 #include "town_type.h" 00016 #include "newgrf_spritegroup.h" 00017 00024 struct TownScopeResolver : public ScopeResolver { 00025 Town *t; 00026 bool readonly; 00027 00028 TownScopeResolver(ResolverObject *ro, Town *t, bool readonly); 00029 00030 virtual uint32 GetVariable(byte variable, uint32 parameter, bool *available) const; 00031 virtual void StorePSA(uint reg, int32 value); 00032 }; 00033 00035 struct TownResolverObject : public ResolverObject { 00036 TownScopeResolver town_scope; 00037 00038 TownResolverObject(const struct GRFFile *grffile, Town *t, bool readonly); 00039 00040 /* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) 00041 { 00042 switch (scope) { 00043 case VSG_SCOPE_SELF: return &town_scope; 00044 default: return ResolverObject::GetScope(scope, relative); 00045 } 00046 } 00047 }; 00048 00049 #endif /* NEWGRF_TOWN_H */