Turned exception about unspecified requirements into a warning, now also for problems.

This commit is contained in:
Patrick Lühne 2016-08-18 14:30:47 +02:00
parent ca30f8a815
commit 31d0a1fb38
2 changed files with 5 additions and 3 deletions

View File

@ -33,7 +33,7 @@ class Problem
const Requirements &requirements() const;
bool hasRequirement(Requirement::Type requirementType) const;
void checkRequirement(Requirement::Type requirementType) const;
void checkRequirement(Requirement::Type requirementType);
expressions::Constants &objects();
const expressions::Constants &objects() const;

View File

@ -254,12 +254,14 @@ bool Problem::hasRequirement(Requirement::Type requirementType) const
////////////////////////////////////////////////////////////////////////////////////////////////////
void Problem::checkRequirement(Requirement::Type requirementType) const
void Problem::checkRequirement(Requirement::Type requirementType)
{
if (hasRequirement(requirementType))
return;
throw ConsistencyException("requirement “" + Requirement(requirementType).toPDDL() + "” used but never declared");
m_context.logger.logWarning(m_context.parser.coordinate(), "requirement “" + Requirement(requirementType).toPDDL() + "” used but never declared");
m_requirements.push_back(requirementType);
}
////////////////////////////////////////////////////////////////////////////////////////////////////