mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
- Merged Source Code from MP branch Revision 2972
enable intro videos in VFS mode workaround for original intro hack allow to get real path of a file (only CVFSFile) streamline Allocator usage in VFile small non-VFS mode fixes in MPHostScreen.cpp Synced "Cutting Fences" in a multiplayer game git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2973 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -14,6 +14,17 @@ vfs::Path vfs::CVFSFile::GetFullPath()
|
||||
}
|
||||
}
|
||||
|
||||
bool vfs::CVFSFile::_getRealPath(vfs::Path& rPath)
|
||||
{
|
||||
if(_pLoc_)
|
||||
{
|
||||
rPath = static_cast<IDirectory<CVFSFile::write_type>*>(_pLoc_)->GetRealPath() + m_sFileName;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool vfs::CVFSFile::Delete()
|
||||
{
|
||||
Close();
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace vfs
|
||||
|
||||
virtual bool OpenRead();
|
||||
virtual bool OpenWrite(bool bCreateWhenNotExist = false, bool bTruncate = false);
|
||||
|
||||
virtual bool _getRealPath(vfs::Path& rPath);
|
||||
};
|
||||
|
||||
class CVFSTextFile : public vfs::CTextFile, public vfs::ILocationAware<vfs::CFile::read_type, vfs::CFile::write_type>
|
||||
|
||||
@@ -48,6 +48,10 @@ namespace vfs
|
||||
return 0;
|
||||
};
|
||||
|
||||
virtual bool _getRealPath(vfs::Path& rPath)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
protected:
|
||||
vfs::Path m_sFileName;
|
||||
};
|
||||
|
||||
+11
-8
@@ -8,15 +8,15 @@ ObjBlockAllocator<vfs::CVirtualFile>* vfs::CVirtualFile::_vfile_pool = NULL;
|
||||
vfs::CVirtualFile* vfs::CVirtualFile::Create(vfs::Path const& sFilePath, vfs::CProfileStack& rPStack)
|
||||
{
|
||||
unsigned int ID=0;
|
||||
#if 0
|
||||
CVirtualFile* file = new CVirtualFile();
|
||||
#else
|
||||
#ifdef VFILE_BLOCK_CREATE
|
||||
if(!_vfile_pool)
|
||||
{
|
||||
_vfile_pool = new ObjBlockAllocator<vfs::CVirtualFile>();
|
||||
CFileAllocator::RegisterAllocator(_vfile_pool);
|
||||
}
|
||||
CVirtualFile* file = _vfile_pool->New(&ID);
|
||||
#else
|
||||
CVirtualFile* file = new CVirtualFile();
|
||||
#endif
|
||||
file->_path = sFilePath;
|
||||
file->_pstack = &rPStack;
|
||||
@@ -24,10 +24,14 @@ vfs::CVirtualFile* vfs::CVirtualFile::Create(vfs::Path const& sFilePath, vfs::CP
|
||||
return file;
|
||||
}
|
||||
|
||||
//vfs::CVirtualFile::CVirtualFile(vfs::Path const& sFilePath, CProfileStack& rPStack)
|
||||
//: _path(sFilePath), _top_pname("_INVALID_"), _top_file(NULL), _rstack(rPStack)
|
||||
//{
|
||||
//};
|
||||
void vfs::CVirtualFile::Destroy()
|
||||
{
|
||||
#ifndef VFILE_BLOCK_CREATE
|
||||
delete this;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
vfs::CVirtualFile::CVirtualFile()
|
||||
: _path(""), _top_pname("_INVALID_"), _top_file(NULL), _pstack(NULL)
|
||||
, _myID(-1)
|
||||
@@ -36,7 +40,6 @@ vfs::CVirtualFile::CVirtualFile()
|
||||
|
||||
vfs::CVirtualFile::~CVirtualFile()
|
||||
{
|
||||
int i = 0;
|
||||
}
|
||||
|
||||
vfs::Path const& vfs::CVirtualFile::Path()
|
||||
|
||||
+6
-2
@@ -4,6 +4,8 @@
|
||||
#include "vfs_profile.h"
|
||||
#include <vector>
|
||||
|
||||
#define VFILE_BLOCK_CREATE
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
class CVirtualFile
|
||||
@@ -17,9 +19,9 @@ namespace vfs
|
||||
};
|
||||
public:
|
||||
~CVirtualFile();
|
||||
//CVirtualFile(vfs::Path const& sFilePath, CProfileStack& rPStack);
|
||||
void Destroy();
|
||||
static CVirtualFile* Create(vfs::Path const& sFilePath, CProfileStack& rPStack);
|
||||
|
||||
|
||||
vfs::Path const& Path();
|
||||
void Add(vfs::IBaseFile *pFile, utf8string sProfileName, bool bReplace = false);
|
||||
bool Remove(vfs::IBaseFile *pFile);
|
||||
@@ -37,7 +39,9 @@ namespace vfs
|
||||
CProfileStack* _pstack;
|
||||
private:
|
||||
unsigned int _myID;
|
||||
#ifdef VFILE_BLOCK_CREATE
|
||||
static ObjBlockAllocator<CVirtualFile>* _vfile_pool;
|
||||
#endif
|
||||
};
|
||||
} // end namspace
|
||||
|
||||
|
||||
+4
-4
@@ -55,10 +55,10 @@ vfs::CVirtualLocation::CVirtualLocation(vfs::Path const& sPath)
|
||||
vfs::CVirtualLocation::~CVirtualLocation()
|
||||
{
|
||||
tVFiles::iterator it = m_mapVFiles.begin();
|
||||
//for(; it != m_mapVFiles.end(); ++it)
|
||||
//{
|
||||
// delete it->second;
|
||||
//}
|
||||
for(; it != m_mapVFiles.end(); ++it)
|
||||
{
|
||||
it->second->Destroy();
|
||||
}
|
||||
m_mapVFiles.clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user