Browse Source

Print error reports before panicking when asset loads fail.

legacy
Sam Hocevar sam 14 years ago
parent
commit
87ed8cdf52
3 changed files with 15 additions and 0 deletions
  1. +3
    -0
      src/font.cpp
  2. +9
    -0
      src/sample.cpp
  3. +3
    -0
      src/tileset.cpp

+ 3
- 0
src/font.cpp View File

@@ -61,6 +61,9 @@ Font::Font(char const *path)


if (!data->img) if (!data->img)
{ {
#if !FINAL_RELEASE
fprintf(stderr, "ERROR: could not load %s\n", path);
#endif
SDL_Quit(); SDL_Quit();
exit(1); exit(1);
} }


+ 9
- 0
src/sample.cpp View File

@@ -15,6 +15,7 @@
#include <cstdlib> #include <cstdlib>
#include <cmath> #include <cmath>


#include <SDL.h>
#include <SDL_mixer.h> #include <SDL_mixer.h>


#include "core.h" #include "core.h"
@@ -41,6 +42,14 @@ Sample::Sample(char const *path)
{ {
data->name = strdup(path); data->name = strdup(path);
data->chunk = Mix_LoadWAV(path); data->chunk = Mix_LoadWAV(path);
if (!data->chunk)
{
#if !FINAL_RELEASE
fprintf(stderr, "ERROR: could not load %s\n", path);
#endif
SDL_Quit();
exit(1);
}
} }


Sample::~Sample() Sample::~Sample()


+ 3
- 0
src/tileset.cpp View File

@@ -67,6 +67,9 @@ TileSet::TileSet(char const *path, int w, int h, float dilate)


if (!data->img) if (!data->img)
{ {
#if !FINAL_RELEASE
fprintf(stderr, "ERROR: could not load %s\n", path);
#endif
SDL_Quit(); SDL_Quit();
exit(1); exit(1);
} }


Loading…
Cancel
Save