|
OpenTTD Source
13.2.1
|
RandomAccessFile with some extra information specific for sprite files. More...
#include <sprite_file_type.hpp>
Public Member Functions | |
| SpriteFile (const std::string &filename, Subdirectory subdir, bool palette_remap) | |
| Create the SpriteFile. More... | |
| SpriteFile (const SpriteFile &)=delete | |
| void | operator= (const SpriteFile &)=delete |
| bool | NeedsPaletteRemap () const |
| Whether a palette remap is needed when loading sprites from this file. More... | |
| byte | GetContainerVersion () const |
| Get the version number of container type used by the file. More... | |
| void | SeekToBegin () |
| Seek to the begin of the content, i.e. More... | |
Public Member Functions inherited from RandomAccessFile | |
| RandomAccessFile (const std::string &filename, Subdirectory subdir) | |
| Create the RandomAccesFile. More... | |
| RandomAccessFile (const RandomAccessFile &)=delete | |
| void | operator= (const RandomAccessFile &)=delete |
| virtual | ~RandomAccessFile () |
| Close the file's file handle. | |
| const std::string & | GetFilename () const |
| Get the filename of the opened file with the path from the SubDirectory and the extension. More... | |
| const std::string & | GetSimplifiedFilename () const |
| Get the simplified filename of the opened file. More... | |
| size_t | GetPos () const |
| Get position in the file. More... | |
| void | SeekTo (size_t pos, int mode) |
| Seek in the current file. More... | |
| byte | ReadByte () |
| Read a byte from the file. More... | |
| uint16 | ReadWord () |
| Read a word (16 bits) from the file (in low endian format). More... | |
| uint32 | ReadDword () |
| Read a double word (32 bits) from the file (in low endian format). More... | |
| void | ReadBlock (void *ptr, size_t size) |
| Read a block. More... | |
| void | SkipBytes (int n) |
| Skip n bytes ahead in the file. More... | |
Private Attributes | |
| bool | palette_remap |
| Whether or not a remap of the palette is required for this file. | |
| byte | container_version |
| Container format of the sprite file. | |
| size_t | content_begin |
| The begin of the content of the sprite file, i.e. after the container metadata. | |
RandomAccessFile with some extra information specific for sprite files.
It automatically detects and stores the container version upload opening the file.
Definition at line 19 of file sprite_file_type.hpp.
| SpriteFile::SpriteFile | ( | const std::string & | filename, |
| Subdirectory | subdir, | ||
| bool | palette_remap | ||
| ) |
Create the SpriteFile.
| filename | Name of the file at the disk. |
| subdir | The sub directory to search this file in. |
| palette_remap | Whether a palette remap needs to be performed for this file. |
Definition at line 45 of file sprite_file.cpp.
References container_version, content_begin, GetGRFContainerVersion(), and RandomAccessFile::GetPos().
|
inline |
Get the version number of container type used by the file.
Definition at line 38 of file sprite_file_type.hpp.
References container_version.
Referenced by LoadGrfFile(), LoadGrfFileIndexed(), LoadNextSprite(), and ReadGRFSpriteOffsets().
|
inline |
Whether a palette remap is needed when loading sprites from this file.
Definition at line 32 of file sprite_file_type.hpp.
References palette_remap.
|
inline |
Seek to the begin of the content, i.e.
the position just after the container version has been determined.
Definition at line 43 of file sprite_file_type.hpp.
References RandomAccessFile::SeekTo().