0:8dce9696d62d | 1:f0c61c204bc8 |
---|---|
46 #include "objwriter.h" | 46 #include "objwriter.h" |
47 | 47 |
48 #include "bots.h" | 48 #include "bots.h" |
49 | 49 |
50 ObjWriter::ObjWriter (str path) { | 50 ObjWriter::ObjWriter (str path) { |
51 numstates = 0; | |
52 | |
53 fp = fopen (path, "w"); | 51 fp = fopen (path, "w"); |
54 CHECK_FILE (path, "writing"); | 52 CHECK_FILE (fp, path, "writing"); |
55 } | 53 } |
56 | 54 |
57 ObjWriter::~ObjWriter () { | 55 ObjWriter::~ObjWriter () { |
58 fclose (fp); | 56 fclose (fp); |
59 } | 57 } |
68 } | 66 } |
69 | 67 |
70 void ObjWriter::WriteString (str s) { | 68 void ObjWriter::WriteString (str s) { |
71 WriteString (s.chars()); | 69 WriteString (s.chars()); |
72 } | 70 } |
73 | |
74 // Writes a state label | |
75 void ObjWriter::WriteState (str name) { | |
76 printf ("write state %s\n", (char*)name); | |
77 Write (DH_STATENAME); | |
78 Write (name.len()); | |
79 WriteString (name); | |
80 Write (DH_STATEIDX); | |
81 Write (numstates); | |
82 | |
83 numstates++; | |
84 } |