created additional structures + handled being hit

This commit is contained in:
Michal Starski 2018-11-20 15:02:47 +01:00
parent 34938eed49
commit 45618e6934
1 changed files with 17 additions and 2 deletions

View File

@ -19,7 +19,22 @@ typedef struct
float x; float x;
float y; float y;
float z; float z;
} TPosition;
typedef struct
{
float x;
float y;
float z;
float w;
} TRotation;
typedef struct
{
TPosition position;
TRotation rotation;
char shoot; char shoot;
char hit;
} TFloat; } TFloat;
void Error(int err); void Error(int err);
@ -164,9 +179,9 @@ void *dataProcessHandler(void *data)
while (1) while (1)
{ {
if (recvfrom(info->socket, &floats, 13, 0, (struct sockaddr *)&tmp, &addrLen) != 13) if (recvfrom(info->socket, &floats, 30, 0, (struct sockaddr *)&tmp, &addrLen) != 30)
continue; continue;
sendto(info->socket, &floats, 13, 0, (struct sockaddr *)&info->address, sizeof(info->address)); sendto(info->socket, &floats, 30, 0, (struct sockaddr *)&info->address, sizeof(info->address));
} }
return NULL; return NULL;
} }