figured out how to do smth

This commit is contained in:
2026-04-09 11:12:16 +02:00
parent 13efd53cea
commit 6244a2f7a4

View File

@@ -28,7 +28,7 @@ typedef struct net_RadioMessageData {
typedef struct net_NetworkLimits { typedef struct net_NetworkLimits {
// maximum radio lifespan in ticks // maximum radio lifespan in ticks
size_t maxRadioLifespan; size_t maxRadioLifespan;
// radio speed in coordinates per second // radio speed in coordinates per tick
double radioSpeed; double radioSpeed;
// maximum connections in a device // maximum connections in a device
size_t maxConnections; size_t maxConnections;
@@ -52,6 +52,15 @@ typedef struct net_DevicePosition {
double x, y, z; double x, y, z;
} net_DevicePosition; } net_DevicePosition;
typedef struct net_RadioPacket {
net_DevicePosition initialPosition;
size_t tickSpawned;
// the tick at which it is dead
size_t expirationTick;
char *data;
size_t datalen;
} net_Radiopacket;
typedef enum net_MessagePropagation { typedef enum net_MessagePropagation {
// direct connections // direct connections
NET_MESSAGE_DIRECT, NET_MESSAGE_DIRECT,
@@ -141,6 +150,17 @@ size_t net_countNetworkDevices(net_Network *network);
// If running stuff on multiple threads, MAKE SURE THE NETWORK IS LOCKED. THIS IS VERY IMPORTANT // If running stuff on multiple threads, MAKE SURE THE NETWORK IS LOCKED. THIS IS VERY IMPORTANT
void net_getNetworkDevices(net_Network *network, net_Device **devices); void net_getNetworkDevices(net_Network *network, net_Device **devices);
size_t net_getNetworkTickCount(net_Network *network);
// increase the tick count by 1
// this will also delete dead radio packets
void net_incNetworkTickCount(net_Network *network);
// set it to 0
void net_resetNetworkTickCount(net_Network *network);
void net_spawnRadioPacket(net_Network *network);
size_t net_countRadioPackets(net_Network *network);
void net_getRadioPackets(net_Network *network, net_RadioPacket *packets);
// network devices // network devices
// a simple non-rewriting relay, which does not contribute to the hop counter // a simple non-rewriting relay, which does not contribute to the hop counter