/* --- ABORT! --- */
-void st_abort(const char * reason,const char * details)
+void st_abort(const std::string& reason, const std::string& details)
{
- fprintf(stderr, "\nError: %s\n%s\n\n", reason, details);
+ fprintf(stderr, "\nError: %s\n%s\n\n", reason.c_str(), details.c_str());
st_shutdown();
exit(1);
}
void st_joystick_setup(void);
void st_shutdown(void);
void st_menu(void);
-void st_abort( const char * reason, const char * details);
+void st_abort(const std::string& reason, const std::string& details);
void process_options_menu(void);
void process_save_load_game_menu(int save);
void update_load_save_game_menu(menu_type* pmenu, int load);
/* printf message and abort if there is an initialized audio device */
if ((snd == NULL) && (audio_device == YES))
- st_abort("Can't load", file.c_str());
+ st_abort("Can't load", file);
return(snd);
}
/* printf message and abort if there is an initialized audio device */
if ((sng == NULL) && (audio_device == YES))
- st_abort("Can't load", file.c_str());
+ st_abort("Can't load", file);
return (sng);
}
temp = IMG_Load(file.c_str());
if (temp == NULL)
- st_abort("Can't load", file.c_str());
+ st_abort("Can't load", file);
if(use_alpha == IGNORE_ALPHA && !use_gl)
ptexture->sdl_surface = SDL_DisplayFormat(temp);
ptexture->sdl_surface = SDL_DisplayFormatAlpha(temp);
if (ptexture->sdl_surface == NULL)
- st_abort("Can't covert to display format", file.c_str());
+ st_abort("Can't covert to display format", file);
if (use_alpha == IGNORE_ALPHA && !use_gl)
SDL_SetAlpha(ptexture->sdl_surface, 0, 0);
temp = IMG_Load(file.c_str());
if (temp == NULL)
- st_abort("Can't load", file.c_str());
+ st_abort("Can't load", file);
/* Set source rectangle for conv: */
ptexture->sdl_surface = SDL_DisplayFormatAlpha(conv);
if (ptexture->sdl_surface == NULL)
- st_abort("Can't covert to display format", file.c_str());
+ st_abort("Can't covert to display format", file);
if (use_alpha == IGNORE_ALPHA && !use_gl)
SDL_SetAlpha(ptexture->sdl_surface, 0, 0);
#include "screen.h"
#include "lispreader.h"
#include "gameloop.h"
+#include "setup.h"
#include "worldmap.h"
namespace WorldMapNS {
TileManager::TileManager()
{
- lisp_object_t* root_obj = lisp_read_from_file(datadir + "images/worldmap/antarctica.scm");
-
- assert(root_obj);
+ std::string filename = datadir + "images/worldmap/antarctica.scm";
+ lisp_object_t* root_obj = lisp_read_from_file(filename);
+
+ if (!root_obj)
+ st_abort("Couldn't load file", filename);
if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-worldmap-tiles") == 0)
{
void
WorldMap::load_map()
{
- lisp_object_t* root_obj = lisp_read_from_file(datadir + "levels/default/worldmap.stwm");
- assert(root_obj);
+ std::string filename = datadir + "levels/default/worldmap.stwm";
+
+ lisp_object_t* root_obj = lisp_read_from_file(filename);
+ if (!root_obj)
+ st_abort("Couldn't load file", filename);
if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-worldmap") == 0)
{
Point get_next_tile(Point pos, Direction direction);
Tile* at(Point pos);
- bool path_ok(Direction direction, Point old_pos, Point* new_pos);
+
+ /** Check if it is possible to walk from \a pos into \a direction,
+ if possible, write the new position to \a new_pos */
+ bool path_ok(Direction direction, Point pos, Point* new_pos);
};
} // namespace WorldMapNS