newgrf_railtype.h

Go to the documentation of this file.
00001 /* $Id$ */
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_RAILTYPE_H
00013 #define NEWGRF_RAILTYPE_H
00014 
00015 #include "rail.h"
00016 #include "newgrf_commons.h"
00017 #include "newgrf_spritegroup.h"
00018 
00020 struct RailTypeScopeResolver : public ScopeResolver {
00021   TileIndex tile;      
00022   TileContext context; 
00023 
00024   RailTypeScopeResolver(ResolverObject *ro, TileIndex tile, TileContext context);
00025 
00026   /* virtual */ uint32 GetRandomBits() const;
00027   /* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
00028 };
00029 
00031 struct RailTypeResolverObject : public ResolverObject {
00032   RailTypeScopeResolver railtype_scope; 
00033 
00034   RailTypeResolverObject(TileIndex tile, TileContext context, const GRFFile *grffile, uint32 param1 = 0, uint32 param2 = 0);
00035 
00036   /* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
00037   {
00038     switch (scope) {
00039       case VSG_SCOPE_SELF: return &this->railtype_scope;
00040       default:             return ResolverObject::GetScope(scope, relative);
00041     }
00042   }
00043 
00044   /* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const;
00045 };
00046 
00047 SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context = TCX_NORMAL);
00048 SpriteID GetCustomSignalSprite(const RailtypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui = false);
00049 
00050 uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile);
00051 
00052 #endif /* NEWGRF_RAILTYPE_H */