protected override void Save(StackWriter writer, Map map) { foreach (var route in map.Routes) { writer.PushItem(route.Id); writer.PushItem(route.Destinations.Count); foreach (var destination in route.Destinations) { var action = route.GetAction(destination); writer.PushItems(destination.Pos, action.Type, action.Item); } foreach (var node in route.Path) { writer.PushItem(node.Pos); } writer.WriteStack(); } }