return -1;
break;
default:
-#ifndef NDEBUG
assert(false);
-#else
return -1;
-#endif
}
return 0;
}
#include "audio/stream_sound_source.hpp"
#include "util/log.hpp"
-#ifdef NDEBUG
-/** Older openal versions often miss this function and it isn't that vital for
- * supertux...
- */
-#ifdef alcGetString
-# undef alcGetString
-#endif
-# define alcGetString(x,y) ""
-#endif
-
SoundManager::SoundManager() :
device(0),
context(0),
default:
// this should never happen
+ result = NULL;
assert(false);
}
result.x = rect.get_right();
break;
default:
-#ifndef NDEBUG
- throw std::runtime_error("Invalid anchor point found");
-#endif
log_warning << "Invalid anchor point found" << std::endl;
result.x = rect.get_left();
break;
result.y = rect.get_bottom();
break;
default:
-#ifndef NDEBUG
- throw std::runtime_error("Invalid anchor point found");
-#endif
log_warning << "Invalid anchor point found" << std::endl;
result.y = rect.get_top();
break;
result.x = destrect.get_right() - width;
break;
default:
-#ifndef NDEBUG
- throw std::runtime_error("Invalid anchor point found");
-#endif
log_warning << "Invalid anchor point found" << std::endl;
result.x = destrect.get_left();
break;
result.y = destrect.get_bottom() - height;
break;
default:
-#ifndef NDEBUG
- throw std::runtime_error("Invalid anchor point found");
-#endif
log_warning << "Invalid anchor point found" << std::endl;
result.y = destrect.get_top();
break;
int frameidx = (int) frame;
if(frameidx >= get_frames() || frameidx < 0) {
-#ifdef NDEBUG
// in optimized mode we get some small rounding errors in floating point
// number sometimes...
- log_warning << "frame out of range: " << frameidx << "/" << get_frames() << " at sprite: " << get_name() << "/" << get_action() << std::endl;
-#endif
frameidx = get_frames() - 1;
}
SDL_WM_SetIcon(icon, 0);
SDL_FreeSurface(icon);
}
-#ifndef NDEBUG
else {
log_warning << "Couldn't load icon '" << icon_fname << "'" << std::endl;
}
-#endif
SDL_ShowCursor(0);
}
}
-#ifndef NDEBUG
static Uint32 last_timelog_ticks = 0;
static const char* last_timelog_component = 0;
last_timelog_ticks = current_ticks;
last_timelog_component = component;
}
-#else
-static inline void timelog(const char* )
-{
-}
-#endif
int
Main::run(int argc, char** argv)
return Console::output;
}
+#endif
+
std::ostream& log_fatal_f(const char* file, int line)
{
Console::output << "[FATAL] " << file << ":" << line << " ";
return Console::output;
}
-#else
-
-std::ostream& log_fatal_f()
-{
- Console::output << "Fatal: ";
- return Console::output;
-}
-
-#endif
-
std::ostream& operator<<(std::ostream& out, const Vector& vector)
{
out << '[' << vector.x << ',' << vector.y << ']';
#define HEADER_SUPERTUX_UTIL_LOG_HPP
#include <config.h>
+#include <ostream>
#ifndef NDEBUG
-#include <ostream>
-
std::ostream& log_debug_f(const char* file, int line);
-std::ostream& log_info_f(const char* file, int line);
-std::ostream& log_warning_f(const char* file, int line);
-std::ostream& log_fatal_f(const char* file, int line);
-
#define log_debug log_debug_f(__FILE__, __LINE__)
+
+std::ostream& log_info_f(const char* file, int line);
#define log_info log_info_f(__FILE__, __LINE__)
+
+std::ostream& log_warning_f(const char* file, int line);
#define log_warning log_warning_f(__FILE__, __LINE__)
-#define log_fatal log_fatal_f(__FILE__, __LINE__)
#else
#include <iostream>
-std::ostream& log_fatal_f();
-
-#define log_debug if (0) std::cerr
+#define log_debug std::cout
#define log_info std::cout
#define log_warning std::cerr
-#define log_fatal log_fatal_f()
#endif
+std::ostream& log_fatal_f(const char* file, int line);
+
+#define log_fatal log_fatal_f(__FILE__, __LINE__)
+
class Vector;
std::ostream& operator<< (std::ostream& str, const Vector& vector);
class Rectf;
sdl_format = GL_RGB;
else if(convert->format->BytesPerPixel == 4)
sdl_format = GL_RGBA;
- else
+ else {
+ sdl_format = GL_RGBA;
assert(false);
+ }
glBindTexture(GL_TEXTURE_2D, handle);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
static inline void check_gl_error(const char* message)
{
-#ifndef NDEBUG
GLenum error = glGetError();
if(error != GL_NO_ERROR) {
std::ostringstream msg;
throw std::runtime_error(msg.str());
}
-#else
- (void) message;
-#endif
}
static inline void assert_gl(const char* message)
{
-#ifndef NDEBUG
check_gl_error(message);
-#else
- (void) message;
-#endif
}
#else