From: Ingo Ruhnke Date: Mon, 26 Apr 2004 15:03:24 +0000 (+0000) Subject: - removed st_abort() from lisp reader, client code should check the return value... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=6074972382238a94397b649650738daf0d869775;p=supertux.git - removed st_abort() from lisp reader, client code should check the return value instead SVN-Revision: 752 --- diff --git a/data/images/tilesets/supertux.stgt b/data/images/tilesets/supertux.stgt index 06380f3fa..1eed6a013 100644 --- a/data/images/tilesets/supertux.stgt +++ b/data/images/tilesets/supertux.stgt @@ -456,6 +456,7 @@ "goal2-1.png" "goal2-1.png")) - + (tile (id 131) + (images "black.png")) ) diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 0d3eb0b07..d523bdaff 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -750,9 +750,12 @@ std::string slotinfo(int slot) sprintf(slotfile,"%s/slot%d.stsg",st_save_dir,slot); lisp_object_t* savegame = lisp_read_from_file(slotfile); - LispReader reader(lisp_cdr(savegame)); - reader.read_string("title", &title); - lisp_free(savegame); + if (savegame) + { + LispReader reader(lisp_cdr(savegame)); + reader.read_string("title", &title); + lisp_free(savegame); + } if (access(slotfile, F_OK) == 0) { diff --git a/src/lispreader.cpp b/src/lispreader.cpp index e6d8cf721..9074633f9 100644 --- a/src/lispreader.cpp +++ b/src/lispreader.cpp @@ -1317,18 +1317,6 @@ lisp_object_t* lisp_read_from_file(const std::string& filename) if (has_suffix(filename.c_str(), ".gz")) { return lisp_read_from_gzfile(filename.c_str()); -#if 0 - lisp_object_t* obj = 0; - gzFile in = gzopen(filename, "r"); - - if (in) - { - lisp_stream_init_gzfile(&stream, in); - obj = lisp_read(&stream); - gzclose(in); - } - return obj; -#endif } else { @@ -1341,12 +1329,6 @@ lisp_object_t* lisp_read_from_file(const std::string& filename) obj = lisp_read(&stream); fclose(in); } - else { - std::cerr << "LispReader: File not found: " << filename << endl; - st_abort("aborting", ""); - } - - return obj; } diff --git a/src/sprite_manager.cpp b/src/sprite_manager.cpp index 08a1506e6..e2343a865 100644 --- a/src/sprite_manager.cpp +++ b/src/sprite_manager.cpp @@ -38,6 +38,12 @@ void SpriteManager::load_resfile(const std::string& filename) { lisp_object_t* root_obj = lisp_read_from_file(filename); + if (!root_obj) + { + std::cout << "SpriteManager: Couldn't load: " << filename << std::endl; + return; + } + lisp_object_t* cur = root_obj; if (strcmp(lisp_symbol(lisp_car(cur)), "supertux-resources") != 0) diff --git a/src/title.cpp b/src/title.cpp index 0bc1248ba..4064e9705 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -364,3 +364,5 @@ void title(void) delete logo; } +// EOF // + diff --git a/src/worldmap.cpp b/src/worldmap.cpp index 366deb50e..d0b378b92 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -921,6 +921,12 @@ WorldMap::loadgame(const std::string& filename) return; lisp_object_t* savegame = lisp_read_from_file(filename); + if (savegame) + { + std::cout << "WorldMap:loadgame: File not found: " << filename << std::endl; + return; + } + lisp_object_t* cur = savegame; if (strcmp(lisp_symbol(lisp_car(cur)), "supertux-savegame") != 0)