This system consists of 7 functions:
| | // Saves current version |
| | // End of a saving process |
| | // Save one value |
| | // Loads file version |
| | // End of a loading process |
| | // Compares the versions in file and code, then loads value |
| | // Skips one value in file |
Useage:
- Save
BeginSave(iVerCurrent);
Save(Value);
EndSave();
- Load
Initialize(Value);
BeginLoad(void);
Load(iVerSaved, Value);
EndLoad(void);
Use Case:
- Version 0
| Save | Load |
| BeginSave(0); | Initialize(a); |
- Version 1(Add a New Variable)
| Save | Load |
| BeginSave(1); | Initialize(a, b); |
| Comment | |
| Load(1, b); | The saving version of variable b is 1. When loading version 0 file, this call will do nothing. |
- Version 2(Add a New Variable)
| Save | Load |
| BeginSave(2); | Initialize(a, b, c); |
| Comment | |
| Load(2, c); | The saving version of variable b is 1. When loading version 0 file, this call will do nothing. |
- Version 3(Remove a variable)
| Save | Load |
| BeginSave(3); | Initialize(a, c); |
| Comment | |
| Skip(1, 2, b); |
|
- Version 4(Reuse a variable)
| Save | Load |
| BeginSave(4); | Initialize(a, b, c); |
請先 登入 以發表留言。