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(); 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" #include "tile_constants.h"
namespace NLMISC
{
class IStream;
}
class TileBankPvt; class TileBankPvt;
class TileBank class TileBank
@ -42,6 +47,8 @@ public:
void setTexturePath( const QString &path ); void setTexturePath( const QString &path );
QString getTexturePath() const; QString getTexturePath() const;
void serial( NLMISC::IStream &f );
bool hasError() const{ return m_hasError; } bool hasError() const{ return m_hasError; }
QString getLastError() const{ return m_lastError; } QString getLastError() const{ return m_lastError; }
void resetError(){ void resetError(){

View file

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

View file

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

View file

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

View file

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

View file

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