mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-17 04:51:48 +00:00
Changed: Minor changes
This commit is contained in:
parent
eb30647103
commit
58d7c95b05
1 changed files with 12 additions and 12 deletions
|
@ -51,35 +51,35 @@ int main(int argc, char *argv[])
|
|||
printf("%s <world_edit_class> <primitive_file> [-test]", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
string sourceDocName;
|
||||
if (!test)
|
||||
sourceDocName = argv[2];
|
||||
else
|
||||
sourceDocName = "test_compilateur.primitive";
|
||||
|
||||
|
||||
// remove the path
|
||||
sourceDocName = CFile::getFilename(sourceDocName);
|
||||
// init ligo
|
||||
NLLIGO::CLigoConfig LigoConfig;
|
||||
|
||||
CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig;
|
||||
|
||||
|
||||
nlinfo("Reading ligo configuration file...");
|
||||
if (!LigoConfig.readPrimitiveClass (argv[1], false))
|
||||
{
|
||||
nlwarning("Can't read '%s' !", argv[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
NLLIGO::Register();
|
||||
|
||||
nlinfo("Reading primitive file...");
|
||||
|
||||
|
||||
CPrimitives primDoc;
|
||||
CPrimitiveContext::instance().CurrentPrimitive = &primDoc;
|
||||
loadXmlPrimitiveFile(primDoc, sourceDocName, LigoConfig);
|
||||
|
||||
|
||||
CMissionCompiler mc;
|
||||
|
||||
if (test)
|
||||
|
@ -99,7 +99,7 @@ int main(int argc, char *argv[])
|
|||
script = script.replace(NL.c_str(), "\n");
|
||||
|
||||
const char *tmp = ::getenv("TEMP");
|
||||
|
||||
|
||||
FILE *fp = ::fopen((string(tmp)+"/compiled_mission.script").c_str(), "w");
|
||||
::fwrite(script.data(), script.size(), 1, fp);
|
||||
::fclose(fp);
|
||||
|
@ -119,7 +119,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
nlinfo("Compiling missions...");
|
||||
try
|
||||
{
|
||||
|
@ -166,14 +166,14 @@ int main(int argc, char *argv[])
|
|||
TPrimitiveSet scripts;
|
||||
CPrimitiveSet<TPrimitiveClassPredicate> filter;
|
||||
filter.buildSet(primDoc->RootNode, TPrimitiveClassPredicate("mission"), scripts);
|
||||
|
||||
|
||||
// for each script, check if it was generated, and if so, check the name
|
||||
// of the source primitive file.
|
||||
for (uint i=0; i<scripts.size(); ++i)
|
||||
{
|
||||
vector<string> *script;
|
||||
if (scripts[i]->getPropertyByName("script", script) && !script->empty())
|
||||
{
|
||||
{
|
||||
// Format should be : #compiled from <source_primitive_name>
|
||||
if (script->front().find("compiled from"))
|
||||
{
|
||||
|
@ -208,14 +208,14 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (bots.empty())
|
||||
{
|
||||
nlwarning("Can't find bot '%s' in primitive '%s' !",
|
||||
nlwarning("Can't find bot '%s' in primitive '%s' !",
|
||||
mission.getGiverName().c_str(),
|
||||
fileName.c_str());
|
||||
throw EParseException(NULL, "Can't find giver in primitive");
|
||||
}
|
||||
else if (bots.size() > 1)
|
||||
{
|
||||
nlwarning("Found more than one bot named '%s' in primitive '%s' !",
|
||||
nlwarning("Found more than one bot named '%s' in primitive '%s' !",
|
||||
mission.getGiverName().c_str(),
|
||||
fileName.c_str());
|
||||
throw EParseException(NULL, "More than one bot with giver name in primitive");
|
||||
|
|
Loading…
Reference in a new issue