Cube  Diff

Differences From Artifact [1f60f5711b]:

To Artifact [3d0c884313]:


175
176
177
178
179
180
181
182

183
184
185
186
187
188
189
190
191
192
193

194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210

211
212
213
214
175
176
177
178
179
180
181

182
183
184
185
186
187
188
189
190
191
192

193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209

210
211
212
213
214







-
+










-
+
















-
+




	    NULL, MAXTRANS + mapsize, ENET_PACKET_FLAG_RELIABLE);
	uchar *start = packet->data;
	uchar *p = start + 2;
	putint(p, SV_SENDMAP);
	sendstring(mapname, p);
	putint(p, mapsize);
	if (65535 - (p - start) < mapsize) {
		conoutf("map %s is too large to send", mapname);
		conoutf(@"map %s is too large to send", mapname);
		free(mapdata);
		enet_packet_destroy(packet);
		return;
	};
	memcpy(p, mapdata, mapsize);
	p += mapsize;
	free(mapdata);
	*(ushort *)start = ENET_HOST_TO_NET_16(p - start);
	enet_packet_resize(packet, p - start);
	sendpackettoserv(packet);
	conoutf("sending map %s to server...", mapname);
	conoutf(@"sending map %s to server...", mapname);
	sprintf_sd(msg)(
	    "[map %s uploaded to server, \"getmap\" to receive it]", mapname);
	toserver(msg);
}

void
getmap()
{
	ENetPacket *packet =
	    enet_packet_create(NULL, MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
	uchar *start = packet->data;
	uchar *p = start + 2;
	putint(p, SV_RECVMAP);
	*(ushort *)start = ENET_HOST_TO_NET_16(p - start);
	enet_packet_resize(packet, p - start);
	sendpackettoserv(packet);
	conoutf("requesting map from server...");
	conoutf(@"requesting map from server...");
}

COMMAND(sendmap, ARG_1STR);
COMMAND(getmap, ARG_NONE);