Don't allow saving if crashed during loading

master
krzys-h 2015-09-01 16:15:59 +02:00
parent 89c93c15cd
commit e015d9f1c3
3 changed files with 11 additions and 2 deletions

View File

@ -63,7 +63,8 @@ void CSignalHandlers::SignalHandler(int sig)
#include <cstdlib>
#include <memory>
#include <cxxabi.h>
std::string demangle(const char* name) {
std::string demangle(const char* name)
{
int status;
std::unique_ptr<char[], void(*)(void*)> result {
abi::__cxa_demangle(name, nullptr, nullptr, &status),
@ -150,7 +151,7 @@ void CSignalHandlers::ReportError(const std::string& errorMessage)
robotMain = CRobotMain::GetInstancePointer();
msg << "The game was in phase " << PhaseToString(robotMain->GetPhase()) << " (ID=" << robotMain->GetPhase() << ")" << std::endl;
msg << "Last started level was: category=" << GetLevelCategoryDir(robotMain->GetLevelCategory()) << " chap=" << robotMain->GetLevelChap() << " rank=" << robotMain->GetLevelRank() << std::endl;
canSave = (robotMain->GetPhase() == PHASE_SIMUL);
canSave = (robotMain->GetPhase() == PHASE_SIMUL) && !robotMain->IsLoading();
}
msg << "==============================" << std::endl;
msg << std::endl;

View File

@ -5541,6 +5541,11 @@ const std::vector<std::string>& CRobotMain::GetCustomLevelList()
return m_ui->GetCustomLevelList();
}
bool CRobotMain::IsLoading()
{
return m_ui->GetLoadingScreen()->IsVisible();
}
void CRobotMain::StartMissionTimer()
{
if (m_missionTimerEnabled && !m_missionTimerStarted)

View File

@ -302,6 +302,9 @@ public:
std::string GetCustomLevelName(int id);
const std::vector<std::string>& GetCustomLevelList();
//! Returns true if the game is on the loading screen
bool IsLoading();
void StartMissionTimer();
void SetAutosave(bool enable);