CHANGED: #1471 Some more cleanup in CInterfaceParser, removed some unused code, which also means less coupling and less refactoring to do :P

This commit is contained in:
dfighter1985 2012-07-07 21:17:15 +02:00
parent 28288d2543
commit 5ffd1d3067
2 changed files with 0 additions and 204 deletions

View file

@ -654,19 +654,6 @@ bool CInterfaceParser::parseXMLDocument(xmlNodePtr root, bool reload)
// todo hulud interface syntax error
nlwarning ("could not parse 'scene3d'");
}
// Special BrickViewer
else if ( !strcmp((char*)root->name,"brick_career_generator") )
{
if (!parseBrickCareerGenerator(root))
// todo hulud interface syntax error
nlwarning ("could not parse 'brick_career_generator'");
}
else if ( !strcmp((char*)root->name,"brick_suffix_generator") )
{
if (!parseBrickSuffixGenerator(root))
// todo hulud interface syntax error
nlwarning ("could not parse 'brick_suffix_generator'");
}
else if ( !strcmp((char*)root->name,"ddx") )
{
if (!parseDDX(root,rootGroup))
@ -3198,179 +3185,6 @@ bool CInterfaceParser::getProcedureAction(const std::string &procName, uint acti
return false;
}
// ***************************************************************************
bool CInterfaceParser::parseGeneratorRootContainer(xmlNodePtr cur, xmlNodePtr &rootTreeNode)
{
CXMLAutoPtr prop;
// root_container
string rootContainer;
prop = xmlGetProp (cur, (xmlChar*)"root_container");
if(prop) rootContainer= (const char*)prop;
else
{
// todo hulud interface syntax error
nlwarning("prop 'root_container' not found");
return false;
}
// search root container option
bool rootContainerSearch= false;
prop = xmlGetProp (cur, (xmlChar*)"root_container_search");
if(prop) rootContainerSearch= CInterfaceElement::convertBool((const char*)prop);
// **** In all case, create or find the root_container
// if don't search but create the root container...
if(!rootContainerSearch)
{
rootTreeNode= xmlNewNode(cur->ns, (xmlChar*)"tree" );
xmlSetProp(rootTreeNode, (xmlChar*)"node", (xmlChar*)rootContainer.c_str());
// add it next to us now.
xmlAddNextSibling (cur, rootTreeNode);
}
else
{
rootTreeNode= NULL;
// search from the cur place ALL the tree node that match rootContainer.
xmlNodePtr curSearch= cur;
curSearch= curSearch->next;
while(curSearch)
{
// if the node is a tree node.
if ( !strcmp((char*)curSearch->name,"tree") )
{
// Test if him or one of his son match the name.
xmlNodePtr candidate= searchTreeNodeInHierarchy(curSearch, rootContainer.c_str());
// found? stop!
if(candidate)
{
rootTreeNode= candidate;
break;
}
}
curSearch= curSearch->next;
}
// not found? abort
if(!rootTreeNode)
{
// todo hulud interface syntax error
nlwarning("career*_generator: thee root container '%s' was not found", rootContainer.c_str());
return false;
}
}
return true;
}
// ***************************************************************************
bool CInterfaceParser::parseCareerGeneratorParams(xmlNodePtr cur,
string &templateCareer,
string &templateJob,
string &careerWindow,
string &jobWindow,
xmlNodePtr &rootTreeNode,
bool &brickTypeFilter,
BRICK_TYPE::EBrickType &brickType
)
{
CXMLAutoPtr prop;
// **** Parse the generator properties
// template_career
prop = xmlGetProp (cur, (xmlChar*)"template_career");
if(prop) templateCareer= (const char*)prop;
else
{
// todo hulud interface syntax error
nlwarning("prop 'template_career' not found");
return false;
}
// template_job
prop = xmlGetProp (cur, (xmlChar*)"template_job");
if(prop) templateJob= (const char*)prop;
else
{
// todo hulud interface syntax error
nlwarning("prop 'template_job' not found");
return false;
}
// career_window
prop = xmlGetProp (cur, (xmlChar*)"career_window");
if(prop) careerWindow= (const char*)prop;
else
{
// todo hulud interface syntax error
nlwarning("prop 'career_window' not found");
return false;
}
// job_window
prop = xmlGetProp (cur, (xmlChar*)"job_window");
if(prop) jobWindow= (const char*)prop;
else
{
// todo hulud interface syntax error
nlwarning("prop 'job_window' not found");
return false;
}
// get brick type
prop = xmlGetProp (cur, (xmlChar*)"brick_type");
if(prop)
{
if( !strcmp(prop, "none") )
{
brickTypeFilter= false;
}
else
{
brickTypeFilter= true;
brickType= BRICK_TYPE::toBrickType((const char*)prop);
if(brickType == BRICK_TYPE::UNKNOWN)
{
// todo hulud interface syntax error
nlwarning("'brick_type' UKNOWN");
return false;
}
}
}
else
{
// todo hulud interface syntax error
nlwarning("prop 'brick_type' not found");
return false;
}
// create or search the root container.
if(!parseGeneratorRootContainer(cur, rootTreeNode))
return false;
return true;
}
// ***************************************************************************
bool CInterfaceParser::parseBrickCareerGenerator(xmlNodePtr /* cur */)
{
return false;
}
// ***************************************************************************
bool CInterfaceParser::parseBrickSuffixGenerator(xmlNodePtr /* cur */)
{
return false;
}
// ***************************************************************************
bool CInterfaceParser::parseStyle(xmlNodePtr cur)
{

View file

@ -24,7 +24,6 @@
#include "nel/gui/ctrl_sheet_selection.h"
#include "nel/gui/interface_link.h"
#include "nel/misc/smart_ptr.h"
#include "game_share/brick_types.h"
#include "nel/gui/lua_helper.h"
#include "nel/gui/widget_manager.h"
@ -93,8 +92,6 @@ public:
bool parseKey(xmlNodePtr cur);
bool parseMacro(xmlNodePtr cur);
bool parseCommand(xmlNodePtr cur);
bool parseBrickCareerGenerator(xmlNodePtr cur);
bool parseBrickSuffixGenerator(xmlNodePtr cur);
bool parseStyle(xmlNodePtr cur);
bool parseDDX (xmlNodePtr cur, CInterfaceGroup * parentGroup);
bool parseLUAScript (xmlNodePtr cur);
@ -307,21 +304,6 @@ protected:
typedef std::map<std::string, CStyle> TStyleMap;
TStyleMap _StyleMap;
protected:
bool parseCareerGeneratorParams(xmlNodePtr cur,
std::string &templateCareer,
std::string &templateJob,
std::string &careerWindow,
std::string &jobWindow,
xmlNodePtr &rootTreeNode,
bool &brickTypeFilter,
BRICK_TYPE::EBrickType &brickType
);
bool parseGeneratorRootContainer(xmlNodePtr cur, xmlNodePtr &rootTreeNode);
protected:
// LUA
// ----------------------------------------------------------------------------------