mirror of
https://codeberg.org/icewind/vbsp.git
synced 2026-06-04 19:14:08 +02:00
include Lump version in LumpReader
This commit is contained in:
parent
75728cfab6
commit
8d2ea3d6fb
4 changed files with 27 additions and 11 deletions
|
|
@ -34,12 +34,16 @@ impl<'a> BspFile<'a> {
|
|||
}
|
||||
|
||||
pub fn lump_reader(&self, lump: LumpType) -> BspResult<LumpReader<Cursor<Cow<[u8]>>>> {
|
||||
let data = self.get_lump(lump)?;
|
||||
Ok(LumpReader::new(data, lump))
|
||||
let entry = self.get_lump_entry(lump);
|
||||
let data = self.get_lump(entry)?;
|
||||
Ok(LumpReader::new(data, lump, entry.version))
|
||||
}
|
||||
|
||||
pub fn get_lump(&self, lump: LumpType) -> BspResult<Cow<[u8]>> {
|
||||
let lump = &self.directories[lump];
|
||||
pub fn get_lump_entry(&self, lump: LumpType) -> &LumpEntry {
|
||||
&self.directories[lump]
|
||||
}
|
||||
|
||||
pub fn get_lump(&self, lump: &LumpEntry) -> BspResult<Cow<[u8]>> {
|
||||
let raw_data = self
|
||||
.data
|
||||
.get(lump.offset as usize..lump.offset as usize + lump.length as usize)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue