1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Further serialization code and refactorings.

This commit is contained in:
Michał W. Urbańczyk
2009-01-06 18:42:20 +00:00
parent f853074d20
commit 847a4f222c
17 changed files with 777 additions and 724 deletions

View File

@@ -146,7 +146,7 @@ void CConnection::close()
}
CSaveFile::CSaveFile( const std::string &fname )
:sfile(new std::ofstream(fname.c_str()))
:sfile(new std::ofstream(fname.c_str(),std::ios::binary))
{
if(!(*sfile))
{
@@ -164,4 +164,25 @@ int CSaveFile::write( const void * data, unsigned size )
{
sfile->write((char *)data,size);
return size;
}
CLoadFile::CLoadFile( const std::string &fname )
:sfile(new std::ifstream(fname.c_str(),std::ios::binary))
{
if(!(*sfile))
{
tlog1 << "Error: cannot open to read " << fname << std::endl;
sfile = NULL;
}
}
CLoadFile::~CLoadFile()
{
delete sfile;
}
int CLoadFile::read( const void * data, unsigned size )
{
sfile->read((char *)data,size);
return size;
}