Saving tilebank

This commit is contained in:
dfighter1985 2014-08-04 22:14:39 +02:00
parent c4b770a7b6
commit 4bb8b3373e
7 changed files with 28 additions and 7 deletions

View file

@ -459,4 +459,9 @@ QString TileBank::getTexturePath() const
return m_pvt->m_bank.getAbsPath().c_str();
}
void TileBank::serial( NLMISC::IStream &f )
{
m_pvt->m_bank.serial( f );
}

View file

@ -7,6 +7,11 @@
#include "tile_constants.h"
namespace NLMISC
{
class IStream;
}
class TileBankPvt;
class TileBank
@ -41,6 +46,8 @@ public:
void setTexturePath( const QString &path );
QString getTexturePath() const;
void serial( NLMISC::IStream &f );
bool hasError() const{ return m_hasError; }
QString getLastError() const{ return m_lastError; }

View file

@ -250,8 +250,7 @@ void TileEditorMainWindow::saveAs( const QString &fn )
}
TileBankSaver saver;
bool ok = true;
//saver.save( fn.toUtf8().constData(), m_tileModel, m_lands );
bool ok = saver.save( fn.toUtf8().constData(), m_tileModel );
if( !ok )
{

View file

@ -431,6 +431,11 @@ void TileModel::setTexturePath( const QString &path )
m_tileBank->setTexturePath( path );
}
void TileModel::serial( NLMISC::IStream &f )
{
m_tileBank->serial( f );
}
QString TileModel::getTexturePath() const
{
return m_tileBank->getTexturePath();

View file

@ -23,6 +23,11 @@
#include "tile_constants.h"
namespace NLMISC
{
class IStream;
}
class Node;
class TileSetNode;
class TileItemNode;
@ -107,6 +112,8 @@ public:
void setTexturePath( const QString &path );
QString getTexturePath() const;
void serial( NLMISC::IStream &f );
QString getLastError() const;
bool hasError() const;

View file

@ -39,7 +39,7 @@ TileBankSaver::~TileBankSaver()
p = NULL;
}
bool TileBankSaver::save( const char *fileName, const TileModel* model, const QList< Land > &lands )
bool TileBankSaver::save( const char *fileName, TileModel* model )
{
// Save to file
NLMISC::COFile f;
@ -47,7 +47,7 @@ bool TileBankSaver::save( const char *fileName, const TileModel* model, const QL
if( !b )
return false;
//p->bank.serial( f );
model->serial( f );
f.flush();
f.close();

View file

@ -20,10 +20,8 @@
#include <QString>
#include <QList>
#include "land.h"
class TileModel;
class TileBankSaverPvt;
class TileBankSaver
@ -32,7 +30,7 @@ public:
TileBankSaver();
~TileBankSaver();
bool save( const char *filename, const TileModel* model, const QList< Land > &lands );
bool save( const char *filename, TileModel* model );
private:
TileBankSaverPvt *p;