From 4fbd0644397f868fb7f94a86ec23fead33b5b34a Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Tue, 28 Mar 2023 00:54:47 +0200 Subject: [PATCH] constructor for Package class --- src/kernel/net/Package.hx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/kernel/net/Package.hx b/src/kernel/net/Package.hx index 665ae57..7d2dd33 100644 --- a/src/kernel/net/Package.hx +++ b/src/kernel/net/Package.hx @@ -1,5 +1,7 @@ package kernel.net; +import lib.Pos3; + typedef NetworkID = Int; enum PackageTypes { @@ -9,6 +11,8 @@ enum PackageTypes { RouteDiscover(reachableIDs: Array<{id:NetworkID,cost:Int}>); RouteDiscoverResponse(reachableIDs: Array<{id:NetworkID,cost:Int}>); RouteDiscoverUpdate(reachableIDs: Array<{id:NetworkID,cost:Int}>); + GPSResponse(pos:Pos3); + GPSRequest(); } /** @@ -22,6 +26,15 @@ enum PackageTypes { public final data:Dynamic; public var ttl: Int; + public function new(fromID:NetworkID, toID:NetworkID, msgID:Int, type:PackageTypes, data:Dynamic, ttl:Int) { + this.fromID = fromID; + this.toID = toID; + this.msgID = msgID; + this.type = type; + this.data = data; + this.ttl = ttl; + } + /** Create package that can be used as a response. **/