summaryrefslogtreecommitdiffstats
path: root/src/object/robotmain.cpp
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2013-04-28 20:05:19 +0200
committerkrzys-h <krzys_h@interia.pl>2013-04-28 20:05:19 +0200
commitc7d289c00bc60d366f8c5c1016fb30717a228495 (patch)
tree533bca9f2ee95aabe922b1229233d757975738cc /src/object/robotmain.cpp
parentfc28a8e8406e4b5fd810a09ed3b9524af8d69482 (diff)
downloadcolobot-c7d289c00bc60d366f8c5c1016fb30717a228495.tar.gz
colobot-c7d289c00bc60d366f8c5c1016fb30717a228495.tar.bz2
colobot-c7d289c00bc60d366f8c5c1016fb30717a228495.zip
Beggining of MissionController
Controling mission using CBot
Diffstat (limited to 'src/object/robotmain.cpp')
-rw-r--r--src/object/robotmain.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp
index 7be1177..ddd6545 100644
--- a/src/object/robotmain.cpp
+++ b/src/object/robotmain.cpp
@@ -4351,6 +4351,24 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
m_beginObject = true;
}
+ if (Cmd(line, "MissionController") && read[0] == 0 && m_version == 3)
+ {
+ if (!m_beginObject) {
+ GetLogger()->Error("Syntax error in file '%s' (line %d): MissionController before BeginObject\n", filename, lineNum);
+ continue;
+ }
+
+ CObject* obj = CreateObject(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f, 1.0f, 0.0f, OBJECT_CONTROLLER, 100.0f, false, false, 0);
+ CBrain* brain = obj->GetBrain();
+ if (brain != nullptr)
+ {
+ OpString(line, "script", name);
+ if (name[0] != 0)
+ brain->SetScriptName(1, name);
+ brain->SetScriptRun(1);
+ }
+ }
+
if (Cmd(line, "CreateObject") && read[0] == 0)
{
if (!m_beginObject) {
@@ -4672,7 +4690,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)
+ if (Cmd(line, "EndMissionTake") && !resetObject && m_version<3)
{
int i = m_endTakeTotal;
if (i < 10)
@@ -4695,16 +4713,16 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
m_endTakeTotal ++;
}
}
- if (Cmd(line, "EndMissionDelay") && !resetObject)
+ if (Cmd(line, "EndMissionDelay") && !resetObject && m_version<3)
{
m_endTakeWinDelay = OpFloat(line, "win", 2.0f);
m_endTakeLostDelay = OpFloat(line, "lost", 2.0f);
}
- if (Cmd(line, "EndMissionResearch") && !resetObject)
+ if (Cmd(line, "EndMissionResearch") && !resetObject && m_version<3)
{
m_endTakeResearch |= OpResearch(line, "type");
}
- if (Cmd(line, "EndMissionNever") && !resetObject && m_version >= 2)
+ if (Cmd(line, "EndMissionNever") && !resetObject && m_version == 2)
{
m_endTakeNever = true;
}
@@ -5134,7 +5152,8 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_MOBILEwt ||
type == OBJECT_MOBILEit ||
type == OBJECT_MOBILEdr ||
- type == OBJECT_APOLLO2 )
+ type == OBJECT_APOLLO2 ||
+ type == OBJECT_CONTROLLER )
{
object = new CObject();
object->SetOption(option);
@@ -6690,6 +6709,8 @@ void CRobotMain::UpdateAudio(bool frame)
//! Checks if the mission is over
Error CRobotMain::CheckEndMission(bool frame)
{
+ if (m_version >= 3) return ERR_MISSION_NOTERM; //disabled. TODO: Control from program
+
CInstanceManager* iMan = CInstanceManager::GetInstancePointer();
for (int t = 0; t < m_endTakeTotal; t++)
@@ -6769,7 +6790,7 @@ Error CRobotMain::CheckEndMission(bool frame)
}
if (nb < m_endTake[t].min ||
nb > m_endTake[t].max ||
- m_endTakeNever)
+ m_endTakeNever )
{
m_displayText->SetEnable(true);
return ERR_MISSION_NOTERM;