Changed: Applied patch fixing the mission_compiler_lib build under Linux

This commit is contained in:
sfb 2011-05-29 14:08:46 -05:00
parent 824243a7af
commit 977a6a7fd0
3 changed files with 86 additions and 24 deletions

View file

@ -10,11 +10,11 @@ ADD_SUBDIRECTORY(named_items_2_csv)
IF(WIN32) IF(WIN32)
ADD_SUBDIRECTORY(export) ADD_SUBDIRECTORY(export)
ADD_SUBDIRECTORY(world_editor) ADD_SUBDIRECTORY(world_editor)
IF(WITH_MFC)
ADD_SUBDIRECTORY(mission_compiler_fe)
ENDIF(WITH_MFC)
ENDIF(WIN32) ENDIF(WIN32)
IF(WITH_MFC)
ADD_SUBDIRECTORY(mission_compiler_fe)
ENDIF(WITH_MFC)
IF(WITH_QT) IF(WITH_QT)
ADD_SUBDIRECTORY(georges_editor_qt) ADD_SUBDIRECTORY(georges_editor_qt)

View file

@ -17,6 +17,7 @@
#include "mission_compiler.h" #include "mission_compiler.h"
#include "step.h" #include "step.h"
#include "nel/misc/i18n.h" #include "nel/misc/i18n.h"
#include "nel/ligo/primitive_utils.h"
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
@ -526,7 +527,12 @@ bool CMissionCompiler::compileMission(NLLIGO::IPrimitive *rootPrim, const std::s
} }
// first, start by reading mission variables // first, start by reading mission variables
IPrimitive *variables = getPrimitiveChild(mission, TPrimitiveClassPredicate("variables")); IPrimitive *variables;
{
TPrimitiveClassPredicate predTmp("variables");
variables= NLLIGO::getPrimitiveChild(mission, predTmp);
}
if (!variables) if (!variables)
{ {
nlwarning("Can't find variables !"); nlwarning("Can't find variables !");
@ -540,7 +546,12 @@ bool CMissionCompiler::compileMission(NLLIGO::IPrimitive *rootPrim, const std::s
// now, we can init the mission header phrase (they need variable knwoled) // now, we can init the mission header phrase (they need variable knwoled)
md.initHeaderPhrase(rootPrim); md.initHeaderPhrase(rootPrim);
IPrimitive *preReq = getPrimitiveChild(mission, TPrimitiveClassPredicate("pre_requisite")); IPrimitive *preReq;
{
TPrimitiveClassPredicate predTmp("pre_requisite");
preReq = getPrimitiveChild(mission, predTmp);
}
if (!preReq) if (!preReq)
{ {
nlwarning("Can't find pre requisite !"); nlwarning("Can't find pre requisite !");
@ -598,7 +609,8 @@ bool CMissionCompiler::compileMissions(IPrimitive *rootPrim, const std::string &
CPrimitiveSet<TPrimitiveClassPredicate> scriptsSet; CPrimitiveSet<TPrimitiveClassPredicate> scriptsSet;
scriptsSet.buildSet(rootPrim, TPrimitiveClassPredicate("mission_tree"), missionTrees); TPrimitiveClassPredicate pred("mission_tree");
scriptsSet.buildSet(rootPrim, pred, missionTrees);
nlinfo("Found %u mission tree in the primitive file", missionTrees.size()); nlinfo("Found %u mission tree in the primitive file", missionTrees.size());
@ -667,7 +679,8 @@ bool CMissionCompiler::installCompiledMission(NLLIGO::CLigoConfig &ligoConfig, c
TPrimitiveSet scripts; TPrimitiveSet scripts;
CPrimitiveSet<TPrimitiveClassPredicate> filter; CPrimitiveSet<TPrimitiveClassPredicate> filter;
filter.buildSet(primDoc->RootNode, TPrimitiveClassPredicate("mission"), scripts); TPrimitiveClassPredicate pred("mission");
filter.buildSet(primDoc->RootNode, pred, scripts);
// for each script, check if it was generated, and if so, check the name // for each script, check if it was generated, and if so, check the name
// of the source primitive file. // of the source primitive file.
@ -732,7 +745,8 @@ bool CMissionCompiler::installCompiledMission(NLLIGO::CLigoConfig &ligoConfig, c
TPrimitiveSet bots; TPrimitiveSet bots;
CPrimitiveSet<TPrimitiveClassAndNamePredicate> filter; CPrimitiveSet<TPrimitiveClassAndNamePredicate> filter;
filter.buildSet(primDoc->RootNode, TPrimitiveClassAndNamePredicate("npc_bot", mission.getGiverName()), bots); TPrimitiveClassAndNamePredicate pred("npc_bot", mission.getGiverName());
filter.buildSet(primDoc->RootNode, pred, bots);
if (bots.empty()) if (bots.empty())
{ {
@ -961,7 +975,8 @@ bool CMissionCompiler::parseOneStep(CMissionData &md, IPrimitive *stepToParse, I
bool CMissionCompiler::parseSteps(CMissionData &md, IPrimitive *steps, IStep *parent) bool CMissionCompiler::parseSteps(CMissionData &md, IPrimitive *steps, IStep *parent)
{ {
TPrimitiveSet childs; TPrimitiveSet childs;
filterPrimitiveChilds(steps, TPrimitivePropertyPredicate("step_tag", "true"), childs); TPrimitivePropertyPredicate pred("step_tag", "true");
filterPrimitiveChilds(steps, pred, childs);
if (childs.empty()) if (childs.empty())
{ {

View file

@ -55,7 +55,11 @@ IStep::IStep(CMissionData &md, NLLIGO::IPrimitive *prim)
// parse the sub prim to create action & objectives; // parse the sub prim to create action & objectives;
IPrimitive *child; IPrimitive *child;
// parse the preactions // parse the preactions
child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("actions", "pre_actions")); {
TPrimitiveClassAndNamePredicate pred("actions", "pre_actions");
child = getPrimitiveChild(prim, pred);
}
if (child) if (child)
{ {
for (uint i=0; i<child->getNumChildren(); ++i) for (uint i=0; i<child->getNumChildren(); ++i)
@ -72,7 +76,10 @@ IStep::IStep(CMissionData &md, NLLIGO::IPrimitive *prim)
} }
} }
// parse the objectives // parse the objectives
child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("mission_objectives", "objectives")); {
TPrimitiveClassAndNamePredicate pred("mission_objectives", "objectives");
child = getPrimitiveChild(prim, pred);
}
if (child) if (child)
{ {
for (uint i=0; i<child->getNumChildren(); ++i) for (uint i=0; i<child->getNumChildren(); ++i)
@ -89,7 +96,10 @@ IStep::IStep(CMissionData &md, NLLIGO::IPrimitive *prim)
} }
} }
// parse the post actions // parse the post actions
child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("actions", "post_actions")); {
TPrimitiveClassAndNamePredicate pred("actions", "post_actions");
child = getPrimitiveChild(prim, pred);
}
if (child) if (child)
{ {
for (uint i=0; i<child->getNumChildren(); ++i) for (uint i=0; i<child->getNumChildren(); ++i)
@ -447,7 +457,10 @@ public:
// parse the sub prim to create action & objectives; // parse the sub prim to create action & objectives;
IPrimitive *child; IPrimitive *child;
// parse the pre-actions // parse the pre-actions
child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("actions", "actions")); {
TPrimitiveClassAndNamePredicate pred("actions", "actions");
child = getPrimitiveChild(prim, pred);
}
if (child) if (child)
{ {
for (uint i=0; i<child->getNumChildren(); ++i) for (uint i=0; i<child->getNumChildren(); ++i)
@ -464,7 +477,10 @@ public:
} }
} }
// look for an optional jump // look for an optional jump
child = getPrimitiveChild(prim, TPrimitiveClassPredicate("jump_to")); {
TPrimitiveClassPredicate pred("jump_to");
child = getPrimitiveChild(prim, pred);
}
if (child) if (child)
{ {
// ok, we have a jump at end of fail step // ok, we have a jump at end of fail step
@ -515,7 +531,10 @@ public:
// parse the sub prim to create action & objectives; // parse the sub prim to create action & objectives;
IPrimitive *child; IPrimitive *child;
// parse the pre-actions // parse the pre-actions
child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("actions", "actions")); {
TPrimitiveClassAndNamePredicate pred("actions", "actions");
child = getPrimitiveChild(prim, pred);
}
if (child) if (child)
{ {
for (uint i=0; i<child->getNumChildren(); ++i) for (uint i=0; i<child->getNumChildren(); ++i)
@ -546,7 +565,10 @@ public:
} }
// look for an optional jump // look for an optional jump
child = getPrimitiveChild(prim, TPrimitiveClassPredicate("jump_to")); {
TPrimitiveClassPredicate pred("jump_to");
child = getPrimitiveChild(prim, pred);
}
if (child) if (child)
{ {
// ok, we have a jump at end of fail step // ok, we have a jump at end of fail step
@ -607,14 +629,20 @@ CStepPlayerReconnect::CStepPlayerReconnect(CMissionData &md, IPrimitive *prim) :
IPrimitive *child; IPrimitive *child;
TPrimitiveSet resp; TPrimitiveSet resp;
filterPrimitiveChilds(prim, TPrimitivePropertyPredicate("step_tag", "true"), resp); {
TPrimitivePropertyPredicate pred("step_tag", "true");
filterPrimitiveChilds(prim, pred, resp);
}
for (uint i=0; i<resp.size(); ++i) for (uint i=0; i<resp.size(); ++i)
{ {
_SubBranchs.push_back(resp[i]); _SubBranchs.push_back(resp[i]);
} }
// look for an optional jump // look for an optional jump
child = getPrimitiveChild(prim, TPrimitiveClassPredicate("jump_to")); {
TPrimitiveClassPredicate pred("jump_to");
child = getPrimitiveChild(prim, pred);
}
if (child) if (child)
{ {
// ok, we have a jump at end of fail step // ok, we have a jump at end of fail step
@ -721,12 +749,19 @@ public:
} }
// build the sub branch list // build the sub branch list
IPrimitive *noResp = getPrimitiveChild(prim, TPrimitiveClassPredicate("no_answer")); IPrimitive *noResp;
{
TPrimitiveClassPredicate pred("no_answer");
noResp = getPrimitiveChild(prim, pred);
}
nlassert(noResp); nlassert(noResp);
_SubBranchs.push_back(noResp); _SubBranchs.push_back(noResp);
TPrimitiveSet resp; TPrimitiveSet resp;
filterPrimitiveChilds(prim, TPrimitiveClassPredicate("dyn_answer"), resp); {
TPrimitiveClassPredicate pred("dyn_answer");
filterPrimitiveChilds(prim, pred, resp);
}
_Responses.resize(resp.size()); _Responses.resize(resp.size());
for (uint i=0; i<resp.size(); ++i) for (uint i=0; i<resp.size(); ++i)
{ {
@ -750,7 +785,10 @@ public:
for (uint i = 0; i < _SubBranchs.size(); ++i) for (uint i = 0; i < _SubBranchs.size(); ++i)
{ {
TPrimitiveSet childs; TPrimitiveSet childs;
filterPrimitiveChilds(_SubBranchs[i], TPrimitivePropertyPredicate("step_tag", "true"), childs); {
TPrimitivePropertyPredicate pred("step_tag", "true");
filterPrimitiveChilds(_SubBranchs[i], pred, childs);
}
for (uint j = 0; j < childs.size(); ++j) for (uint j = 0; j < childs.size(); ++j)
vStepsToReturn.push_back(childs[j]); vStepsToReturn.push_back(childs[j]);
} }
@ -1008,7 +1046,10 @@ TPrimitiveSet CStepIf::getSubBranchs()
for (uint i = 0; i < _SubBranchs.size(); ++i) for (uint i = 0; i < _SubBranchs.size(); ++i)
{ {
TPrimitiveSet childs; TPrimitiveSet childs;
filterPrimitiveChilds(_SubBranchs[i], TPrimitivePropertyPredicate("step_tag", "true"), childs); {
TPrimitivePropertyPredicate pred("step_tag", "true");
filterPrimitiveChilds(_SubBranchs[i], pred, childs);
}
for (uint j = 0; j < childs.size(); ++j) for (uint j = 0; j < childs.size(); ++j)
vStepsToReturn.push_back(childs[j]); vStepsToReturn.push_back(childs[j]);
} }
@ -1055,7 +1096,10 @@ string CStepIf::genCode(CMissionData &md)
vector<IStep*> noSteps; vector<IStep*> noSteps;
// Get the 'yes branch' jump point // Get the 'yes branch' jump point
filterPrimitiveChilds(_SubBranchs[1], TPrimitivePropertyPredicate("step_tag", "true"), childs); {
TPrimitivePropertyPredicate pred("step_tag", "true");
filterPrimitiveChilds(_SubBranchs[1], pred, childs);
}
if (!childs.empty()) if (!childs.empty())
{ {
for (i = 0; i < _SubSteps.size(); ++i) for (i = 0; i < _SubSteps.size(); ++i)
@ -1071,7 +1115,10 @@ string CStepIf::genCode(CMissionData &md)
// Get the 'no branch' jump point // Get the 'no branch' jump point
childs.clear(); childs.clear();
filterPrimitiveChilds(_SubBranchs[0], TPrimitivePropertyPredicate("step_tag", "true"), childs); {
TPrimitivePropertyPredicate pred("step_tag", "true");
filterPrimitiveChilds(_SubBranchs[0], pred, childs);
}
if (!childs.empty()) if (!childs.empty())
{ {
for (i = 0; i < _SubSteps.size(); ++i) for (i = 0; i < _SubSteps.size(); ++i)