#include "supertux/gameconfig.hpp"
#include "supertux/levelintro.hpp"
#include "supertux/globals.hpp"
+#include "supertux/player_status.hpp"
#include "supertux/screen_manager.hpp"
#include "supertux/menu/menu_storage.hpp"
#include "supertux/menu/game_menu.hpp"
int
GameSession::restart_level()
{
+ PlayerStatus* currentStatus = get_player_status();
+ coins_at_start = currentStatus->coins;
+ bonus_at_start = currentStatus->bonus;
+ max_fire_bullets_at_start = currentStatus->max_fire_bullets;
+ max_ice_bullets_at_start = currentStatus->max_ice_bullets;
if (edit_mode) {
force_ghost_mode();
case MNID_ABORTLEVEL:
MenuManager::set_current(0);
g_screen_manager->exit_screen();
- // TODO: revert coins and powerups to previous
- // values so as to discourage powerup "farming"
+ currentsector->player->set_bonus(bonus_at_start);
+ PlayerStatus *currentStatus = get_player_status();
+ currentStatus->coins = coins_at_start;
+ currentStatus->max_fire_bullets = max_fire_bullets_at_start;
+ currentStatus->max_ice_bullets = max_ice_bullets_at_start;
}
}
}
#include "object/endsequence.hpp"
#include "supertux/screen.hpp"
+#include "supertux/player_status.hpp"
#include "util/currenton.hpp"
#include "video/surface.hpp"
bool edit_mode; /**< true if GameSession runs in level editor mode */
bool levelintro_shown; /**< true if the LevelIntro screen was already shown */
+
+ int coins_at_start; /** How many coins does the player have at the start */
+ BonusType bonus_at_start; /** What bonuses does the player have at the start */
+ int max_fire_bullets_at_start; /** How many fire bullets does the player have */
+ int max_ice_bullets_at_start; /** How many ice bullets does the player have */
private:
GameSession(const GameSession&);