Store talk node type in scenario file as enumerator instead of numer

- Also, don't write empty CDATA sections when dialogue name/look/job sections are completely empty.
This commit is contained in:
2015-07-05 23:30:43 -04:00
parent 6cc9e81a7b
commit 7b76d37237
7 changed files with 32 additions and 11 deletions

View File

@@ -596,3 +596,23 @@ std::istream& operator>> (std::istream& in, eLighting& light) {
in.setstate(std::ios::failbit);
return in;
}
// MARK: eTalkNode
cEnumLookup talk_nodes = {
"reg","if-sdf","set-sdf","inn","if-time","if-event","if-town","shop","train","jobs",
"","","","sell-weap","sell-prot","sell-any","id","ench","buy-info","buy-sdf",
"buy-ship","buy-horse","buy-spec-item","quest","buy-town","end-force","end-fight","end-alarm","end-die","call-local",
"call-global",
};
std::ostream& operator<< (std::ostream& out, eTalkNode node) {
writeEnum(out, node, talk_nodes, "reg");
return out;
}
std::istream& operator>> (std::istream& in, eTalkNode& node) {
if(!readEnum(in, node, talk_nodes, eTalkNode::REGULAR))
in.setstate(std::ios::failbit);
return in;
}

View File

@@ -54,4 +54,7 @@ public:
void writeTo(std::ostream& file) const;
};
std::ostream& operator<< (std::ostream& out, eTalkNode node);
std::istream& operator>> (std::istream& in, eTalkNode& node);
#endif