Fixed game save being always blocked
Also, prevent autosave if saving is blockedmaster
parent
02b76e5aba
commit
41c0ec0940
|
@ -77,6 +77,7 @@
|
|||
|
||||
#include "object/task/task.h"
|
||||
#include "object/task/taskbuild.h"
|
||||
#include "object/task/taskmanager.h"
|
||||
#include "object/task/taskmanip.h"
|
||||
|
||||
#include "physics/physics.h"
|
||||
|
@ -2363,8 +2364,11 @@ bool CRobotMain::EventFrame(const Event &event)
|
|||
m_levelCategory == LevelCategory::FreeGame ||
|
||||
m_levelCategory == LevelCategory::CustomLevels )
|
||||
{
|
||||
m_autosaveLast = m_gameTimeAbsolute;
|
||||
Autosave();
|
||||
if (!IOIsBusy())
|
||||
{
|
||||
m_autosaveLast = m_gameTimeAbsolute;
|
||||
Autosave();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4804,7 +4808,7 @@ char* CRobotMain::GetNewScriptName(ObjectType type, int rank)
|
|||
|
||||
|
||||
//! Seeks if an object occupies in a spot, to prevent a backup of the game
|
||||
bool CRobotMain::IsBusy()
|
||||
bool CRobotMain::IOIsBusy()
|
||||
{
|
||||
if (CScriptFunctions::m_numberOfOpenFiles > 0) return true;
|
||||
|
||||
|
@ -4812,6 +4816,7 @@ bool CRobotMain::IsBusy()
|
|||
{
|
||||
if (! obj->Implements(ObjectInterfaceType::TaskExecutor)) continue;
|
||||
|
||||
if (obj->Implements(ObjectInterfaceType::Programmable) && dynamic_cast<CProgrammableObject*>(obj)->IsProgram()) continue; // TODO: I'm not sure if this is correct but this is how it worked earlier
|
||||
if (dynamic_cast<CTaskExecutorObject*>(obj)->IsForegroundTask()) return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -287,7 +287,7 @@ public:
|
|||
void SelectPlayer(std::string playerName);
|
||||
CPlayerProfile* GetPlayerProfile();
|
||||
|
||||
bool IsBusy();
|
||||
bool IOIsBusy();
|
||||
bool IOWriteScene(std::string filename, std::string filecbot, std::string filescreenshot, char *info);
|
||||
void IOWriteSceneFinished();
|
||||
CObject* IOReadScene(std::string filename, std::string filecbot);
|
||||
|
|
|
@ -209,7 +209,7 @@ void CMainDialog::StartPauseMenu()
|
|||
pos.y = 0.62f;
|
||||
pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_WRITE);
|
||||
pb->SetState(STATE_SHADOW);
|
||||
if ( m_main->IsBusy() ) // current task?
|
||||
if ( m_main->IOIsBusy() ) // current task?
|
||||
{
|
||||
pb->ClearState(STATE_ENABLE);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue