OpenTTD Source: src/spriteloader/sprite_file_type.hpp Source File

OpenTTD Source 12.0-beta1

sprite_file_type.hpp
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
6 */
7
10 #ifndef SPRITE_FILE_TYPE_HPP
11 #define SPRITE_FILE_TYPE_HPP
12
13 #include "../random_access_file_type.h"
14
19 class SpriteFile : public RandomAccessFile {
20 bool palette_remap;
21 byte container_version;
22 size_t content_begin;
23 public:
24 SpriteFile(const std::string &filename, Subdirectory subdir, bool palette_remap);
25 SpriteFile(const SpriteFile&) = delete;
26 void operator=(const SpriteFile&) = delete;
27
32 bool NeedsPaletteRemap() const { return this->palette_remap; }
33
38 byte GetContainerVersion() const { return this->container_version; }
39
43 void SeekToBegin() { this->SeekTo(this->content_begin, SEEK_SET); }
44 };
45
46 #endif /* SPRITE_FILE_TYPE_HPP */
SpriteFile::NeedsPaletteRemap
bool NeedsPaletteRemap() const
Whether a palette remap is needed when loading sprites from this file.
Definition: sprite_file_type.hpp:32
SpriteFile::container_version
byte container_version
Container format of the sprite file.
Definition: sprite_file_type.hpp:21
SpriteFile::GetContainerVersion
byte GetContainerVersion() const
Get the version number of container type used by the file.
Definition: sprite_file_type.hpp:38
SpriteFile::content_begin
size_t content_begin
The begin of the content of the sprite file, i.e. after the container metadata.
Definition: sprite_file_type.hpp:22
SpriteFile::SeekToBegin
void SeekToBegin()
Seek to the begin of the content, i.e.
Definition: sprite_file_type.hpp:43
RandomAccessFile::filename
std::string filename
Full name of the file; relative path to subdir plus the extension of the file.
Definition: random_access_file_type.h:27
SpriteFile::palette_remap
bool palette_remap
Whether or not a remap of the palette is required for this file.
Definition: sprite_file_type.hpp:20
SpriteFile
RandomAccessFile with some extra information specific for sprite files.
Definition: sprite_file_type.hpp:19
Subdirectory
Subdirectory
The different kinds of subdirectories OpenTTD uses.
Definition: fileio_type.h:108
RandomAccessFile::SeekTo
void SeekTo(size_t pos, int mode)
Seek in the current file.
Definition: random_access_file.cpp:83
SpriteFile::SpriteFile
SpriteFile(const std::string &filename, Subdirectory subdir, bool palette_remap)
Create the SpriteFile.
Definition: sprite_file.cpp:45
RandomAccessFile
A file from which bytes, words and double words are read in (potentially) a random order.
Definition: random_access_file_type.h:23