Skip to content

Commit

Permalink
Added virtual, override, and default to various methods.
Browse files Browse the repository at this point in the history
The standard says that derived methods that should be virtual (because
of a virtual base method) but have no "virtual" keyword are implicitly
virtual.
  • Loading branch information
afritz1 committed Apr 10, 2018
1 parent 9f1954c commit 3072f18
Show file tree
Hide file tree
Showing 38 changed files with 194 additions and 250 deletions.
18 changes: 9 additions & 9 deletions fileformats/ART_Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ class ART_Reader : public Archive
public:
ART_Reader();

bool Open(const char *pszName);
void Close();
virtual bool Open(const char *pszName) override;
virtual void Close() override;

bool OpenFile(const char *pszFile);
void CloseFile();
uint32_t GetFileLen();
bool ReadFile(void *pData, uint32_t uLength);
virtual bool OpenFile(const char *pszFile) override;
virtual void CloseFile() override;
virtual uint32_t GetFileLen() override;
virtual bool ReadFile(void *pData, uint32_t uLength) override;

int32_t GetFileCount();
const char *GetFileName(int32_t nFileIdx);
virtual int32_t GetFileCount() override;
virtual const char *GetFileName(int32_t nFileIdx) override;

void *ReadFileInfo();
virtual void *ReadFileInfo() override;

private:

Expand Down
22 changes: 11 additions & 11 deletions fileformats/BSA_Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ class BSA_Reader : public Archive
public:
BSA_Reader();

bool Open(const char *pszName);
void Close();
virtual bool Open(const char *pszName) override;
virtual void Close() override;

bool OpenFile(const char *pszFile);
bool OpenFile(const uint32_t uID);
bool SearchForFile(const char *pszFileIn, char *pszFileOut);
void CloseFile();
uint32_t GetFileLen();
bool ReadFile(void *pData, uint32_t uLength);
virtual bool OpenFile(const char *pszFile) override;
virtual bool OpenFile(const uint32_t uID) override;
virtual bool SearchForFile(const char *pszFileIn, char *pszFileOut) override;
virtual void CloseFile() override;
virtual uint32_t GetFileLen() override;
virtual bool ReadFile(void *pData, uint32_t uLength) override;

int32_t GetFileCount();
const char *GetFileName(int32_t nFileIdx);
uint32_t GetFileID(int32_t nFileIdx);
virtual int32_t GetFileCount() override;
virtual const char *GetFileName(int32_t nFileIdx) override;
virtual uint32_t GetFileID(int32_t nFileIdx) override;

private:

Expand Down
8 changes: 4 additions & 4 deletions fileformats/CellLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class World;
class CellLoader
{
public:
CellLoader() {};
virtual ~CellLoader() {};
CellLoader() = default;
virtual ~CellLoader() = default;

//returns true if this CellLoader handles file handling itself.
virtual bool UsesOwnFiles() { return false; }
//load (normal)
virtual WorldCell *Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY ) {return 0;}
virtual WorldCell *LoadFromLocation(IDriver3D *pDriver, World *pWorld, void *pLocPtr) {return 0;}
virtual WorldCell *Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY ) {return nullptr;}
virtual WorldCell *LoadFromLocation(IDriver3D *pDriver, World *pWorld, void *pLocPtr) {return nullptr;}
};

#endif //CELLLOADER_H
4 changes: 0 additions & 4 deletions fileformats/CellLoader_BloodMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ CellLoader_BloodMap::CellLoader_BloodMap() : CellLoader()
m_pBloodSprites = nullptr;
}

CellLoader_BloodMap::~CellLoader_BloodMap()
{
}

void CellLoader_BloodMap::DecryptBuffer(uint8_t *pBuffer, const uint32_t uDataSize, uint8_t uDecryptKey)
{
// Variables
Expand Down
4 changes: 2 additions & 2 deletions fileformats/CellLoader_BloodMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class CellLoader_BloodMap : public CellLoader
{
public:
CellLoader_BloodMap();
~CellLoader_BloodMap();
virtual ~CellLoader_BloodMap() = default;

WorldCell *Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY );
virtual WorldCell *Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY ) override;

private:
struct HeaderPart1
Expand Down
8 changes: 0 additions & 8 deletions fileformats/CellLoader_Daggerfall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,6 @@ struct DT_ActionRecord

#pragma pack(pop)

CellLoader_Daggerfall::CellLoader_Daggerfall() : CellLoader()
{
}

CellLoader_Daggerfall::~CellLoader_Daggerfall()
{
}

WorldCell *CellLoader_Daggerfall::LoadFromLocation( IDriver3D *pDriver, World *pWorld, void *pLocPtr )
{
Location_Daggerfall *pLocation = (Location_Daggerfall *)pLocPtr;
Expand Down
10 changes: 5 additions & 5 deletions fileformats/CellLoader_Daggerfall.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class Sector;
class CellLoader_Daggerfall : public CellLoader
{
public:
CellLoader_Daggerfall();
~CellLoader_Daggerfall();
CellLoader_Daggerfall() = default;
virtual ~CellLoader_Daggerfall() = default;

WorldCell *Load(IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY);
WorldCell *LoadFromLocation(IDriver3D *pDriver, World *pWorld, void *pLocPtr);
virtual WorldCell *Load(IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY) override;
virtual WorldCell *LoadFromLocation(IDriver3D *pDriver, World *pWorld, void *pLocPtr) override;

//returns true if this CellLoader handles file handling itself.
bool UsesOwnFiles() { return true; }
virtual bool UsesOwnFiles() override { return true; }

private:
Sector *LoadBlock(IDriver3D *pDriver, uint32_t uLength, int& index, char *pData, const Vector3& vBlockLoc, Vector3& vStartTagLoc, bool bStartBlock, int32_t worldX, int32_t worldY, int blockType);
Expand Down
8 changes: 0 additions & 8 deletions fileformats/CellLoader_OutlawsMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ const float m_fWorldToTexel_Z = 8.0f;

#define MAX_WALLS 32768

CellLoader_OutlawsMap::CellLoader_OutlawsMap() : CellLoader()
{
}

CellLoader_OutlawsMap::~CellLoader_OutlawsMap()
{
}

//Outlaws Sector Flags.
enum
{
Expand Down
6 changes: 3 additions & 3 deletions fileformats/CellLoader_OutlawsMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class World;
class CellLoader_OutlawsMap : public CellLoader
{
public:
CellLoader_OutlawsMap();
~CellLoader_OutlawsMap();
CellLoader_OutlawsMap() = default;
virtual ~CellLoader_OutlawsMap() = default;

WorldCell *Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY );
virtual WorldCell *Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY ) override;

private:

Expand Down
16 changes: 8 additions & 8 deletions fileformats/GOB_Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ class GOB_Reader : public Archive
public:
GOB_Reader();

bool Open(const char *pszName);
void Close();
virtual bool Open(const char *pszName) override;
virtual void Close() override;

bool OpenFile(const char *pszFile);
void CloseFile();
uint32_t GetFileLen();
bool ReadFile(void *pData, uint32_t uLength);
virtual bool OpenFile(const char *pszFile) override;
virtual void CloseFile() override;
virtual uint32_t GetFileLen() override;
virtual bool ReadFile(void *pData, uint32_t uLength) override;

int32_t GetFileCount();
const char *GetFileName(int32_t nFileIdx);
virtual int32_t GetFileCount() override;
virtual const char *GetFileName(int32_t nFileIdx) override;

private:

Expand Down
12 changes: 6 additions & 6 deletions fileformats/LFD_Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class LFD_Reader : public Archive
public:
LFD_Reader();

bool Open(const char *pszName);
void Close();
virtual bool Open(const char *pszName) override;
virtual void Close() override;

bool OpenFile(const char *pszFile);
void CloseFile();
uint32_t GetFileLen();
bool ReadFile(void *pData, uint32_t uLength);
virtual bool OpenFile(const char *pszFile) override;
virtual void CloseFile() override;
virtual uint32_t GetFileLen() override;
virtual bool ReadFile(void *pData, uint32_t uLength) override;

private:

Expand Down
18 changes: 9 additions & 9 deletions fileformats/RFF_Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ class RFF_Reader : public Archive
public:
RFF_Reader();

bool Open(const char *pszName);
void Close();
virtual bool Open(const char *pszName) override;
virtual void Close() override;

bool OpenFile(const char *pszFile);
void CloseFile();
uint32_t GetFileLen();
bool ReadFile(void *pData, uint32_t uLength);
virtual bool OpenFile(const char *pszFile) override;
virtual void CloseFile() override;
virtual uint32_t GetFileLen() override;
virtual bool ReadFile(void *pData, uint32_t uLength) override;

int32_t GetFileCount();
const char *GetFileName(int32_t nFileIdx);
virtual int32_t GetFileCount() override;
virtual const char *GetFileName(int32_t nFileIdx) override;

void *ReadFileInfo();
virtual void *ReadFileInfo() override;

private:

Expand Down
4 changes: 2 additions & 2 deletions fileformats/SkyLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
class SkyLoader
{
public:
SkyLoader() {};
virtual ~SkyLoader() {};
SkyLoader() = default;
virtual ~SkyLoader() = default;

virtual bool LoadSky(int32_t regionID) {return false;}
virtual void *GetSkyData(int32_t regionID) {return 0;}
Expand Down
4 changes: 0 additions & 4 deletions fileformats/SkyLoader_Daggerfall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ SkyLoader_Daggerfall::SkyLoader_Daggerfall() : SkyLoader()
}
}

SkyLoader_Daggerfall::~SkyLoader_Daggerfall()
{
}

bool SkyLoader_Daggerfall::LoadSky(int32_t regionID)
{
if ( m_aSkyData[regionID].bLoaded )
Expand Down
6 changes: 3 additions & 3 deletions fileformats/SkyLoader_Daggerfall.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class SkyLoader_Daggerfall : public SkyLoader
{
public:
SkyLoader_Daggerfall();
~SkyLoader_Daggerfall();
virtual ~SkyLoader_Daggerfall() = default;

bool LoadSky(int32_t regionID);
void *GetSkyData(int32_t regionID);
virtual bool LoadSky(int32_t regionID) override;
virtual void *GetSkyData(int32_t regionID) override;

private:
enum
Expand Down
8 changes: 0 additions & 8 deletions fileformats/TextureConv_ART.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
#include "TextureConv_ART.h"
#include "ArchiveManager.h"

TextureConv_ART::TextureConv_ART() : TextureConverter()
{
}

TextureConv_ART::~TextureConv_ART()
{
}

bool TextureConv_ART::ConvertTexture_Pal8(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, const uint8_t *pPalette, bool bCopyPal, uint32_t uHackID/*=0*/)
{
uint16_t *pSizeInfo = (uint16_t *)ArchiveManager::GameFile_GetFileInfo();
Expand Down
6 changes: 3 additions & 3 deletions fileformats/TextureConv_ART.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
class TextureConv_ART : public TextureConverter
{
public:
TextureConv_ART();
~TextureConv_ART();
TextureConv_ART() = default;
virtual ~TextureConv_ART() = default;

bool ConvertTexture_Pal8(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, const uint8_t *pPalette, bool bCopyPal, uint32_t uHackID=0);
virtual bool ConvertTexture_Pal8(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, const uint8_t *pPalette, bool bCopyPal, uint32_t uHackID=0) override;
};

#endif //TEXTURECONVERTER_ART_H
8 changes: 0 additions & 8 deletions fileformats/TextureConv_IMG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ struct ImageHeader

#pragma pack(pop)

TextureConv_IMG::TextureConv_IMG() : TextureConverter()
{
}

TextureConv_IMG::~TextureConv_IMG()
{
}

uint32_t TextureConv_IMG::GetHackID(const char *pszImage)
{
uint32_t uHackID = 0;
Expand Down
16 changes: 8 additions & 8 deletions fileformats/TextureConv_IMG.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
class TextureConv_IMG : public TextureConverter
{
public:
TextureConv_IMG();
~TextureConv_IMG();
TextureConv_IMG() = default;
virtual ~TextureConv_IMG() = default;

uint32_t GetHackID(const char *pszImage);
bool ConvertTexture_Pal8(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, const uint8_t *pPalette, bool bCopyPal, uint32_t uHackID=0);
bool ConvertTexture_Pal8_TexList(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, const uint8_t *pPalette, int nRecord, uint32_t uHackID=0);
virtual uint32_t GetHackID(const char *pszImage) override;
virtual bool ConvertTexture_Pal8(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, const uint8_t *pPalette, bool bCopyPal, uint32_t uHackID=0) override;
virtual bool ConvertTexture_Pal8_TexList(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, const uint8_t *pPalette, int nRecord, uint32_t uHackID=0) override;

bool ConvertTexture_8bpp(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, uint32_t uHackID=0);
uint32_t ConvertTexture_8bpp_TexList(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, int nRecord, uint32_t uHackID=0);
virtual bool ConvertTexture_8bpp(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, uint32_t uHackID=0) override;
virtual uint32_t ConvertTexture_8bpp_TexList(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, int nRecord, uint32_t uHackID=0) override;
//Get extra game/format specific data.
virtual void *GetExtraTexData(uint32_t& uDataSize) { uDataSize=4; return m_aExtraData; }
virtual void *GetExtraTexData(uint32_t& uDataSize) override { uDataSize=4; return m_aExtraData; }
private:
int16_t m_aExtraData[2];
};
Expand Down
8 changes: 0 additions & 8 deletions fileformats/TextureConv_PCX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
#include <cassert>
#include <cstring>

TextureConv_PCX::TextureConv_PCX() : TextureConverter()
{
}

TextureConv_PCX::~TextureConv_PCX()
{
}

struct PCX_Header
{
uint8_t Manufacturer;
Expand Down
6 changes: 3 additions & 3 deletions fileformats/TextureConv_PCX.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
class TextureConv_PCX : public TextureConverter
{
public:
TextureConv_PCX();
~TextureConv_PCX();
TextureConv_PCX() = default;
virtual ~TextureConv_PCX() = default;

bool ConvertTexture_Pal8(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, const uint8_t *pPalette, bool bCopyPal, uint32_t uHackID=0);
virtual bool ConvertTexture_Pal8(uint8_t *pConvertedData, int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight, const uint8_t *pSourceData, uint32_t uLen, const uint8_t *pPalette, bool bCopyPal, uint32_t uHackID=0) override;
};

#endif //TEXTURECONVERTER_PCX_H
4 changes: 2 additions & 2 deletions fileformats/TextureConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
class TextureConverter
{
public:
TextureConverter() {};
virtual ~TextureConverter() {};
TextureConverter() = default;
virtual ~TextureConverter() = default;

//Some games have weird format deviations that must be discovered based on the file name.
//These are "data hacks" that cannot be fixed without changing the data.
Expand Down
Loading

0 comments on commit 3072f18

Please sign in to comment.