From a0baf54839a58ed785f2fa21e2cc8f05e1520f8d Mon Sep 17 00:00:00 2001 From: sfb Date: Sun, 29 May 2011 14:08:46 -0500 Subject: [PATCH] Changed: Applied patch fixing the mission_compiler_lib build under Linux --- code/ryzom/tools/leveldesign/CMakeLists.txt | 6 +- .../mission_compiler_lib/mission_compiler.cpp | 27 +++++-- .../mission_compiler_lib/steps.cpp | 77 +++++++++++++++---- 3 files changed, 86 insertions(+), 24 deletions(-) diff --git a/code/ryzom/tools/leveldesign/CMakeLists.txt b/code/ryzom/tools/leveldesign/CMakeLists.txt index be22df62c..c490de731 100644 --- a/code/ryzom/tools/leveldesign/CMakeLists.txt +++ b/code/ryzom/tools/leveldesign/CMakeLists.txt @@ -10,11 +10,11 @@ ADD_SUBDIRECTORY(named_items_2_csv) IF(WIN32) ADD_SUBDIRECTORY(export) ADD_SUBDIRECTORY(world_editor) + IF(WITH_MFC) + ADD_SUBDIRECTORY(mission_compiler_fe) + ENDIF(WITH_MFC) ENDIF(WIN32) -IF(WITH_MFC) - ADD_SUBDIRECTORY(mission_compiler_fe) -ENDIF(WITH_MFC) IF(WITH_QT) ADD_SUBDIRECTORY(georges_editor_qt) diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp index bc3b21cb8..814239949 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp @@ -17,6 +17,7 @@ #include "mission_compiler.h" #include "step.h" #include "nel/misc/i18n.h" +#include "nel/ligo/primitive_utils.h" using namespace std; using namespace NLMISC; @@ -526,7 +527,12 @@ bool CMissionCompiler::compileMission(NLLIGO::IPrimitive *rootPrim, const std::s } // first, start by reading mission variables - IPrimitive *variables = getPrimitiveChild(mission, TPrimitiveClassPredicate("variables")); + IPrimitive *variables; + { + TPrimitiveClassPredicate predTmp("variables"); + variables= NLLIGO::getPrimitiveChild(mission, predTmp); + } + if (!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) md.initHeaderPhrase(rootPrim); - IPrimitive *preReq = getPrimitiveChild(mission, TPrimitiveClassPredicate("pre_requisite")); + IPrimitive *preReq; + { + TPrimitiveClassPredicate predTmp("pre_requisite"); + preReq = getPrimitiveChild(mission, predTmp); + } + if (!preReq) { nlwarning("Can't find pre requisite !"); @@ -598,7 +609,8 @@ bool CMissionCompiler::compileMissions(IPrimitive *rootPrim, const std::string & CPrimitiveSet 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()); @@ -667,7 +679,8 @@ bool CMissionCompiler::installCompiledMission(NLLIGO::CLigoConfig &ligoConfig, c TPrimitiveSet scripts; CPrimitiveSet 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 // of the source primitive file. @@ -732,7 +745,8 @@ bool CMissionCompiler::installCompiledMission(NLLIGO::CLigoConfig &ligoConfig, c TPrimitiveSet bots; CPrimitiveSet 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()) { @@ -961,7 +975,8 @@ bool CMissionCompiler::parseOneStep(CMissionData &md, IPrimitive *stepToParse, I bool CMissionCompiler::parseSteps(CMissionData &md, IPrimitive *steps, IStep *parent) { TPrimitiveSet childs; - filterPrimitiveChilds(steps, TPrimitivePropertyPredicate("step_tag", "true"), childs); + TPrimitivePropertyPredicate pred("step_tag", "true"); + filterPrimitiveChilds(steps, pred, childs); if (childs.empty()) { diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp index 10842c97c..44e6e96cc 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp @@ -55,7 +55,11 @@ IStep::IStep(CMissionData &md, NLLIGO::IPrimitive *prim) // parse the sub prim to create action & objectives; IPrimitive *child; // parse the preactions - child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("actions", "pre_actions")); + { + TPrimitiveClassAndNamePredicate pred("actions", "pre_actions"); + child = getPrimitiveChild(prim, pred); + } + if (child) { for (uint i=0; igetNumChildren(); ++i) @@ -72,7 +76,10 @@ IStep::IStep(CMissionData &md, NLLIGO::IPrimitive *prim) } } // parse the objectives - child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("mission_objectives", "objectives")); + { + TPrimitiveClassAndNamePredicate pred("mission_objectives", "objectives"); + child = getPrimitiveChild(prim, pred); + } if (child) { for (uint i=0; igetNumChildren(); ++i) @@ -89,7 +96,10 @@ IStep::IStep(CMissionData &md, NLLIGO::IPrimitive *prim) } } // parse the post actions - child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("actions", "post_actions")); + { + TPrimitiveClassAndNamePredicate pred("actions", "post_actions"); + child = getPrimitiveChild(prim, pred); + } if (child) { for (uint i=0; igetNumChildren(); ++i) @@ -447,7 +457,10 @@ public: // parse the sub prim to create action & objectives; IPrimitive *child; // parse the pre-actions - child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("actions", "actions")); + { + TPrimitiveClassAndNamePredicate pred("actions", "actions"); + child = getPrimitiveChild(prim, pred); + } if (child) { for (uint i=0; igetNumChildren(); ++i) @@ -464,7 +477,10 @@ public: } } // look for an optional jump - child = getPrimitiveChild(prim, TPrimitiveClassPredicate("jump_to")); + { + TPrimitiveClassPredicate pred("jump_to"); + child = getPrimitiveChild(prim, pred); + } if (child) { // ok, we have a jump at end of fail step @@ -515,7 +531,10 @@ public: // parse the sub prim to create action & objectives; IPrimitive *child; // parse the pre-actions - child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("actions", "actions")); + { + TPrimitiveClassAndNamePredicate pred("actions", "actions"); + child = getPrimitiveChild(prim, pred); + } if (child) { for (uint i=0; igetNumChildren(); ++i) @@ -546,7 +565,10 @@ public: } // look for an optional jump - child = getPrimitiveChild(prim, TPrimitiveClassPredicate("jump_to")); + { + TPrimitiveClassPredicate pred("jump_to"); + child = getPrimitiveChild(prim, pred); + } if (child) { // ok, we have a jump at end of fail step @@ -607,14 +629,20 @@ CStepPlayerReconnect::CStepPlayerReconnect(CMissionData &md, IPrimitive *prim) : IPrimitive *child; TPrimitiveSet resp; - filterPrimitiveChilds(prim, TPrimitivePropertyPredicate("step_tag", "true"), resp); + { + TPrimitivePropertyPredicate pred("step_tag", "true"); + filterPrimitiveChilds(prim, pred, resp); + } for (uint i=0; i noSteps; // 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()) { for (i = 0; i < _SubSteps.size(); ++i) @@ -1071,7 +1115,10 @@ string CStepIf::genCode(CMissionData &md) // Get the 'no branch' jump point childs.clear(); - filterPrimitiveChilds(_SubBranchs[0], TPrimitivePropertyPredicate("step_tag", "true"), childs); + { + TPrimitivePropertyPredicate pred("step_tag", "true"); + filterPrimitiveChilds(_SubBranchs[0], pred, childs); + } if (!childs.empty()) { for (i = 0; i < _SubSteps.size(); ++i)