Skip to content

Commit

Permalink
Remove unnecessary storage argument of CEditorMap::Load/Save
Browse files Browse the repository at this point in the history
The editor map has a pointer to the editor, which has a pointer to the storage, so it's not necessary to pass the storage separately.
  • Loading branch information
Robyt3 committed Jun 25, 2023
1 parent 34df022 commit 4372932
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/game/editor/editor.h
Expand Up @@ -437,8 +437,8 @@ class CEditorMap
void CreateDefault(IGraphics::CTextureHandle EntitiesTexture);

// io
bool Save(class IStorage *pStorage, const char *pFilename);
bool Load(class IStorage *pStorage, const char *pFilename, int StorageType);
bool Save(const char *pFilename);
bool Load(const char *pFilename, int StorageType);

// DDRace

Expand Down
16 changes: 8 additions & 8 deletions src/game/editor/io.cpp
Expand Up @@ -33,16 +33,16 @@ struct CSoundSource_DEPRECATED

bool CEditor::Save(const char *pFilename)
{
return m_Map.Save(Kernel()->RequestInterface<IStorage>(), pFilename);
return m_Map.Save(pFilename);
}

bool CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
bool CEditorMap::Save(const char *pFileName)
{
char aBuf[IO_MAX_PATH_LENGTH + 64];
str_format(aBuf, sizeof(aBuf), "saving to '%s'...", pFileName);
m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "editor", aBuf);
CDataFileWriter df;
if(!df.Open(pStorage, pFileName))
if(!df.Open(m_pEditor->Storage(), pFileName))
{
str_format(aBuf, sizeof(aBuf), "failed to open file '%s'...", pFileName);
m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "editor", aBuf);
Expand Down Expand Up @@ -400,7 +400,7 @@ bool CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
bool CEditor::Load(const char *pFileName, int StorageType)
{
Reset();
bool Result = m_Map.Load(Kernel()->RequestInterface<IStorage>(), pFileName, StorageType);
bool Result = m_Map.Load(pFileName, StorageType);
if(Result)
{
str_copy(m_aFileName, pFileName);
Expand All @@ -416,10 +416,10 @@ bool CEditor::Load(const char *pFileName, int StorageType)
return Result;
}

bool CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int StorageType)
bool CEditorMap::Load(const char *pFileName, int StorageType)
{
CDataFileReader DataFile;
if(!DataFile.Open(pStorage, pFileName, StorageType))
if(!DataFile.Open(m_pEditor->Storage(), pFileName, StorageType))
return false;

Clean();
Expand Down Expand Up @@ -554,7 +554,7 @@ bool CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Stora
str_format(aBuf, sizeof(aBuf), "mapres/%s.opus", pName);

// load external
if(pStorage->ReadFile(pName, IStorage::TYPE_ALL, &pSound->m_pData, &pSound->m_DataSize))
if(m_pEditor->Storage()->ReadFile(pName, IStorage::TYPE_ALL, &pSound->m_pData, &pSound->m_DataSize))
{
pSound->m_SoundID = m_pEditor->Sound()->LoadOpusFromMem(pSound->m_pData, pSound->m_DataSize, true);
}
Expand Down Expand Up @@ -991,7 +991,7 @@ bool CEditor::Append(const char *pFileName, int StorageType)
CEditorMap NewMap;
NewMap.m_pEditor = this;

if(!NewMap.Load(Kernel()->RequestInterface<IStorage>(), pFileName, StorageType))
if(!NewMap.Load(pFileName, StorageType))
return false;

// modify indices
Expand Down

0 comments on commit 4372932

Please sign in to comment.