summaryrefslogtreecommitdiff
path: root/src/fileio.cpp
diff options
context:
space:
mode:
authorRubidium <rubidium@openttd.org>2021-04-21 18:40:37 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-08 12:39:34 +0200
commitfa6abe16463de8f252bac2322c9f84b6d02c9abc (patch)
treed64fc1f91a6358200371d1e79d94ff585d154b38 /src/fileio.cpp
parent10e35ca8e4249a7f443b5c89dd9a59df83052d0d (diff)
downloadopenttd-fa6abe16463de8f252bac2322c9f84b6d02c9abc.tar.xz
Cleanup: remove the old FIO slot functions
Diffstat (limited to 'src/fileio.cpp')
-rw-r--r--src/fileio.cpp124
1 files changed, 0 insertions, 124 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp
index 6d5e2da28..bd05a4e7d 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -30,136 +30,12 @@
#include "safeguards.h"
-static SpriteFile *_fio_current_file; ///< current file handle for the Fio functions
-static std::array<SpriteFile *, MAX_FILE_SLOTS> _fio_files; ///< array of random access files we can have open
-
/** Whether the working directory should be scanned. */
static bool _do_scan_working_directory = true;
extern std::string _config_file;
extern std::string _highscore_file;
-/**
- * Transition helper to get the SpriteFile associated with a given slot.
- */
-SpriteFile *FioGetSpriteFile(int slot)
-{
- return _fio_files[slot];
-}
-
-/**
- * Get position in the current file.
- * @return Position in the file.
- */
-size_t FioGetPos()
-{
- return _fio_current_file->GetPos();
-}
-
-/**
- * Get the filename associated with a slot.
- * @param slot Index of queried file.
- * @return Name of the file.
- */
-const char *FioGetFilename(uint8 slot)
-{
- return _fio_current_file->GetSimplifiedFilename().c_str();
-}
-
-/**
- * Seek in the current file.
- * @param pos New position.
- * @param mode Type of seek (\c SEEK_CUR means \a pos is relative to current position, \c SEEK_SET means \a pos is absolute).
- */
-void FioSeekTo(size_t pos, int mode)
-{
- _fio_current_file->SeekTo(pos, mode);
-}
-
-/**
- * Switch to a different file and seek to a position.
- * @param slot Slot number of the new file.
- * @param pos New absolute position in the new file.
- */
-void FioSeekToFile(uint8 slot, size_t pos)
-{
- SpriteFile *file = _fio_files[slot];
- assert(file != nullptr);
- _fio_current_file = file;
- _fio_current_file->SeekTo(pos, SEEK_SET);
-}
-
-/**
- * Read a byte from the file.
- * @return Read byte.
- */
-byte FioReadByte()
-{
- return _fio_current_file->ReadByte();
-}
-
-/**
- * Skip \a n bytes ahead in the file.
- * @param n Number of bytes to skip reading.
- */
-void FioSkipBytes(int n)
-{
- return _fio_current_file->SkipBytes(n);
-}
-
-/**
- * Read a word (16 bits) from the file (in low endian format).
- * @return Read word.
- */
-uint16 FioReadWord()
-{
- return _fio_current_file->ReadWord();
-}
-
-/**
- * Read a double word (32 bits) from the file (in low endian format).
- * @return Read word.
- */
-uint32 FioReadDword()
-{
- return _fio_current_file->ReadDword();
-}
-
-/**
- * Read a block.
- * @param ptr Destination buffer.
- * @param size Number of bytes to read.
- */
-void FioReadBlock(void *ptr, size_t size)
-{
- _fio_current_file->ReadBlock(ptr, size);
-}
-
-/** Close all slotted open files. */
-void FioCloseAll()
-{
- for (int i = 0; i != lengthof(_fio_files); i++) {
- delete _fio_files[i];
- _fio_files[i] = nullptr;
- }
-}
-
-/**
- * Open a slotted file.
- * @param slot Index to assign.
- * @param filename Name of the file at the disk.
- * @param subdir The sub directory to search this file in.
- * @param palette_remap Whether palette remapping needs to take place.
- */
-SpriteFile &FioOpenFile(int slot, const std::string &filename, Subdirectory subdir, bool palette_remap)
-{
- SpriteFile *file = new SpriteFile(filename, subdir, palette_remap);
- delete _fio_files[slot];
- _fio_files[slot] = file;
- _fio_current_file = file;
- return *file;
-}
-
static const char * const _subdirs[] = {
"",
"save" PATHSEP,