X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fscripting%2Ffunctions.cpp;h=e53a8372327d439fabad254075f9cdddd56cc4b3;hb=c3c41a343669d375aaa674c7f3ac35f08f24703e;hp=b978813442a2757ec53ee6662785661c6e181a19;hpb=f1bc1eeb4ab31b20829921e4074f0f54c8c66d1d;p=supertux.git diff --git a/src/scripting/functions.cpp b/src/scripting/functions.cpp index b97881344..e53a83723 100644 --- a/src/scripting/functions.cpp +++ b/src/scripting/functions.cpp @@ -51,6 +51,8 @@ #include "squirrel_util.hpp" #include "time_scheduler.hpp" +extern float game_speed; + namespace Scripting { @@ -96,6 +98,11 @@ void shrink_screen(float dest_x, float dest_y, float seconds) main_loop->set_screen_fade(new ShrinkFade(Vector(dest_x, dest_y), seconds)); } +void abort_screenfade() +{ + main_loop->set_screen_fade(NULL); +} + std::string translate(const std::string& text) { return dictionary_manager.get_dictionary().translate(text); @@ -163,11 +170,10 @@ void save_state() { using namespace WorldMapNS; - if(World::current() == NULL) + if(World::current() == NULL || WorldMap::current() == NULL) throw std::runtime_error("Can't save state without active World"); - if(WorldMap::current() != NULL) - WorldMap::current()->save_state(); + WorldMap::current()->save_state(); World::current()->save_state(); } @@ -175,8 +181,8 @@ void update_worldmap() { using namespace WorldMapNS; - if(World::current() == NULL) - throw std::runtime_error("Can't save state without active World"); + if(WorldMap::current() == NULL) + throw std::runtime_error("Can't update Worldmap: none active"); WorldMap::current()->load_state(); } @@ -281,4 +287,9 @@ int rand() return systemRandom.rand(); } +void set_game_speed(float speed) +{ + ::game_speed = speed; +} + }