Fixed NewScript

master
krzys-h 2015-04-06 16:41:05 +02:00
parent 1a8bb9c0fb
commit 66ea5fd92b
3 changed files with 26 additions and 17 deletions

View File

@ -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;
}

View File

@ -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);
}
}
}

View File

@ -4831,7 +4831,7 @@ char* CRobotMain::GetNewScriptName(ObjectType type, int rank)
}
}
return 0;
return nullptr;
}