#include <QtCore/QString>
#include <QtCore/QObject>
using namespace makVrf;
using namespace makVrv;
: myCommand(command)
, myHelp(help)
{
}
: myCommand(orig.myCommand)
, myHelp(orig.myHelp)
{
}
{
QStringList vals = c.split(',');
if (vals.size() != 3)
{
return false;
}
v.setX(atof(vals[0].trimmed().toLatin1().constData()));
v.setY(atof(vals[1].trimmed().toLatin1().constData()));
v.setZ(atof(vals[2].trimmed().toLatin1().constData()));
return true;
}
{
int iLimit = c.length();
int i;
QString token;
QStringList tokens;
bool inQuote = false;
int inParen = 0;
for (i = 0; i < iLimit; i++)
{
if (c[i] == '"')
{
if (inParen == 0)
{
if (!inQuote)
{
inQuote = true;
}
else
{
if (token.length())
{
tokens += token;
}
token = "";
inQuote = false;
}
}
}
else if (c[i] == '(')
{
if (!inQuote)
{
inParen++;
}
else
{
token += c[i];
}
}
else if (c[i] == ')')
{
if (!inQuote)
{
inParen--;
if (inParen == 0)
{
if (token.length())
{
tokens += token;
}
token = "";
}
}
else
{
token += c[i];
}
}
else if (c[i] == delim)
{
if (!inQuote && (inParen == 0))
{
if (token.length())
{
tokens += token;
}
token = "";
}
else
{
token += c[i];
}
}
else
{
token += c[i];
}
}
if (token.length())
{
tokens += token;
}
return tokens;
}
:
DtRemoteControlCommand(
"create",
QObject::tr(
"create \"<Menu Item Name>\" (i.e. \"M1A2 Abrams MBT\") OR Entity Type - delimited by comma (i.e. 1,1,225,1,1,3,0)> <force number> <x,y,z> [simulation address]"))
{
}
{
}
{
QStringList vals = c.split(',');
DtEntityType type;
if (vals.size() == 7)
{
type = DtEntityType(c.toLatin1().constData());
}
else
{
type = DtCreateMenu::instance(de).nameToType(c);
}
return type;
}
{
return DtGuiThreadVrfRemoteController::instance(de).backendManager().selectedBackend();
}
{
int iLimit = tokens.size();
if (iLimit < 4)
{
return false;
}
if (type == DtEntityType())
{
QString
error = QObject::tr(
"Cannot create entity of type ") + tokens[1];
return false;
}
int force = atoi(tokens[2].toLatin1().constData());
{
QString
error = QObject::tr(
"Location format is incorrect ") + tokens[2];
return false;
}
DtSimulationAddress simAddress;
if (iLimit == 5)
{
simAddress = DtSimulationAddress(tokens[4].toLatin1().constData());
}
else
{
}
if (!DtGuiThreadVrfRemoteController::instance(de).backendManager().backendCanSimulate(simAddress))
{
signal_commandComplete(QObject::tr(
"Backend specified is not ready to simulate: ") + simAddress.string(),
this);
return false;
}
simAddress, type, position, (DtForceType)force, 0.0, "", "");
return true;
}
{
QString message = QObject::tr("Object ") + s.c_str();
message += QObject::tr(" with id ") + id.string();
message += QObject::tr(" has been created.");
}
{
}
{
}
{
}
{
if (tokens.size() != 2)
{
return false;
}
DtFilename fn(tokens[1].toUtf8().constData());
if ((fn.extension() != "scn") && (fn.extension() != "scnx"))
{
fn += ".scnx";
}
if (!fn.exists())
{
fn = DtFilename::combine("../userData/scenarios", fn);
}
if (!DtGuiThreadVrfRemoteController::instance(de).loadScenario(fn.c_str()))
{
return false;
}
return true;
}
{
}
{
}
{
}
{
DtGuiThreadVrfRemoteController::instance(de).closeScenario();
return true;
}
{
}
{
}
{
}
{
if (tokens.size() != 2)
{
return false;
}
DtFilename terrain(tokens[1].toLatin1().constData());
if (!terrain.extension().length())
{
terrain += ".mtf";
}
DtGuiThreadVrfRemoteController::instance(de).newScenario(terrain);
return true;
}
{
}
{
}
{
}
{
if (tokens.size() != 2)
{
return false;
}
DtFilename fp(tokens[1].toLatin1().constData());
DtFilename scenario(fp);
fp.stripPath();
if (fp == scenario)
{
ud += scenario.c_str();
scenario = ud.c_str();
}
DtVrfSaveScenarioHandler::instance(de).saveScenario(scenario, true);
return true;
}
{
}
{
}
{
}
{
if (tokens.size() != 1)
{
return false;
}
DtGuiThreadVrfRemoteController::instance(de).rewindScenario();
return true;
}
{
}
{
}
{
}
{
if (tokens.size() != 1)
{
return false;
}
DtGuiThreadVrfRemoteController::instance(de).runScenario();
return true;
}
{
}
{
}
{
}
{
if (tokens.size() != 1)
{
return false;
}
DtGuiThreadVrfRemoteController::instance(de).pauseScenario();
return true;
}
{
}