summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2013-05-05 13:43:05 +0200
committerkrzys-h <krzys_h@interia.pl>2013-05-05 13:43:05 +0200
commit78e32cf894797fbbe865e67299800292597c92ae (patch)
tree208215e59991bba9ea575c449ab872c7e141fe7d /src
parent9549359b4649efd4bd0b6f085d8277f6d12d0ecb (diff)
downloadcolobot-78e32cf894797fbbe865e67299800292597c92ae.tar.gz
colobot-78e32cf894797fbbe865e67299800292597c92ae.tar.bz2
colobot-78e32cf894797fbbe865e67299800292597c92ae.zip
Changed MissionController version requirement 3->2
Also, adding it before BeginObject isn't wrong, and now recommended because it disables Audio and EndMissionTake commands
Diffstat (limited to 'src')
-rw-r--r--src/object/robotmain.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp
index d291397..80ef8ce 100644
--- a/src/object/robotmain.cpp
+++ b/src/object/robotmain.cpp
@@ -4013,7 +4013,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
m_displayText->SetDelay(OpFloat(line, "factor", 1.0f));
}
- if (Cmd(line, "CacheAudio") && !resetObject && m_version >= 3)
+ if (Cmd(line, "CacheAudio") && !resetObject && m_version >= 2)
{
char filename[100];
OpString(line, "filename", filename);
@@ -4021,7 +4021,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
continue;
}
- if (Cmd(line, "AudioChange") && !resetObject && m_version >= 2)
+ if (Cmd(line, "AudioChange") && !resetObject && m_version >= 2 && m_controller == nullptr)
{
int i = m_audioChangeTotal;
if (i < 10)
@@ -4042,7 +4042,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
continue;
}
- if (Cmd(line, "Audio") && !resetObject)
+ if (Cmd(line, "Audio") && !resetObject && m_controller == nullptr)
{
if(m_version < 2) {
int trackid = OpInt(line, "track", 0);
@@ -4390,12 +4390,12 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
m_beginObject = true;
}
- if (Cmd(line, "MissionController") && read[0] == 0 && m_version == 3)
+ if (Cmd(line, "MissionController") && read[0] == 0 && m_version >= 2)
{
- if (!m_beginObject) {
+ /*if (!m_beginObject) {
GetLogger()->Error("Syntax error in file '%s' (line %d): MissionController before BeginObject\n", filename, lineNum);
continue;
- }
+ }*/
m_controller = CreateObject(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f, 1.0f, 0.0f, OBJECT_CONTROLLER, 100.0f, false, false, 0);
m_controller->SetMagnifyDamage(100.0f);
@@ -4514,7 +4514,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
sel = obj;
}
- obj->SetSelectable(OpInt(line, "selectable", 1));
+ bool selectable = OpInt(line, "selectable", 1);
+ obj->SetSelectable(selectable);
obj->SetEnable(OpInt(line, "enable", 1));
obj->SetProxyActivate(OpInt(line, "proxyActivate", 0));
obj->SetProxyDistance(OpFloat(line, "proxyDistance", 15.0f)*g_unit);
@@ -4522,9 +4523,9 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
obj->SetShield(OpFloat(line, "shield", 1.0f));
obj->SetMagnifyDamage(OpFloat(line, "magnifyDamage", 1.0f));
obj->SetClip(OpInt(line, "clip", 1));
- obj->SetCheckToken(m_version >= 2 ? trainer : OpInt(line, "checkToken", 1));
+ obj->SetCheckToken(m_version >= 2 ? trainer || !selectable : OpInt(line, "checkToken", 1));
// SetManual will affect bot speed
- if (type == OBJECT_MOBILEdr) {
+ if (type == OBJECT_MOBILEdr) {
obj->SetManual(m_version >= 2 ? !trainer : OpInt(line, "manual", 0));
}
@@ -4730,7 +4731,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
m_camera->SetFixDirection(OpFloat(line, "fixDirection", 0.25f)*Math::PI);
}
- if (Cmd(line, "EndMissionTake") && !resetObject && m_version<3)
+ if (Cmd(line, "EndMissionTake") && !resetObject && m_controller == nullptr)
{
int i = m_endTakeTotal;
if (i < 10)
@@ -4753,16 +4754,16 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
m_endTakeTotal ++;
}
}
- if (Cmd(line, "EndMissionDelay") && !resetObject && m_version<3)
+ if (Cmd(line, "EndMissionDelay") && !resetObject && m_controller == nullptr)
{
m_endTakeWinDelay = OpFloat(line, "win", 2.0f);
m_endTakeLostDelay = OpFloat(line, "lost", 2.0f);
}
- if (Cmd(line, "EndMissionResearch") && !resetObject && m_version<3)
+ if (Cmd(line, "EndMissionResearch") && !resetObject && m_controller == nullptr)
{
m_endTakeResearch |= OpResearch(line, "type");
}
- if (Cmd(line, "EndMissionNever") && !resetObject && m_version == 2)
+ if (Cmd(line, "EndMissionNever") && !resetObject && m_controller == nullptr)
{
m_endTakeNever = true;
}
@@ -6748,7 +6749,7 @@ void CRobotMain::UpdateAudio(bool frame)
void CRobotMain::SetEndMission(Error result, float delay)
{
- if (m_version >= 3) {
+ if (m_controller != nullptr) {
m_endTakeWinDelay = delay;
m_endTakeLostDelay = delay;
m_missionResult = result;
@@ -6758,7 +6759,7 @@ void CRobotMain::SetEndMission(Error result, float delay)
//! Checks if the mission is over
Error CRobotMain::CheckEndMission(bool frame)
{
- if (m_version >= 3) {
+ if (m_controller != nullptr) {
if (m_missionResult == INFO_LOST) { //mission lost?
m_displayText->DisplayError(INFO_LOST, Math::Vector(0.0f,0.0f,0.0f));
m_winDelay = 0.0f;
@@ -7315,4 +7316,4 @@ void CRobotMain::RestoreNumericLocale()
{
setlocale(LC_NUMERIC, m_oldLocale.c_str());
}
- \ No newline at end of file
+