MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SeekTo

Method SeekTo

src/random_access_file.cpp:90–101  ·  view source on GitHub ↗

* 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). */

Source from the content-addressed store, hash-verified

88 * @param mode Type of seek (\c SEEK_CUR means \a pos is relative to current position, \c SEEK_SET means \a pos is absolute).
89 */
90void RandomAccessFile::SeekTo(size_t pos, int mode)
91{
92 if (mode == SEEK_CUR) pos += this->GetPos();
93
94 this->pos = pos;
95 if (fseek(*this->file_handle, this->pos, SEEK_SET) < 0) {
96 Debug(misc, 0, "Seeking in {} failed", this->filename);
97 }
98
99 /* Reset the buffer, so the next ReadByte will read bytes from the file. */
100 this->buffer = this->buffer_end = this->buffer_start;
101}
102
103/**
104 * Read a byte from the file.

Callers 15

RandomAccessFileMethod · 0.95
SkipBytesMethod · 0.95
LoadMethod · 0.80
DecodeSpecialSpriteFunction · 0.80
LoadNewGRFSoundFunction · 0.80
ReadRecolourSpriteFunction · 0.80
ReadGRFSpriteOffsetsFunction · 0.80
BmpReadBitmapFunction · 0.80
GetMusicCatEntryNameFunction · 0.80
GetMusicCatEntryDataFunction · 0.80
OpenBankFileFunction · 0.80
LoadSoundDataFunction · 0.80

Calls 1

GetPosMethod · 0.95

Tested by

no test coverage detected