From 40b8b52252394deacabf3954c38fadddebb16017 Mon Sep 17 00:00:00 2001 From: Al Riddoch Date: Fri, 6 Jul 2007 16:36:12 +0000 Subject: [PATCH] 2007-07-06 Al Riddoch * server/EntityFactory.cpp: When processing a new task rule, check that the operation and tool classes referenced have been installed. If not, make the class pending on those classes. --- ChangeLog | 8 +++++++- TODO | 3 +++ server/EntityFactory.cpp | 17 +++++++++++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ccf92fcb6..763c2e05c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-07-06 Al Riddoch + + * server/EntityFactory.cpp: When processing a new task rule, check + that the operation and tool classes referenced have been installed. + If not, make the class pending on those classes. + 2007-07-06 Al Riddoch * rulesets/Thing.cpp: When moving, check if the entity has @@ -16584,4 +16590,4 @@ Sunday, October 28 2001, James Turner * Starting changelog from initial attempt to port cyphesis into C++. -$Id: ChangeLog,v 1.1862 2007-07-06 15:09:39 alriddoch Exp $ +$Id: ChangeLog,v 1.1863 2007-07-06 16:36:12 alriddoch Exp $ diff --git a/TODO b/TODO index d917006a3..9946f0b4d 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,6 @@ +When a task cannot be installed because of pre-reqs, record the error so +it can be reported. + Push to remove the world class, making it all more driven by data behavior. POS can't change in Dig and Delve, so make them irrelevant if its not the right diff --git a/server/EntityFactory.cpp b/server/EntityFactory.cpp index 677fa73b3..3288d5845 100644 --- a/server/EntityFactory.cpp +++ b/server/EntityFactory.cpp @@ -15,7 +15,7 @@ // along with this program; if not, write to the Free Software Foundation, // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -// $Id: EntityFactory.cpp,v 1.108 2007-07-05 17:51:41 alriddoch Exp $ +// $Id: EntityFactory.cpp,v 1.109 2007-07-06 16:36:12 alriddoch Exp $ #include @@ -384,11 +384,20 @@ int EntityFactory::installTaskClass(const std::string & className, J = activation.find("tool"); if (J != act_end && J->second.isString()) { const std::string & activation_tool = J->second.String(); + if (!i.hasClass(activation_tool)) { + // FIXME Record this error for reporting later. + delete factory; + m_waitingRules.insert(make_pair(activation_tool, make_pair(className, classDesc))); + return 1; + } J = activation.find("operation"); if (J != act_end && J->second.isString()) { const std::string & activation_op = J->second.String(); if (!i.hasClass(activation_op)) { - log(WARNING, String::compose("Activation op_definition \"%1\" does not exist for task class \"%2\".", activation_op, className).c_str()); + // FIXME Record this error for reporting later. + delete factory; + m_waitingRules.insert(make_pair(activation_op, make_pair(className, classDesc))); + return 1; } m_taskActivations[activation_tool].insert(std::make_pair(activation_op, factory)); } @@ -548,7 +557,7 @@ int EntityFactory::installRule(const std::string & className, const std::string & wClassName = I->second.first; const MapType & wClassDesc = I->second.second; debug(std::cout << "WAITING rule " << wClassName - << " now ready" << std::endl << std::flush;); + << " now ready from " << className << std::endl << std::flush;); installRule(wClassName, wClassDesc); } m_waitingRules.erase(className); @@ -709,7 +718,7 @@ void EntityFactory::installRules() RuleWaitList::const_iterator Jend = m_waitingRules.end(); for (; J != Jend; ++J) { const std::string & wParentName = J->first; - log(ERROR, String::compose("Rule \"%1\" with parent \"%2\" is an orphan", J->second.first, wParentName).c_str()); + log(ERROR, String::compose("Rule \"%1\" with parent \"%2\" is an orphan of %3", J->second.first, wParentName, J->first).c_str()); } }