diff options
Diffstat (limited to 'src/object/brain.cpp')
-rw-r--r-- | src/object/brain.cpp | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/src/object/brain.cpp b/src/object/brain.cpp index fa3e425..9e5149e 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -1309,14 +1309,17 @@ bool CBrain::CreateInterface(bool bSelect) type == OBJECT_ANT || type == OBJECT_SPIDER || type == OBJECT_BEE || - type == OBJECT_WORM ) // vehicle? + type == OBJECT_WORM || + type == OBJECT_CONTROLLER) // vehicle? { - if (!(m_main->GetRetroMode())) { + if (!(m_main->GetRetroMode())) + { ddim.x = dim.x*5.1f; - ddim.y = dim.y*2.0f; + ddim.y = dim.y*2.0f; // default => 2 pos.x = ox+sx*0.0f; pos.y = oy+sy*0.0f; - pw->CreateList(pos, ddim, -1, EVENT_OBJECT_PROGLIST, 1.10f); + + pw->CreateList(pos, ddim, -1, EVENT_OBJECT_PROGLIST, -1.10f); UpdateScript(pw); pos.x = ox+sx*5.2f; @@ -1333,7 +1336,8 @@ bool CBrain::CreateInterface(bool bSelect) type == OBJECT_MOBILEfi || type == OBJECT_MOBILEfs || type == OBJECT_MOBILEft || - type == OBJECT_BEE ) // driving? + type == OBJECT_BEE || + type == OBJECT_CONTROLLER) // driving? { pos.x = ox+sx*6.4f; pos.y = oy+sy*0; @@ -1345,8 +1349,9 @@ bool CBrain::CreateInterface(bool bSelect) pb = pw->CreateButton(pos, dim, 28, EVENT_OBJECT_GASUP); pb->SetImmediat(true); - if ( type != OBJECT_HUMAN || - m_object->GetOption() != 2 ) + if ( (type != OBJECT_HUMAN && + type != OBJECT_CONTROLLER) || + m_object->GetOption() != 2 ) { pos.x = ox+sx*15.3f; pos.y = oy+sy*0; @@ -2056,7 +2061,7 @@ void CBrain::UpdateInterface(float rTime) pc->SetState(Ui::STATE_VISIBLE, m_main->GetShowMap()); } - pb = (Ui::CButton*)pw->SearchControl(EVENT_OBJECT_REC); + pb = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_OBJECT_REC)); if ( pb != 0 ) { if ( m_bTraceRecord && Math::Mod(m_time, 0.4f) >= 0.2f ) @@ -2304,7 +2309,8 @@ void CBrain::UpdateInterface() type == OBJECT_ANT || type == OBJECT_SPIDER || type == OBJECT_BEE || - type == OBJECT_WORM ) // vehicle? + type == OBJECT_WORM || + type == OBJECT_CONTROLLER) // vehicle? { bRun = false; if ( m_script[m_selScript] != 0 ) @@ -2481,7 +2487,7 @@ void CBrain::UpdateScript(Ui::CWindow *pw) } } - pl->SetName(i, name); + pl->SetItemName(i, name); } if ( !bSoluce ) @@ -2715,6 +2721,23 @@ bool CBrain::ReadSoluce(char* filename) return true; } +// Load a script from text buffer. + +bool CBrain::SendProgram(int rank, const char* buffer) +{ + if ( m_script[rank] == 0 ) + { + m_script[rank] = new CScript(m_object, &m_secondaryTask); + } + + if ( m_script[rank]->SendScript(buffer) ) return true; + + delete m_script[rank]; + m_script[rank] = 0; + + return false; +} + // Load a script with a text file. bool CBrain::ReadProgram(int rank, const char* filename) |