Line data Source code
1 : /* Copyright (C) 2025 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 504 : void operator()(ISerializer& serialize, const char* /*name*/, const Waypoint& value) 27 : { 28 504 : serialize.NumberFixed_Unbounded("waypoint x", value.x); 29 504 : serialize.NumberFixed_Unbounded("waypoint z", value.z); 30 : } 31 : 32 0 : void operator()(IDeserializer& deserialize, const char* /*name*/, Waypoint& value) 33 : { 34 0 : deserialize.NumberFixed_Unbounded("waypoint x", value.x); 35 0 : deserialize.NumberFixed_Unbounded("waypoint z", value.z); 36 : } 37 : }; 38 : 39 : template<> 40 : struct SerializeHelper<PathGoal> 41 : { 42 : template<typename S> 43 84 : void operator()(S& serialize, const char* /*name*/, Serialize::qualify<S, PathGoal> value) 44 : { 45 84 : Serializer(serialize, "type", value.type, PathGoal::INVERTED_SQUARE); 46 84 : serialize.NumberFixed_Unbounded("goal x", value.x); 47 84 : serialize.NumberFixed_Unbounded("goal z", value.z); 48 84 : serialize.NumberFixed_Unbounded("goal u x", value.u.X); 49 84 : serialize.NumberFixed_Unbounded("goal u z", value.u.Y); 50 84 : serialize.NumberFixed_Unbounded("goal v x", value.v.X); 51 84 : serialize.NumberFixed_Unbounded("goal v z", value.v.Y); 52 84 : serialize.NumberFixed_Unbounded("goal hw", value.hw); 53 84 : serialize.NumberFixed_Unbounded("goal hh", value.hh); 54 84 : serialize.NumberFixed_Unbounded("maxdist", value.maxdist); 55 84 : } 56 : }; 57 : 58 : #endif // INCLUDED_SERIALIZATION_PATHFINDER