|
9 | 9 | namespace NUIE |
10 | 10 | { |
11 | 11 |
|
12 | | -static const std::string NodeEditorFileMarker = "NodeEditorFile"; |
13 | | -static const int NodeEditorFileVersion = 1; |
| 12 | +static const std::string NodeEditorFileMarker = "NodeEditorFile"; |
14 | 13 |
|
15 | 14 | static bool GetBoundingRect (const NodeUIManager& uiManager, NodeUIDrawingEnvironment& env, Rect& boundingRect) |
16 | 15 | { |
@@ -232,25 +231,28 @@ bool NodeEditor::Open (const std::string& fileName, const ExternalHeaderIO* exte |
232 | 231 | bool NodeEditor::Open (NE::InputStream& inputStream, const ExternalHeaderIO* externalHeader) |
233 | 232 | { |
234 | 233 | if (externalHeader != nullptr) { |
235 | | - if (DBGERROR (!externalHeader->Read (inputStream))) { |
| 234 | + if (!externalHeader->Read (inputStream)) { |
236 | 235 | return false; |
237 | 236 | } |
238 | 237 | } |
239 | 238 |
|
240 | 239 | std::string fileMarker; |
241 | 240 | inputStream.Read (fileMarker); |
242 | | - if (DBGERROR (fileMarker != NodeEditorFileMarker)) { |
| 241 | + if (fileMarker != NodeEditorFileMarker) { |
243 | 242 | return false; |
244 | 243 | } |
245 | 244 |
|
246 | | - int fileVersion = 0; |
247 | | - inputStream.Read (fileVersion); |
248 | | - if (DBGERROR (fileVersion != NodeEditorFileVersion)) { |
| 245 | + int readFileVersion = 0; |
| 246 | + inputStream.Read (readFileVersion); |
| 247 | + if (readFileVersion > FileVersion) { |
249 | 248 | return false; |
250 | 249 | } |
251 | 250 |
|
252 | 251 | Version readVersion; |
253 | 252 | readVersion.Read (inputStream); |
| 253 | + if (readVersion > EngineVersion) { |
| 254 | + return false; |
| 255 | + } |
254 | 256 |
|
255 | 257 | if (DBGERROR (!uiManager.Open (inputStream))) { |
256 | 258 | return false; |
@@ -287,8 +289,8 @@ bool NodeEditor::Save (NE::OutputStream& outputStream, const ExternalHeaderIO* e |
287 | 289 | } |
288 | 290 |
|
289 | 291 | outputStream.Write (NodeEditorFileMarker); |
290 | | - outputStream.Write (NodeEditorFileVersion); |
291 | | - currentVersion.Write (outputStream); |
| 292 | + outputStream.Write (FileVersion); |
| 293 | + EngineVersion.Write (outputStream); |
292 | 294 | if (DBGERROR (!uiManager.Save (outputStream))) { |
293 | 295 | return false; |
294 | 296 | } |
|
0 commit comments