61 numWrittenReferences = 0; |
61 numWrittenReferences = 0; |
62 filepath = path; |
62 filepath = path; |
63 } |
63 } |
64 |
64 |
65 void ObjWriter::WriteString (char* s) { |
65 void ObjWriter::WriteString (char* s) { |
66 Write<long> (strlen (s)); |
66 Write (strlen (s)); |
67 for (unsigned int u = 0; u < strlen (s); u++) |
67 for (unsigned int u = 0; u < strlen (s); u++) |
68 Write<char> (s[u]); |
68 Write ((s)[u]); |
69 } |
69 } |
70 |
70 |
71 void ObjWriter::WriteString (const char* s) { |
71 void ObjWriter::WriteString (const char* s) { |
72 WriteString (const_cast<char*> (s)); |
72 WriteString (const_cast<char*> (s)); |
73 } |
73 } |
81 } |
81 } |
82 |
82 |
83 void ObjWriter::WriteBuffers () { |
83 void ObjWriter::WriteBuffers () { |
84 // If there was no mainloop defined, write a dummy one now. |
84 // If there was no mainloop defined, write a dummy one now. |
85 if (!g_GotMainLoop) { |
85 if (!g_GotMainLoop) { |
86 MainLoopBuffer->Write<long> (DH_MAINLOOP); |
86 MainLoopBuffer->Write (DH_MAINLOOP); |
87 MainLoopBuffer->Write<long> (DH_ENDMAINLOOP); |
87 MainLoopBuffer->Write (DH_ENDMAINLOOP); |
88 } |
88 } |
89 |
89 |
90 // Write the onenter and mainloop buffers, IN THAT ORDER |
90 // Write the onenter and mainloop buffers, IN THAT ORDER |
91 for (int i = 0; i < 2; i++) { |
91 for (int i = 0; i < 2; i++) { |
92 DataBuffer* buf = (!i) ? OnEnterBuffer : MainLoopBuffer; |
92 DataBuffer** buf = (!i) ? &OnEnterBuffer : &MainLoopBuffer; |
93 WriteBuffer (buf); |
93 WriteBuffer (*buf); |
94 |
94 |
95 // Clear the buffer afterwards for potential next state |
95 // Clear the buffer afterwards for potential next state |
96 buf = new DataBuffer; |
96 *buf = new DataBuffer; |
97 } |
97 } |
98 |
98 |
99 // Next state definitely has no mainloop yet |
99 // Next state definitely has no mainloop yet |
100 g_GotMainLoop = false; |
100 g_GotMainLoop = false; |
101 } |
101 } |