From 77599bad3adfe14c1276e3e95129c12c77c443de Mon Sep 17 00:00:00 2001 From: Antidote Date: Fri, 21 Mar 2014 19:27:29 -0700 Subject: [PATCH] Fix non-Qt build --- include/FileNotFoundException.hpp | 8 +++++++- include/IOException.hpp | 9 ++++++++- include/InvalidOperationException.hpp | 8 +++++++- include/SpriteFile.hpp | 2 +- libzelda.pri | 8 ++++---- libzelda.pro | 2 +- src/Sprite.cpp | 2 +- src/SpritePart.cpp | 2 +- 8 files changed, 30 insertions(+), 11 deletions(-) diff --git a/include/FileNotFoundException.hpp b/include/FileNotFoundException.hpp index 1539e77..d25c2f0 100644 --- a/include/FileNotFoundException.hpp +++ b/include/FileNotFoundException.hpp @@ -38,7 +38,7 @@ public: * \param filename The path of the offending file. */ inline FileNotFoundException(const std::string& filename) : - Exception("FileNotFoundException:\nCouldn't not find \"" + filename + "\", please check that it exists."), + Exception("Couldn't find \"" + filename + "\", please check that it exists."), m_filename(filename) {} @@ -53,4 +53,10 @@ private: } // error } // zelda +#define THROW_FILENOTFOUND_EXCEPTION(msg) \ + do \ + { \ + throw zelda::error::FileNotFoundException(__LINE_STRING__ " " __FILE__ " " msg); \ + } while(0) + #endif diff --git a/include/IOException.hpp b/include/IOException.hpp index ab3521c..a6a5f2c 100644 --- a/include/IOException.hpp +++ b/include/IOException.hpp @@ -41,10 +41,17 @@ public: * \param message The error message to throw */ inline IOException(const std::string& message) : - Exception("IOException: " + message) + Exception(message) {} }; } // error } // zelda + +#define THROW_IO_EXCEPTION(msg) \ + do \ + { \ + throw zelda::error::IOException(__LINE_STRING__ " " __FILE__ " " msg); \ + } while(0) + #endif diff --git a/include/InvalidOperationException.hpp b/include/InvalidOperationException.hpp index 577d2e8..9e37d8b 100644 --- a/include/InvalidOperationException.hpp +++ b/include/InvalidOperationException.hpp @@ -40,7 +40,7 @@ public: * \param error The error message to throw */ inline InvalidOperationException(const std::string& error) - : Exception("InvalidOperationException:\n" + error) + : Exception(error) { } }; @@ -48,4 +48,10 @@ public: } // error } // zelda +#define THROW_INVALIDOPERATION_EXCEPTION(msg) \ + do \ + { \ + throw zelda::error::InvalidOperationException(__LINE_STRING__ " " __FILE__ " " msg); \ + } while(0) + #endif // __INVALID_OPERATION_EXCEPTION_HPP__ diff --git a/include/SpriteFile.hpp b/include/SpriteFile.hpp index 12b94a3..60f0755 100644 --- a/include/SpriteFile.hpp +++ b/include/SpriteFile.hpp @@ -149,7 +149,7 @@ public slots: * \param origin */ #ifndef LIBZELDA_USE_QT - void setOrigin(const Vector2Di& origin); + void setOrigin(const Vector2Df& origin); #else void setOrigin(const QPoint& origin); #endif diff --git a/libzelda.pri b/libzelda.pri index 7d02833..b3e0d2d 100644 --- a/libzelda.pri +++ b/libzelda.pri @@ -42,8 +42,8 @@ HEADERS += \ $$PWD/include/ZQuestFileWriter.hpp \ $$PWD/include/ZQuestFileReader.hpp \ $$PWD/include/Compression.hpp \ - $$PWD/include/lzo.h \ - $$PWD/include/WiiImage.hpp \ + $$PWD/include/lzo.h \ + $$PWD/include/WiiImage.hpp \ $$PWD/include/ZQuestFile.hpp \ $$PWD/include/Checksums.hpp \ $$PWD/include/SkywardSwordFile.hpp \ @@ -56,7 +56,7 @@ HEADERS += \ $$PWD/include/SpriteFileWriter.hpp \ $$PWD/include/SpriteFrame.hpp \ $$PWD/include/SpritePart.hpp \ - ../libzelda/include/InvalidDataException.hpp + $$PWD/include/InvalidDataException.hpp SOURCES += \ $$PWD/src/utility.cpp \ @@ -84,7 +84,7 @@ SOURCES += \ $$PWD/src/ZQuestFileWriter.cpp \ $$PWD/src/ZQuestFileReader.cpp \ $$PWD/src/Compression.cpp \ - $$PWD/src/lzo.c \ + $$PWD/src/lzo.c \ $$PWD/src/WiiImage.cpp \ $$PWD/src/ZQuestFile.cpp \ $$PWD/src/Checksums.cpp \ diff --git a/libzelda.pro b/libzelda.pro index 1e6a599..3d67865 100644 --- a/libzelda.pro +++ b/libzelda.pro @@ -3,7 +3,7 @@ TEMPLATE= lib DESTDIR = ./lib # Uncomment this if you wish to use Qt with libZelda -DEFINES += LIBZELDA_USE_QT +#DEFINES += LIBZELDA_USE_QT contains(DEFINES, LIBZELDA_USE_QT){ QT += core diff --git a/src/Sprite.cpp b/src/Sprite.cpp index 879bdf1..d4f33a6 100644 --- a/src/Sprite.cpp +++ b/src/Sprite.cpp @@ -219,7 +219,7 @@ Uint32 Sprite::frameCount() const } #ifndef LIBZELDA_USE_QT -std::vector Sprite::frames() const +std::vector Sprite::frames() const #else QList Sprite::frames() const #endif diff --git a/src/SpritePart.cpp b/src/SpritePart.cpp index 6cfc877..1f76363 100644 --- a/src/SpritePart.cpp +++ b/src/SpritePart.cpp @@ -126,7 +126,7 @@ QPoint SpritePart::textureOffset() const void SpritePart::setSize(Uint32 width, Uint32 height) { #ifndef LIBZELDA_USE_QT - setSize(Vector2Df(width, height)); + setSize(Vector2Di(width, height)); #else setSize(QSize(width, height)); #endif