#include "supertux/tile_manager.hpp"
#include "supertux/tile_set.hpp"
#include "supertux/world.hpp"
+#include "supertux/world_state.hpp"
#include "util/file_system.hpp"
#include "util/gettext.hpp"
#include "util/log.hpp"
WorldMap* WorldMap::current_ = NULL;
-WorldMap::WorldMap(const std::string& filename, PlayerStatus* player_status, const std::string& force_spawnpoint) :
- tux(0),
- player_status(player_status),
+WorldMap::WorldMap(const std::string& filename, WorldState& world_state, const std::string& force_spawnpoint) :
+ tux(),
+ m_world_state(world_state),
tileset(NULL),
free_tileset(false),
camera_offset(),
WorldMap::change(const std::string& filename, const std::string& force_spawnpoint)
{
g_screen_manager->pop_screen();
- g_screen_manager->push_screen(std::unique_ptr<Screen>(new WorldMap(filename, player_status, force_spawnpoint)));
+ g_screen_manager->push_screen(std::unique_ptr<Screen>(new WorldMap(filename, m_world_state, force_spawnpoint)));
}
void
// update state and savegame
save_state();
- g_screen_manager->push_screen(std::unique_ptr<Screen>(new GameSession(levelfile, player_status, &level->statistics)),
+ g_screen_manager->push_screen(std::unique_ptr<Screen>(new GameSession(levelfile, m_world_state, &level->statistics)),
std::unique_ptr<ScreenFade>(new ShrinkFade(shrinkpos, 1.0f)));
in_level = true;
} catch(std::exception& e) {
context.push_transform();
context.set_translation(Vector(0, 0));
- player_status->draw(context);
+ m_world_state.get_player_status()->draw(context);
if (!tux->is_moving()) {
for(LevelTiles::iterator i = levels.begin(); i != levels.end(); ++i) {
sq_settop(vm, oldtop);
- if(World::current() != NULL)
- World::current()->save_state();
+ if (!World::current())
+ {
+ log_fatal << "no World::current(), so can't savegame" << std::endl;
+ }
+ else
+ {
+#ifdef GRUMBEL
+ m_world_state->save_state();
+#endif
+ }
}
void