Cube  Diff

Differences From Artifact [e92e9ee6ab]:

To Artifact [0783f692c0]:


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
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






-
+







-
+






-
-
+
+

-
+

-
+
-
+







// client processing of the incoming network stream

#include "cube.h"

extern int clientnum;
extern bool c2sinit, senditemstoserver;
extern string toservermap;
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;
	load_world(name);
};

}

void
changemap(char *name) // request map change, server may ignore
changemap(OFString *name) // request map change, server may ignore
{
	strcpy_s(toservermap, name);
	toservermap = name;
};
}

// update the position of other clients in the game in our world
// don't care if he's in the scenery or other players,
// just don't overlap with our client

void
updatepos(dynent *d)
78
79
80
81
82
83
84
85

86
87
88
89
90



91
92
93
94
95
96
97
78
79
80
81
82
83
84

85
86
87



88
89
90
91
92
93
94
95
96
97







-
+


-
-
-
+
+
+







			if (prot != PROTOCOL_VERSION) {
				conoutf(@"you are using a different game "
				        @"protocol (you: %d, server: %d)",
				    PROTOCOL_VERSION, prot);
				disconnect();
				return;
			};
			toservermap[0] = 0;
			toservermap = @"";
			clientnum = cn; // we are now fully connected
			if (!getint(p))
				strcpy_s(toservermap,
				    getclientmap()); // we are the first client
				                     // on this server, set map
				// 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;
			};
156
157
158
159
160
161
162

163
164


165
166

167
168
169
170
171
172
173
156
157
158
159
160
161
162
163


164
165
166

167
168
169
170
171
172
173
174







+
-
-
+
+

-
+







					setspawn(n, true);
			break;
		}

		case SV_MAPRELOAD: // server requests next map
		{
			getint(p);
			OFString *nextmapalias = [OFString
			sprintf_sd(nextmapalias)("nextmap_%s", getclientmap());
			char *map =
			    stringWithFormat:@"nextmap_%@", getclientmap()];
			OFString *map =
			    getalias(nextmapalias); // look up map in the cycle
			changemap(map ? map : getclientmap());
			changemap(map != nil ? map : getclientmap());
			break;
		}

		case SV_INITC2S: // another client either connected or changed
		                 // name/team
		{
			sgetstr();