diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-03-04 19:22:09 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-03-04 19:22:09 -0800 |
commit | a70ce311134a98add10a2f7d4fe4919c3d64439b (patch) | |
tree | 4e1a47ed4ccad2881a489d6671f2d57ba2df5d8a /043space.cc | |
parent | 078f48f5e0749c94ad17465111b1f76eae41190a (diff) | |
download | mu-a70ce311134a98add10a2f7d4fe4919c3d64439b.tar.gz |
2728 - don't ignore /space: while checking types
Diffstat (limited to '043space.cc')
-rw-r--r-- | 043space.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/043space.cc b/043space.cc index 9ca747b7..31a4173d 100644 --- a/043space.cc +++ b/043space.cc @@ -285,3 +285,18 @@ bool contains_non_special_name(const recipe_ordinal r) { } return false; } + +// reagent comparison -- only between reagents in a single recipe +bool operator==(const reagent& a, const reagent& b) { + if (a.name != b.name) return false; + if (property(a, "space") != property(b, "space")) return false; + return true; +} + +bool operator<(const reagent& a, const reagent& b) { + long long int aspace = 0, bspace = 0; + if (has_property(a, "space")) aspace = to_integer(property(a, "space")->value); + if (has_property(b, "space")) bspace = to_integer(property(b, "space")->value); + if (aspace != bspace) return aspace < bspace; + return a.name < b.name; +} |