git had the makefile ignored and not im stranded. updated gitignoreand have a good starting point for the game server. working on moving it into the game

This commit is contained in:
2026-01-30 13:30:24 -06:00
parent d29e772272
commit 6856f6f2c8
9 changed files with 340 additions and 52 deletions

View File

@@ -9,7 +9,7 @@
#define PACKSZ 1024
enum pack_type{
G_STATE, HOSTS_REQ, NEW_HOST, JOIN_REQ
G_STATE, S_STATE, HOSTS_REQ, NEW_HOST, JOIN_REQ, U_NAME
};
typedef struct packet{
@@ -18,28 +18,28 @@ typedef struct packet{
} packet;
int read_to_buff(char *buff, char *src, Uint32 sz)
int read_to_buff(Uint32 *buff, Uint32 *src, Uint32 sz)
{
if(sz%32){
puts("error size must be div by 32");
return 0;
}
for(Uint32 i = 0; i < sz ; i += 4)
for(Uint32 i = 0; i < (sz >> 2); i += 1)
{
*((Uint32*)(buff + i)) = SDLNet_Read32((Uint32 *)(src + i));
*(buff + i) = SDLNet_Read32(src + i);
}
return 1;
}
int write_to_buff(char *buff, char *src, Uint32 sz)
int write_to_buff(Uint32 *buff, Uint32 *src, Uint32 sz)
{
if(sz%32){
puts("error size must be div by 32");
return 0;
}
for(Uint32 i = 0; i < sz; i += 4)
for(Uint32 i = 0; i < (sz >> 2); i += 1)
{
SDLNet_Write32(*((Uint32*)(src + i)), (Uint32*)(buff + i));
SDLNet_Write32(*(src + i), (buff + i));
}
return 1;
}