This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot.
commit 66ea5fd92becc469ae9a54cb785519eb3fd81f29 Author: krzys-h <krzy...@interia.pl> Date: Mon Apr 6 16:41:05 2015 +0200 Fixed NewScript --- src/object/auto/autofactory.cpp | 19 +++++++++++-------- src/object/brain.cpp | 22 ++++++++++++++-------- src/object/robotmain.cpp | 2 +- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/object/auto/autofactory.cpp b/src/object/auto/autofactory.cpp index bd3ab83..720513a 100644 --- a/src/object/auto/autofactory.cpp +++ b/src/object/auto/autofactory.cpp @@ -644,6 +644,7 @@ bool CAutoFactory::CreateVehicle() CPhysics* physics; Math::Vector pos; float angle; + char* name; angle = m_object->GetAngleY(0); @@ -678,16 +679,18 @@ bool CAutoFactory::CreateVehicle() physics->SetFreeze(true); // it doesn't move } - /* ??? - char* name; - int i; - for ( i=0 ; i<10 ; i++ ) + CBrain* brain = vehicle->GetBrain(); + if(brain != nullptr) { - name = m_main->GetNewScriptName(m_type, i); - if ( name == 0 ) break; - vehicle->ReadProgram(i, name); + for ( int i=0 ; ; i++ ) + { + name = m_main->GetNewScriptName(m_type, i); + if ( name == nullptr ) break; + Program* prog = brain->GetOrAddProgram(i); + vehicle->ReadProgram(prog, name); + prog->readOnly = true; + } } - */ return true; } diff --git a/src/object/brain.cpp b/src/object/brain.cpp index 1f75dfa..e645dfa 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -3133,11 +3133,14 @@ bool CBrain::AddProgram(Program* program) m_program.push_back(program); - UpdateInterface(); - Ui::CWindow* pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); - if ( pw != 0 ) + if(m_object->GetSelect()) { - UpdateScript(pw); + UpdateInterface(); + Ui::CWindow* pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); + if ( pw != 0 ) + { + UpdateScript(pw); + } } return true; } @@ -3153,11 +3156,14 @@ void CBrain::RemoveProgram(Program* program) program->script = nullptr; delete program; - UpdateInterface(); - Ui::CWindow* pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); - if ( pw != 0 ) + if(m_object->GetSelect()) { - UpdateScript(pw); + UpdateInterface(); + Ui::CWindow* pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); + if ( pw != 0 ) + { + UpdateScript(pw); + } } } diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index d5cc377..c0e3721 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4831,7 +4831,7 @@ char* CRobotMain::GetNewScriptName(ObjectType type, int rank) } } - return 0; + return nullptr; } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git _______________________________________________ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits