Cube  Diff

Differences From Artifact [4923c509fd]:

To Artifact [8a230870d2]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// client processing of the incoming network stream

#include "cube.h"

extern int clientnum;
extern bool c2sinit, senditemstoserver;
extern OFString *toservermap;
extern string clientpassword;

void
neterr(char *s)
{
	conoutf(@"illegal network message (%s)", s);
	disconnect();
}

void
changemapserv(char *name, int mode) // forced map change from the server
{
	gamemode = mode;










|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// client processing of the incoming network stream

#include "cube.h"

extern int clientnum;
extern bool c2sinit, senditemstoserver;
extern OFString *toservermap;
extern string clientpassword;

void
neterr(OFString *s)
{
	conoutf(@"illegal network message (%@)", s);
	disconnect();
}

void
changemapserv(char *name, int mode) // forced map change from the server
{
	gamemode = mode;
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
};

void
localservertoclient(
    uchar *buf, int len) // processes any updates from the server
{
	if (ENET_NET_TO_HOST_16(*(ushort *)buf) != len)
		neterr("packet length");
	incomingdemodata(buf, len);

	uchar *end = buf + len;
	uchar *p = buf + 2;
	char text[MAXTRANS];
	int cn = -1, type;
	dynent *d = NULL;







|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
};

void
localservertoclient(
    uchar *buf, int len) // processes any updates from the server
{
	if (ENET_NET_TO_HOST_16(*(ushort *)buf) != len)
		neterr(@"packet length");
	incomingdemodata(buf, len);

	uchar *end = buf + len;
	uchar *p = buf + 2;
	char text[MAXTRANS];
	int cn = -1, type;
	dynent *d = NULL;
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92
93
94
95
96
97

98
99
100
101
102
103
104
105
106
107
			int prot = getint(p);
			if (prot != PROTOCOL_VERSION) {
				conoutf(@"you are using a different game "
				        @"protocol (you: %d, server: %d)",
				    PROTOCOL_VERSION, prot);
				disconnect();
				return;
			};

			toservermap = @"";
			clientnum = cn; // we are now fully connected
			if (!getint(p))
				// we are the first client on this server, set
				// map
				toservermap = getclientmap();
			sgetstr();
			if (text[0] && strcmp(text, clientpassword)) {
				conoutf(@"you need to set the correct password "
				        @"to join this server!");
				disconnect();
				return;
			};

			if (getint(p) == 1) {
				conoutf(@"server is FULL, disconnecting..");
			};
			break;
		};

		case SV_POS: // position of another client
		{
			cn = getint(p);
			d = getclient(cn);







<
>












<
>
|

<







77
78
79
80
81
82
83

84
85
86
87
88
89
90
91
92
93
94
95
96

97
98
99

100
101
102
103
104
105
106
			int prot = getint(p);
			if (prot != PROTOCOL_VERSION) {
				conoutf(@"you are using a different game "
				        @"protocol (you: %d, server: %d)",
				    PROTOCOL_VERSION, prot);
				disconnect();
				return;

			}
			toservermap = @"";
			clientnum = cn; // we are now fully connected
			if (!getint(p))
				// we are the first client on this server, set
				// map
				toservermap = getclientmap();
			sgetstr();
			if (text[0] && strcmp(text, clientpassword)) {
				conoutf(@"you need to set the correct password "
				        @"to join this server!");
				disconnect();
				return;

			}
			if (getint(p) == 1)
				conoutf(@"server is FULL, disconnecting..");

			break;
		};

		case SV_POS: // position of another client
		{
			cn = getint(p);
			d = getclient(cn);
168
169
170
171
172
173
174
175
176

177
178
179

180
181
182
183
184
185

186
187
188
189
190
191
192
			break;
		}

		case SV_INITC2S: // another client either connected or changed
		                 // name/team
		{
			sgetstr();
			if (d->name[0]) // already connected
			{

				if (strcmp(d->name, text))
					conoutf(@"%s is now known as %s",
					    d->name, text);

			} else // new client
			{
				c2sinit =
				    false; // send new players my info again
				conoutf(@"connected: %s", text);
			};

			strcpy_s(d->name, text);
			sgetstr();
			strcpy_s(d->team, text);
			d->lifesequence = getint(p);
			break;
		}








|
<
>



>
|
<



<
>







167
168
169
170
171
172
173
174

175
176
177
178
179
180

181
182
183

184
185
186
187
188
189
190
191
			break;
		}

		case SV_INITC2S: // another client either connected or changed
		                 // name/team
		{
			sgetstr();
			if (d->name[0]) {

				// already connected
				if (strcmp(d->name, text))
					conoutf(@"%s is now known as %s",
					    d->name, text);
			} else {
				// new client

				c2sinit =
				    false; // send new players my info again
				conoutf(@"connected: %s", text);

			}
			strcpy_s(d->name, text);
			sgetstr();
			strcpy_s(d->team, text);
			d->lifesequence = getint(p);
			break;
		}

381
382
383
384
385
386
387
388
389
390
391
		{
			for (int n = getint(p); n; n--)
				getint(p);
			break;
		}

		default:
			neterr("type");
			return;
		}
}







|



380
381
382
383
384
385
386
387
388
389
390
		{
			for (int n = getint(p); n; n--)
				getint(p);
			break;
		}

		default:
			neterr(@"type");
			return;
		}
}