Don't require user to launch the SpaceShip before ending the mission, if it has selectable=0

Closes #376
dev-mp
krzys-h 2014-11-09 19:26:36 +01:00
parent bfdc577547
commit 1ae66d39f3
2 changed files with 9 additions and 9 deletions

View File

@ -1240,7 +1240,7 @@ void CRobotMain::ChangePhase(Phase phase)
StartDisplayInfo(SATCOM_HUSTON, false); // shows the instructions StartDisplayInfo(SATCOM_HUSTON, false); // shows the instructions
m_sound->StopMusic(0.0f); m_sound->StopMusic(0.0f);
if (!m_base || loading) StartMusic(); if (m_base == nullptr || loading) StartMusic();
} }
catch(const CLevelParserException& e) catch(const CLevelParserException& e)
{ {
@ -3696,7 +3696,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
m_fixScene = fixScene; m_fixScene = fixScene;
g_id = 0; g_id = 0;
m_base = false; m_base = nullptr;
if (!resetObject) if (!resetObject)
{ {
@ -4322,7 +4322,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
{ {
obj->SetDefRank(rankObj); obj->SetDefRank(rankObj);
if (type == OBJECT_BASE) m_base = true; if (type == OBJECT_BASE) m_base = obj;
Gfx::CameraType cType = line->GetParam("camera")->AsCameraType(Gfx::CAM_TYPE_NULL); Gfx::CameraType cType = line->GetParam("camera")->AsCameraType(Gfx::CAM_TYPE_NULL);
if (cType != Gfx::CAM_TYPE_NULL) if (cType != Gfx::CAM_TYPE_NULL)
@ -4741,7 +4741,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
m_selectObject = sel; m_selectObject = sel;
if (!m_base && // no main base? if (m_base == nullptr && // no main base?
!m_fixScene) // interractive scene? !m_fixScene) // interractive scene?
{ {
CObject* obj; CObject* obj;
@ -5924,7 +5924,7 @@ CObject* CRobotMain::IOReadObject(char *line, const char* filename, int objRank)
} }
} }
if (type == OBJECT_BASE) m_base = true; if (type == OBJECT_BASE) m_base = obj;
obj->Read(line); obj->Read(line);
@ -5956,7 +5956,7 @@ CObject* CRobotMain::IOReadObject(char *line, const char* filename, int objRank)
//! Resumes some part of the game //! Resumes some part of the game
CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot) CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
{ {
m_base = false; m_base = nullptr;
FILE* file = fopen(filename, "r"); FILE* file = fopen(filename, "r");
if (file == NULL) return 0; if (file == NULL) return 0;
@ -6386,7 +6386,7 @@ Error CRobotMain::CheckEndMission(bool frame)
if(m_exitAfterMission) if(m_exitAfterMission)
m_eventQueue->AddEvent(Event(EVENT_QUIT)); m_eventQueue->AddEvent(Event(EVENT_QUIT));
} }
if (frame && m_base) return ERR_MISSION_NOTERM; if (frame && m_base != nullptr && m_base->GetSelectable()) return ERR_MISSION_NOTERM;
if (m_missionResult == ERR_OK) { //mission win? if (m_missionResult == ERR_OK) { //mission win?
m_displayText->DisplayError(INFO_WIN, Math::Vector(0.0f,0.0f,0.0f)); m_displayText->DisplayError(INFO_WIN, Math::Vector(0.0f,0.0f,0.0f));
if(m_missionTimerEnabled && m_missionTimerStarted) { if(m_missionTimerEnabled && m_missionTimerStarted) {
@ -6529,7 +6529,7 @@ Error CRobotMain::CheckEndMission(bool frame)
return ERR_OK; // mission ended return ERR_OK; // mission ended
} }
if (frame && m_base) return ERR_MISSION_NOTERM; if (frame && m_base != nullptr && m_base->GetSelectable()) return ERR_MISSION_NOTERM;
if (m_winDelay == 0.0f) if (m_winDelay == 0.0f)
{ {

View File

@ -471,7 +471,7 @@ protected:
float m_winDelay; float m_winDelay;
float m_lostDelay; float m_lostDelay;
bool m_fixScene; // scene fixed, no interraction bool m_fixScene; // scene fixed, no interraction
bool m_base; // OBJECT_BASE exists in mission CObject* m_base; // OBJECT_BASE exists in mission
Math::Point m_lastMousePos; Math::Point m_lastMousePos;
CObject* m_selectObject; CObject* m_selectObject;