Don't allow saving if crashed during loading
parent
89c93c15cd
commit
e015d9f1c3
|
@ -63,7 +63,8 @@ void CSignalHandlers::SignalHandler(int sig)
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cxxabi.h>
|
#include <cxxabi.h>
|
||||||
std::string demangle(const char* name) {
|
std::string demangle(const char* name)
|
||||||
|
{
|
||||||
int status;
|
int status;
|
||||||
std::unique_ptr<char[], void(*)(void*)> result {
|
std::unique_ptr<char[], void(*)(void*)> result {
|
||||||
abi::__cxa_demangle(name, nullptr, nullptr, &status),
|
abi::__cxa_demangle(name, nullptr, nullptr, &status),
|
||||||
|
@ -150,7 +151,7 @@ void CSignalHandlers::ReportError(const std::string& errorMessage)
|
||||||
robotMain = CRobotMain::GetInstancePointer();
|
robotMain = CRobotMain::GetInstancePointer();
|
||||||
msg << "The game was in phase " << PhaseToString(robotMain->GetPhase()) << " (ID=" << robotMain->GetPhase() << ")" << std::endl;
|
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;
|
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;
|
||||||
msg << std::endl;
|
msg << std::endl;
|
||||||
|
|
|
@ -5541,6 +5541,11 @@ const std::vector<std::string>& CRobotMain::GetCustomLevelList()
|
||||||
return m_ui->GetCustomLevelList();
|
return m_ui->GetCustomLevelList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CRobotMain::IsLoading()
|
||||||
|
{
|
||||||
|
return m_ui->GetLoadingScreen()->IsVisible();
|
||||||
|
}
|
||||||
|
|
||||||
void CRobotMain::StartMissionTimer()
|
void CRobotMain::StartMissionTimer()
|
||||||
{
|
{
|
||||||
if (m_missionTimerEnabled && !m_missionTimerStarted)
|
if (m_missionTimerEnabled && !m_missionTimerStarted)
|
||||||
|
|
|
@ -302,6 +302,9 @@ public:
|
||||||
std::string GetCustomLevelName(int id);
|
std::string GetCustomLevelName(int id);
|
||||||
const std::vector<std::string>& GetCustomLevelList();
|
const std::vector<std::string>& GetCustomLevelList();
|
||||||
|
|
||||||
|
//! Returns true if the game is on the loading screen
|
||||||
|
bool IsLoading();
|
||||||
|
|
||||||
void StartMissionTimer();
|
void StartMissionTimer();
|
||||||
|
|
||||||
void SetAutosave(bool enable);
|
void SetAutosave(bool enable);
|
||||||
|
|
Loading…
Reference in New Issue