mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 20:49:56 +00:00
69e8f9c9db
- renamed imp_client/ to clients/ and ditto for servers/ - renamed imp/ to servers/ - renamed stream/input.h to stream/stream.h - renamed Stream::InputStream to Stream::Stream - updated various tests and makefiles - NOT TESTED YET
32 lines
692 B
C++
32 lines
692 B
C++
#include "audiere_file.h"
|
|
|
|
using namespace audiere;
|
|
using namespace Mangle::Stream;
|
|
|
|
bool AudiereFile::seek(int pos, SeekMode mode)
|
|
{
|
|
assert(inp->isSeekable);
|
|
assert(inp->hasPosition);
|
|
|
|
int newPos;
|
|
|
|
switch(mode)
|
|
{
|
|
case BEGIN: newPos = pos; break;
|
|
case CURRENT: newPos = pos+tell(); break;
|
|
case END:
|
|
// Seeking from the end. This requires that we're able to get
|
|
// the entire size of the stream. The pos also has to be
|
|
// non-positive.
|
|
assert(inp->hasSize);
|
|
assert(pos <= 0);
|
|
newPos = inp->size() + pos;
|
|
break;
|
|
default:
|
|
assert(0 && "invalid seek mode");
|
|
}
|
|
|
|
inp->seek(newPos);
|
|
return inp->tell() == newPos;
|
|
|
|
}
|