OpenTTD: src/newgrf_railtype.h Source File

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

newgrf_railtype.h
Go to the documentation of this file.
1 /* $Id: newgrf_railtype.h 27342 2015-07-26 12:25:37Z frosch $ */
2
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 */
9
12 #ifndef NEWGRF_RAILTYPE_H
13 #define NEWGRF_RAILTYPE_H
14
15 #include "rail.h"
16 #include "newgrf_commons.h"
17 #include "newgrf_spritegroup.h"
18
20 struct RailTypeScopeResolver : public ScopeResolver {
21 TileIndex tile;
22 TileContext context;
23
24 RailTypeScopeResolver(ResolverObject &ro, TileIndex tile, TileContext context);
25
26 /* virtual */ uint32 GetRandomBits() const;
27 /* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
28 };
29
31 struct RailTypeResolverObject : public ResolverObject {
32 RailTypeScopeResolver railtype_scope;
33
34 RailTypeResolverObject(const RailtypeInfo *rti, TileIndex tile, TileContext context, RailTypeSpriteGroup rtsg, uint32 param1 = 0, uint32 param2 = 0);
35
36 /* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
37 {
38 switch (scope) {
39 case VSG_SCOPE_SELF: return &this->railtype_scope;
40 default: return ResolverObject::GetScope(scope, relative);
41 }
42 }
43
44 /* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const;
45 };
46
47 SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context = TCX_NORMAL, uint *num_results = NULL);
48 SpriteID GetCustomSignalSprite(const RailtypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui = false);
49
50 uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile);
51
52 #endif /* NEWGRF_RAILTYPE_H */