1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 06:52:34 +02:00

rwengine: iwyu: fix TextureArchive and BinaryStream

This commit is contained in:
Anonymous Maarten 2017-10-30 23:58:24 +01:00 committed by Daniel Evans
parent 90acef28f7
commit 29188f26f2
4 changed files with 28 additions and 26 deletions

View File

@ -1,15 +1,15 @@
#include <BinaryStream.hpp>
#include "BinaryStream.hpp"
#include <cstring>
#include <fstream>
#include <iostream>
#include <rw/defines.hpp>
namespace RW {
std::unique_ptr<BinaryStream> BinaryStream::parse(const std::string &filename) {
std::ifstream dfile(filename, std::ios_base::binary);
if (!dfile.is_open()) {
std::cerr << "Error opening file " << filename << std::endl;
RW_ERROR("Error opening file " << filename);
return nullptr;
}
@ -18,7 +18,7 @@ std::unique_ptr<BinaryStream> BinaryStream::parse(const std::string &filename) {
dfile.seekg(0);
char *data = new char[length];
dfile.read(data, length);
// std::cout << "File is " << length << " bytes" << std::endl << std::endl;
// RW_MESSAGE("File is " << length << " bytes");
auto BS = std::make_unique<BinaryStream>();
@ -42,16 +42,15 @@ std::unique_ptr<BinaryStream> BinaryStream::parse(const std::string &filename) {
prevHeader->next = sec;
if (sectionHeader->ID == 0) {
std::cout << "Section ID is ZERO! Abort!" << std::endl;
RW_ERROR("Section ID is ZERO! Abort!");
break;
}
std::cout << "Section " << std::hex << sectionHeader->ID << " ("
RW_MESSAGE("Section " << std::hex << sectionHeader->ID << " ("
<< sectionIdString(sectionHeader->ID) << ")"
<< " - " << std::dec << sectionHeader->size << " bytes"
<< std::endl;
<< " - " << std::dec << sectionHeader->size << " bytes");
/*
std::cout << "Offset " << std::hex << offset << std::endl;
RW_MESSAGE("Offset " << std::hex << offset);
*/
size_t bytesOfData = 0;
@ -63,12 +62,10 @@ std::unique_ptr<BinaryStream> BinaryStream::parse(const std::string &filename) {
bytesOfData);
break;
}
// std::cout << "It has " << std::dec << bytesOfData << " bytes of
// data!" << std::endl;
// RW_MESSAGE("It has " << std::dec << bytesOfData
// << " bytes of data!");
offset += sizeof(nativeSectionHeader_t) + bytesOfData;
// std::cout << std::endl;
prevHeader = sec;
}

View File

@ -1,7 +1,7 @@
#pragma once
#ifndef _BINARYSTREAM_HPP_
#define _BINARYSTREAM_HPP_
#ifndef _RWENGINE_BINARYSTREAM_HPP_
#define _RWENGINE_BINARYSTREAM_HPP_
#include <cstdint>
#include <memory>
#include <string>
@ -38,4 +38,4 @@ public:
};
}
#endif
#endif

View File

@ -1,9 +1,12 @@
#include <TextureArchive.hpp>
#include "TextureArchive.hpp"
#include <cstddef>
#include <cstring>
#include <iostream>
#include <memory>
#include "rw/defines.hpp"
#include <rw/defines.hpp>
#include "BinaryStream.hpp"
namespace RW {

View File

@ -1,13 +1,15 @@
#pragma once
#ifndef _TEXTUREARCHIVE_HPP_
#define _TEXTUREARCHIVE_HPP_
#include <BinaryStream.hpp>
#ifndef _RWENGINE_TEXTUREARCHIVE_HPP_
#define _RWENGINE_TEXTUREARCHIVE_HPP_
#include <cstddef>
#include <cstdint>
#include <memory>
#include <vector>
namespace RW {
class BinaryStream;
class TextureArchive {
public:
struct TextureHeader {
@ -43,4 +45,4 @@ public:
};
}
#endif
#endif