From 4bb8b3373efdd5d86844436e8e7431a0ea508072 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 4 Aug 2014 22:14:39 +0200 Subject: [PATCH] Saving tilebank --- code/studio/src/plugins/tile_editor/tile_bank.cpp | 5 +++++ code/studio/src/plugins/tile_editor/tile_bank.h | 7 +++++++ .../src/plugins/tile_editor/tile_editor_main_window.cpp | 3 +-- code/studio/src/plugins/tile_editor/tile_model.cpp | 5 +++++ code/studio/src/plugins/tile_editor/tile_model.h | 7 +++++++ code/studio/src/plugins/tile_editor/tilebank_saver.cpp | 4 ++-- code/studio/src/plugins/tile_editor/tilebank_saver.h | 4 +--- 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/code/studio/src/plugins/tile_editor/tile_bank.cpp b/code/studio/src/plugins/tile_editor/tile_bank.cpp index a4dd3f358..62fcb3565 100644 --- a/code/studio/src/plugins/tile_editor/tile_bank.cpp +++ b/code/studio/src/plugins/tile_editor/tile_bank.cpp @@ -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 ); +} + diff --git a/code/studio/src/plugins/tile_editor/tile_bank.h b/code/studio/src/plugins/tile_editor/tile_bank.h index c42546895..d267486a8 100644 --- a/code/studio/src/plugins/tile_editor/tile_bank.h +++ b/code/studio/src/plugins/tile_editor/tile_bank.h @@ -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; } diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp index e8f19cedc..ed8c1ae54 100644 --- a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp @@ -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 ) { diff --git a/code/studio/src/plugins/tile_editor/tile_model.cpp b/code/studio/src/plugins/tile_editor/tile_model.cpp index e1249cb14..4b14f54fb 100644 --- a/code/studio/src/plugins/tile_editor/tile_model.cpp +++ b/code/studio/src/plugins/tile_editor/tile_model.cpp @@ -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(); diff --git a/code/studio/src/plugins/tile_editor/tile_model.h b/code/studio/src/plugins/tile_editor/tile_model.h index 96193fd38..c831daae2 100644 --- a/code/studio/src/plugins/tile_editor/tile_model.h +++ b/code/studio/src/plugins/tile_editor/tile_model.h @@ -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; diff --git a/code/studio/src/plugins/tile_editor/tilebank_saver.cpp b/code/studio/src/plugins/tile_editor/tilebank_saver.cpp index 15e31d141..a0b8abcfb 100644 --- a/code/studio/src/plugins/tile_editor/tilebank_saver.cpp +++ b/code/studio/src/plugins/tile_editor/tilebank_saver.cpp @@ -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(); diff --git a/code/studio/src/plugins/tile_editor/tilebank_saver.h b/code/studio/src/plugins/tile_editor/tilebank_saver.h index 2a2806fe1..ef1e0de94 100644 --- a/code/studio/src/plugins/tile_editor/tilebank_saver.h +++ b/code/studio/src/plugins/tile_editor/tilebank_saver.h @@ -20,10 +20,8 @@ #include #include -#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;