From: Daniel Karbach Date: Fri, 7 Oct 2016 10:35:33 +0000 (+0200) Subject: cleanup X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=d2f4c8720ae2326fac4203fa4984d835e875b355;p=blank.git cleanup --- diff --git a/Makefile b/Makefile index 156d5cb..dd67f8f 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,9 @@ test: blank.test ./blank.test clean: - rm -df $(OBJ) $(DEP) $(DIR) + rm -f $(OBJ) + rm -f $(DEP) + find build -type d -empty -delete distclean: clean rm -f $(BIN) cachegrind.out.* callgrind.out.* diff --git a/src/app/init.cpp b/src/app/init.cpp index fea5653..78a83e1 100644 --- a/src/app/init.cpp +++ b/src/app/init.cpp @@ -139,7 +139,7 @@ InitAL::InitAL() { } } -InitAL::~InitAL() { +InitAL::~InitAL() throw(AlutError) { if (!alutExit()) { throw AlutError(alutGetError(), "alutExit"); } diff --git a/src/app/init.hpp b/src/app/init.hpp index 66c3345..9385d44 100644 --- a/src/app/init.hpp +++ b/src/app/init.hpp @@ -101,7 +101,7 @@ class InitAL { public: InitAL(); - ~InitAL(); + ~InitAL() throw(AlutError); InitAL(const InitAL &) = delete; InitAL &operator =(const InitAL &) = delete; diff --git a/src/blank.cpp b/src/blank.cpp index 2c3c40d..395125c 100644 --- a/src/blank.cpp +++ b/src/blank.cpp @@ -1,9 +1,28 @@ #include "app/Runtime.hpp" +#include +#include + using namespace blank; int main(int argc, char *argv[]) { Runtime rt; - rt.Initialize(argc, argv); - return rt.Execute(); + try { + rt.Initialize(argc, argv); + } catch (std::exception &e) { + std::cerr << "error in initialization: " << e.what() << std::endl; + return 1; + } catch (...) { + std::cerr << "unknown error in initialization" << std::endl; + return 1; + } + try { + return rt.Execute(); + } catch (std::exception &e) { + std::cerr << "error in execution: " << e.what() << std::endl; + return 2; + } catch (...) { + std::cerr << "unknown error in execution" << std::endl; + return 2; + } } diff --git a/src/graphics/Viewport.hpp b/src/graphics/Viewport.hpp index 4730273..de62c48 100644 --- a/src/graphics/Viewport.hpp +++ b/src/graphics/Viewport.hpp @@ -23,7 +23,7 @@ public: Viewport(const Viewport &) = delete; Viewport &operator =(const Viewport &) = delete; - void VSync(bool b) noexcept; + void VSync(bool b); void EnableDepthTest() noexcept; void EqualDepthTest() noexcept; diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index 9468b68..d1913ad 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -261,8 +262,11 @@ void Texture::Data(const SDL_Surface &srf, bool pad2) noexcept { UnpackRowLength(0); } else if (srf.w > (1 << 30) || srf.h > (1 << 30)) { + // That's at least one gigapixel in either or both dimensions. + // If this is not an error, that's an insanely large or high + // resolution texture. #ifndef NDEBUG - throw std::runtime_error("texture too large"); + std::cerr << "texture size exceeds 2^30, aborting data import" << std::endl; #endif } else { GLsizei width = 1, height = 1; diff --git a/src/graphics/viewport.cpp b/src/graphics/viewport.cpp index 30b1c3c..cb44619 100644 --- a/src/graphics/viewport.cpp +++ b/src/graphics/viewport.cpp @@ -103,7 +103,7 @@ Viewport::Viewport() glClearColor(0.0, 0.0, 0.0, 1.0); } -void Viewport::VSync(bool b) noexcept { +void Viewport::VSync(bool b) { if (SDL_GL_SetSwapInterval(b) != 0) { throw SDLError("SDL_GL_SetSwapInterval"); } diff --git a/src/world/chunk.cpp b/src/world/chunk.cpp index 97ec3e3..7f7b185 100644 --- a/src/world/chunk.cpp +++ b/src/world/chunk.cpp @@ -33,7 +33,6 @@ Chunk::Chunk(const BlockTypeRegistry &types) noexcept : types(&types) , neighbor{0} , gravity() -, blocks{} , light{0} , generated(false) , lighted(false)