1 //=============================================================================
2 //
3 // Adventure Game Studio (AGS)
4 //
5 // Copyright (C) 1999-2011 Chris Jones and 2011-20xx others
6 // The full list of copyright holders can be found in the Copyright.txt
7 // file, which is part of this source code distribution.
8 //
9 // The AGS source code is provided under the Artistic License 2.0.
10 // A copy of this license can be found in the file License.txt and at
11 // http://www.opensource.org/licenses/artistic-license-2.0.php
12 //
13 //=============================================================================
14 
15 #include "ac/movelist.h"
16 #include "util/stream.h"
17 
18 using AGS::Common::Stream;
19 
ReadFromFile(Stream * in)20 void MoveList::ReadFromFile(Stream *in)
21 {
22     in->ReadArrayOfInt32(pos, MAXNEEDSTAGES);
23     numstage = in->ReadInt32();
24     in->ReadArrayOfInt32(xpermove, MAXNEEDSTAGES);
25     in->ReadArrayOfInt32(ypermove, MAXNEEDSTAGES);
26     fromx = in->ReadInt32();
27     fromy = in->ReadInt32();
28     onstage = in->ReadInt32();
29     onpart = in->ReadInt32();
30     lastx = in->ReadInt32();
31     lasty = in->ReadInt32();
32     doneflag = in->ReadInt8();
33     direct = in->ReadInt8();
34 }
35 
WriteToFile(Stream * out)36 void MoveList::WriteToFile(Stream *out)
37 {
38     out->WriteArrayOfInt32(pos, MAXNEEDSTAGES);
39     out->WriteInt32(numstage);
40     out->WriteArrayOfInt32(xpermove, MAXNEEDSTAGES);
41     out->WriteArrayOfInt32(ypermove, MAXNEEDSTAGES);
42     out->WriteInt32(fromx);
43     out->WriteInt32(fromy);
44     out->WriteInt32(onstage);
45     out->WriteInt32(onpart);
46     out->WriteInt32(lastx);
47     out->WriteInt32(lasty);
48     out->WriteInt8(doneflag);
49     out->WriteInt8(direct);
50 }
51