Line data Source code
1 : /* Copyright (C) 2020 Wildfire Games.
2 : * This file is part of 0 A.D.
3 : *
4 : * 0 A.D. is free software: you can redistribute it and/or modify
5 : * it under the terms of the GNU General Public License as published by
6 : * the Free Software Foundation, either version 2 of the License, or
7 : * (at your option) any later version.
8 : *
9 : * 0 A.D. is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : * GNU General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU General Public License
15 : * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 : */
17 :
18 : #ifndef INCLUDED_SERIALIZATION_PATHFINDER
19 : #define INCLUDED_SERIALIZATION_PATHFINDER
20 :
21 : #include "simulation2/serialization/SerializeTemplates.h"
22 :
23 : template<>
24 : struct SerializeHelper<Waypoint>
25 : {
26 0 : void operator()(ISerializer& serialize, const char* UNUSED(name), const Waypoint& value)
27 : {
28 0 : serialize.NumberFixed_Unbounded("waypoint x", value.x);
29 0 : serialize.NumberFixed_Unbounded("waypoint z", value.z);
30 0 : }
31 :
32 0 : void operator()(IDeserializer& deserialize, const char* UNUSED(name), Waypoint& value)
33 : {
34 0 : deserialize.NumberFixed_Unbounded("waypoint x", value.x);
35 0 : deserialize.NumberFixed_Unbounded("waypoint z", value.z);
36 0 : }
37 : };
38 :
39 : template<>
40 : struct SerializeHelper<PathGoal>
41 : {
42 : template<typename S>
43 0 : void operator()(S& serialize, const char* UNUSED(name), Serialize::qualify<S, PathGoal> value)
44 : {
45 0 : Serializer(serialize, "type", value.type, PathGoal::INVERTED_SQUARE);
46 0 : serialize.NumberFixed_Unbounded("goal x", value.x);
47 0 : serialize.NumberFixed_Unbounded("goal z", value.z);
48 0 : serialize.NumberFixed_Unbounded("goal u x", value.u.X);
49 0 : serialize.NumberFixed_Unbounded("goal u z", value.u.Y);
50 0 : serialize.NumberFixed_Unbounded("goal v x", value.v.X);
51 0 : serialize.NumberFixed_Unbounded("goal v z", value.v.Y);
52 0 : serialize.NumberFixed_Unbounded("goal hw", value.hw);
53 0 : serialize.NumberFixed_Unbounded("goal hh", value.hh);
54 0 : serialize.NumberFixed_Unbounded("maxdist", value.maxdist);
55 0 : }
56 : };
57 :
58 : #endif // INCLUDED_SERIALIZATION_PATHFINDER
|