**********************************************************

** Big Maps Projects code (incl. Multiplayer v1.5 **
**********************************************************
- Merged Big Maps Project code from BMP+MP trunk (Revision: 3340)
o Complete SVN Revision history: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP
- Before THIS merge, I made a branch of the existing 1.13 source
o SVN Branch: https://81.169.133.124/source/ja2/branches/JA2_rev.3336/src
- Removed old VS 6.0 and VS 2003 project and solutions files, because compilation is broken long time ago
- I will add VS 2010 projects and solution file in the next few days

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3341 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2010-02-28 18:38:52 +00:00
parent a98c44ac78
commit 14750c6903
461 changed files with 23615 additions and 120157 deletions
+26 -27
View File
@@ -5,14 +5,14 @@
// static member
ObjBlockAllocator<vfs::CVirtualFile>* vfs::CVirtualFile::_vfile_pool = NULL;
vfs::CVirtualFile* vfs::CVirtualFile::Create(vfs::Path const& sFilePath, vfs::CProfileStack& rPStack)
vfs::CVirtualFile* vfs::CVirtualFile::create(vfs::Path const& sFilePath, vfs::CProfileStack& rPStack)
{
unsigned int ID=0;
#ifdef VFILE_BLOCK_CREATE
if(!_vfile_pool)
{
_vfile_pool = new ObjBlockAllocator<vfs::CVirtualFile>();
CFileAllocator::RegisterAllocator(_vfile_pool);
CFileAllocator::registerAllocator(_vfile_pool);
}
CVirtualFile* file = _vfile_pool->New(&ID);
#else
@@ -24,7 +24,7 @@ vfs::CVirtualFile* vfs::CVirtualFile::Create(vfs::Path const& sFilePath, vfs::CP
return file;
}
void vfs::CVirtualFile::Destroy()
void vfs::CVirtualFile::destroy()
{
#ifndef VFILE_BLOCK_CREATE
delete this;
@@ -33,8 +33,7 @@ void vfs::CVirtualFile::Destroy()
vfs::CVirtualFile::CVirtualFile()
: _path(""), _top_pname("_INVALID_"), _top_file(NULL), _pstack(NULL)
, _myID(-1)
: _path(L""), _top_pname(L"_INVALID_"), _top_file(NULL), _pstack(NULL), _myID(vfs::UInt32(-1))
{
};
@@ -42,12 +41,12 @@ vfs::CVirtualFile::~CVirtualFile()
{
}
vfs::Path const& vfs::CVirtualFile::Path()
vfs::Path const& vfs::CVirtualFile::path()
{
return _path;
}
void vfs::CVirtualFile::Add(vfs::IBaseFile *pFile, utf8string sProfileName, bool bReplace)
void vfs::CVirtualFile::add(vfs::IBaseFile *pFile, utf8string sProfileName, bool bReplace)
{
if(pFile)
{
@@ -65,18 +64,18 @@ void vfs::CVirtualFile::Add(vfs::IBaseFile *pFile, utf8string sProfileName, bool
THROWIFFALSE( StrCmp::Equal(sProfileName,_top_pname), L"same file, different profile name");
}
// OK, not the same file, but these two different files are supposed to have the asme filename
THROWIFFALSE( _top_file->GetFileName() == pFile->GetFileName(), L"different filenames");
THROWIFFALSE( _top_file->getName() == pFile->getName(), L"different filenames");
// set new file only when its profile is on top of the current file's profile
bool bFoundOld = false, bFoundNew = false;
vfs::CProfileStack::Iterator it = _pstack->begin();
for(; !it.end(); it.next())
{
if(_top_pname == it.value()->Name)
if(_top_pname == it.value()->cName)
{
bFoundOld = true;
break;
}
else if(sProfileName == it.value()->Name)
else if(sProfileName == it.value()->cName)
{
bFoundNew = true;
break;
@@ -94,11 +93,11 @@ void vfs::CVirtualFile::Add(vfs::IBaseFile *pFile, utf8string sProfileName, bool
* @returns : returns true if pFile is not top file or top file could be replaced with another file
* returns false if there is no more files with given name. in this case object should be destroyed
*/
bool vfs::CVirtualFile::Remove(vfs::IBaseFile *pFile)
bool vfs::CVirtualFile::remove(vfs::IBaseFile *pFile)
{
if(_top_file == pFile)
{
if(_path == pFile->GetFullPath())
if(_path == pFile->getPath())
{
// need to replace '_top_file'
vfs::CProfileStack::Iterator prof_it = _pstack->begin();
@@ -107,11 +106,11 @@ bool vfs::CVirtualFile::Remove(vfs::IBaseFile *pFile)
CVirtualProfile *pProf = prof_it.value();
if(pProf)
{
vfs::IBaseFile *file = pProf->GetFile(_path);
vfs::IBaseFile *file = pProf->getFile(_path);
if(file && (file != pFile))
{
_top_file = file;
_top_pname = pProf->Name;
_top_pname = pProf->cName;
return true;
}
}
@@ -129,21 +128,21 @@ bool vfs::CVirtualFile::Remove(vfs::IBaseFile *pFile)
return true;
}
vfs::IBaseFile* vfs::CVirtualFile::File(ESearchFile eSearch)
vfs::IBaseFile* vfs::CVirtualFile::file(ESearchFile eSearch)
{
if(eSearch == SF_TOP)
{
return _top_file;
}
else if(eSearch == SF_FIRST_WRITEABLE)
else if(eSearch == SF_FIRST_WRITABLE)
{
CVirtualProfile *pVProf = _pstack->GetWriteProfile();
CVirtualProfile *pVProf = _pstack->getWriteProfile();
if(pVProf)
{
return pVProf->GetFile(_path);
return pVProf->getFile(_path);
}
}
else if(eSearch == SF_STOP_ON_WRITEABLE_PROFILE)
else if(eSearch == SF_STOP_ON_WRITABLE_PROFILE)
{
vfs::CProfileStack::Iterator prof_it = _pstack->begin();
for(; !prof_it.end(); prof_it.next())
@@ -151,13 +150,13 @@ vfs::IBaseFile* vfs::CVirtualFile::File(ESearchFile eSearch)
CVirtualProfile *pProf = prof_it.value();
if(pProf)
{
if(pProf->Writeable)
if(pProf->cWritable)
{
return pProf->GetFile(_path);
return pProf->getFile(_path);
}
else
{
vfs::IBaseFile *pFile = pProf->GetFile(_path);
vfs::IBaseFile *pFile = pProf->getFile(_path);
if(pFile)
{
return pFile;
@@ -169,25 +168,25 @@ vfs::IBaseFile* vfs::CVirtualFile::File(ESearchFile eSearch)
return NULL;
}
vfs::IBaseFile* vfs::CVirtualFile::File(utf8string const& sProfileName)
vfs::IBaseFile* vfs::CVirtualFile::file(utf8string const& sProfileName)
{
if(sProfileName == _top_pname)
{
return vfs::tReadableFile::Cast(_top_file);
return vfs::tReadableFile::cast(_top_file);
}
else
{
CVirtualProfile* pProf = _pstack->GetProfile(sProfileName);
CVirtualProfile* pProf = _pstack->getProfile(sProfileName);
if(pProf)
{
CVirtualProfile::Iterator loc_it = pProf->begin();
for(; !loc_it.end(); loc_it.next())
{
if(loc_it.value() && loc_it.value()->FileExists(_path))
if(loc_it.value() && loc_it.value()->fileExists(_path))
{
if(loc_it.value())
{
return loc_it.value()->GetFile(_path);
return loc_it.value()->getFile(_path);
}
}
}