constructor for Package class

This commit is contained in:
Djeeberjr 2023-03-28 00:54:47 +02:00
parent f7c320c123
commit 4fbd064439

View File

@ -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.
**/