Update: Translations from eints
[openttd-github.git] / src / spriteloader / sprite_file_type.hpp
blobcf2cbefa22271b01a9ec2c3c62eda918d0c4351b
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 */
8 /** @file sprite_file_type.hpp Random Access File specialised for accessing sprites. */
10 #ifndef SPRITE_FILE_TYPE_HPP
11 #define SPRITE_FILE_TYPE_HPP
13 #include "../random_access_file_type.h"
15 /**
16 * RandomAccessFile with some extra information specific for sprite files.
17 * It automatically detects and stores the container version upload opening the file.
19 class SpriteFile : public RandomAccessFile {
20 bool palette_remap; ///< Whether or not a remap of the palette is required for this file.
21 uint8_t container_version; ///< Container format of the sprite file.
22 size_t content_begin; ///< The begin of the content of the sprite file, i.e. after the container metadata.
23 public:
24 SpriteFile(const std::string &filename, Subdirectory subdir, bool palette_remap);
25 SpriteFile(const SpriteFile&) = delete;
26 void operator=(const SpriteFile&) = delete;
28 /**
29 * Whether a palette remap is needed when loading sprites from this file.
30 * @return True when needed, otherwise false.
32 bool NeedsPaletteRemap() const { return this->palette_remap; }
34 /**
35 * Get the version number of container type used by the file.
36 * @return The version.
38 uint8_t GetContainerVersion() const { return this->container_version; }
40 /**
41 * Seek to the begin of the content, i.e. the position just after the container version has been determined.
43 void SeekToBegin() { this->SeekTo(this->content_begin, SEEK_SET); }
46 #endif /* SPRITE_FILE_TYPE_HPP */