OpenTTD
newgrf_roadtype.h
Go to the documentation of this file.
1 /* $Id$ */
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_ROADTYPE_H
13 #define NEWGRF_ROADTYPE_H
14 
15 #include "road.h"
16 #include "newgrf_commons.h"
17 #include "newgrf_spritegroup.h"
18 
23 
25 
26  /* virtual */ uint32 GetRandomBits() const;
27  /* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
28 };
29 
33 
34  RoadTypeResolverObject(const RoadTypeInfo *rti, TileIndex tile, TileContext context, RoadTypeSpriteGroup 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->roadtype_scope;
40  default: return ResolverObject::GetScope(scope, relative);
41  }
42  }
43 
44  /* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const;
45 };
46 
48 
49 uint8 GetReverseRoadTypeTranslation(RoadType roadtype, const GRFFile *grffile);
50 
51 #endif /* NEWGRF_ROADTYPE_H */
Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope)...
ResolverObject & ro
Surrounding resolver object.
VarSpriteGroupScope
RoadTypeSpriteGroup
Sprite groups for a roadtype.
Definition: road.h:59
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, byte relative=0)
Get a resolver for the scope.
Interface for SpriteGroup-s to access the gamestate.
Road specific functions.
TileContext context
Are we resolving sprites for the upper halftile, or on a bridge?
Resolver for the railtype scope.
virtual ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, byte relative=0)
Get a resolver for the scope.
uint32 GetRandomBits() const
Get a few random bits.
Nothing special.
RoadType
The different roadtypes we support.
Definition: road_type.h:27
SpriteID GetCustomRoadSprite(const RoadTypeInfo *rti, TileIndex tile, RoadTypeSpriteGroup rtsg, TileContext context=TCX_NORMAL, uint *num_results=nullptr)
Get the sprite to draw for the given tile.
uint32 GetVariable(byte variable, uint32 parameter, bool *available) const
Get a variable value.
Action 2 handling.
uint8 GetReverseRoadTypeTranslation(RoadType roadtype, const GRFFile *grffile)
Perform a reverse roadtype lookup to get the GRF internal ID.
TileIndex tile
Tracktile. For track on a bridge this is the southern bridgehead.
Resolved object itself.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:19
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
RoadTypeScopeResolver roadtype_scope
Resolver for the roadtype scope.
Resolver object for road types.
RoadTypeScopeResolver(ResolverObject &ro, TileIndex tile, TileContext context)
Constructor of the roadtype scope resolvers.
This file simplyfies and embeds a common mechanism of loading/saving and mapping of grf entities...
Dynamic data of a loaded NewGRF.
Definition: newgrf.h:107
TileContext
Context for tile accesses.