parent
4e836fa1d8
commit
a5ff361bcc
|
@ -43,7 +43,7 @@
|
||||||
#include "ui/window.h"
|
#include "ui/window.h"
|
||||||
|
|
||||||
|
|
||||||
#include <regex>
|
#include <boost/regex.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -416,12 +416,12 @@ bool CAutoFactory::EventProcess(const Event &event)
|
||||||
CBrain* brain = dynamic_cast<CProgrammableObject*>(vehicle)->GetBrain();
|
CBrain* brain = dynamic_cast<CProgrammableObject*>(vehicle)->GetBrain();
|
||||||
Program* program = brain->AddProgram();
|
Program* program = brain->AddProgram();
|
||||||
|
|
||||||
if (std::regex_search(m_program, std::regex("^[A-Za-z0-9_]+$"))) // Public function name?
|
if (boost::regex_search(m_program, boost::regex("^[A-Za-z0-9_]+$"))) // Public function name?
|
||||||
{
|
{
|
||||||
std::string code = "extern void object::Start_"+m_program+"()\n{\n\t\n\t//Automatically generated by object.factory()\n\t"+m_program+"();\n\t\n}\n";
|
std::string code = "extern void object::Start_"+m_program+"()\n{\n\t\n\t//Automatically generated by object.factory()\n\t"+m_program+"();\n\t\n}\n";
|
||||||
program->script->SendScript(code.c_str());
|
program->script->SendScript(code.c_str());
|
||||||
}
|
}
|
||||||
else if (std::regex_search(m_program, std::regex(".txt$"))) // File name (with .txt extension)?
|
else if (boost::regex_search(m_program, boost::regex(".txt$"))) // File name (with .txt extension)?
|
||||||
{
|
{
|
||||||
program->script->ReadScript(m_program.c_str());
|
program->script->ReadScript(m_program.c_str());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue