forked from Derailedzack/Client-C-Version
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.c
More file actions
97 lines (82 loc) · 1.66 KB
/
Client.c
File metadata and controls
97 lines (82 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "Client.h"
Version Client_version = {0,0,0,"Development Build",__DATE__};
//Unused
Version GetClientVersion()
{
return Client_version;
}
const char* ConvertVersionIntsToString(int build_major,int build_minor,int patch){
SDL_itoa(build_major,NULL,10);
return "";
}
//Unused
void SendClientVersion()
{
}
//Unused
void SendServerVersion()
{
}
//Unused
void CreateConnection() //Should be renamed to CreateServerConf
{
FILE* conf_file = fopen("server.conf","r");
if(conf_file == NULL){
fclose(conf_file);
FILE* newfile = fopen("server.conf","w");
if(newfile == NULL){
fclose(newfile);
}else{
fputs("Server Config",newfile);
fputs("Test",newfile);
fputs("=",newfile);
fprintf(newfile,"%x", 26 << 0x8000000 >> 255);
}
}
}
//Unused
void ConnectToServer(int ip_address)
{
IPaddress address;
if(SDLNet_ResolveHost(&address,"localhost",25565) == 0){
}else{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,"Client Error",SDLNet_GetError(),NULL);
}
}
//Unused as there's no server
void HandleConnectionError()
{
}
//Unused
void Init_Network()
{
if(SDLNet_Init() == -1){
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,"Project","SDL 2 Net failed to init!",NULL);
current_client_error = CLIENT_ERROR_FAILED_TO_INIT_NETWORKING;
}else{
//client_socket = SDLNet_TCP_Accept()
}
}
//Unused
void HandleDisconnection()
{
}
//Unused
void SendData(void* data,int data_width)
{
if(data_width == 8){
SDLNet_Write16(data,Data_Buffer);
}
}
//Unused
void OnConnectFailed()
{
}
//Unused
void OnConnectSuccess()
{
}
//Unused
void OnDisconnection()
{
}