Moved code to determine if the records are fully specified into

FringeConfiguration- the parser now just reports the error but doesn't
know exactly what it did wrong.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1186 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2002-04-05 01:45:53 +00:00
parent d92f623f17
commit 5805f6bd5b
2 changed files with 20 additions and 9 deletions
@@ -1,5 +1,5 @@
// //
// $Id: FringeConfiguration.java,v 1.4 2002/04/05 01:35:11 ray Exp $ // $Id: FringeConfiguration.java,v 1.5 2002/04/05 01:45:53 ray Exp $
package com.threerings.miso.scene; package com.threerings.miso.scene;
@@ -36,6 +36,12 @@ public class FringeConfiguration implements Serializable
{ {
tilesets.add(record); tilesets.add(record);
} }
/** Did everything parse well? */
public boolean isValid ()
{
return ((base_tsid != 0) && (priority > 0));
}
} }
/** /**
@@ -48,6 +54,12 @@ public class FringeConfiguration implements Serializable
/** Is this a mask? */ /** Is this a mask? */
public boolean mask; public boolean mask;
/** Did everything parse well? */
public boolean isValid ()
{
return (fringe_tsid != 0);
}
} }
/** /**
@@ -1,5 +1,5 @@
// //
// $Id: FringeConfigurationParser.java,v 1.3 2002/04/05 01:35:11 ray Exp $ // $Id: FringeConfigurationParser.java,v 1.4 2002/04/05 01:45:53 ray Exp $
package com.threerings.miso.scene.tools.xml; package com.threerings.miso.scene.tools.xml;
@@ -74,14 +74,13 @@ public class FringeConfigurationParser extends CompiledConfigParser
new ValidatedSetNextRule(digest, "addFringeRecord", new ValidatedSetNextRule(digest, "addFringeRecord",
new ValidatedSetNextRule.Validator () { new ValidatedSetNextRule.Validator () {
public boolean isValid (Object target) { public boolean isValid (Object target) {
FringeRecord frec = (FringeRecord) target; if (((FringeRecord) target).isValid()) {
if ((frec.base_tsid == 0) || return true;
(frec.priority <= 0)) { } else {
Log.warning("A FringeRecord was not added " + Log.warning("A FringeRecord was not added " +
"because it was improperly specified."); "because it was improperly specified.");
return false; return false;
} }
return true;
} }
}) { }) {
@@ -123,13 +122,13 @@ public class FringeConfigurationParser extends CompiledConfigParser
digest.addRule(prefix, new ValidatedSetNextRule(digest, "addTileset", digest.addRule(prefix, new ValidatedSetNextRule(digest, "addTileset",
new ValidatedSetNextRule.Validator() { new ValidatedSetNextRule.Validator() {
public boolean isValid (Object target) { public boolean isValid (Object target) {
FringeTileSetRecord ftsr = (FringeTileSetRecord) target; if (((FringeTileSetRecord) target).isValid()) {
if (ftsr.fringe_tsid == 0) { return true;
} else {
Log.warning("A FringeTileSetRecord was not added " + Log.warning("A FringeTileSetRecord was not added " +
"because it was improperly specified."); "because it was improperly specified.");
return false; return false;
} }
return true;
} }
}) { }) {