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:
14
net/net.h
14
net/net.h
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user