Cube  Diff

Differences From Artifact [74876b82b8]:

To Artifact [733d35b36f]:


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
108
109
110
111
112
113
114
115
116
117
{
	fprintf(f, "name \"%s\"\nteam \"%s\"\n", player1->name, player1->team);
}

void
connects(OFString *servername)
{
	@autoreleasepool {
		disconnect(1); // reset state
		addserver(servername);

		conoutf(@"attempting to connect to %s", servername.UTF8String);
		ENetAddress address = {ENET_HOST_ANY, CUBE_SERVER_PORT};

		if (enet_address_set_host(&address, servername.UTF8String) <
		    0) {
			conoutf(@"could not resolve server %s", servername);
			return;
		}


		clienthost = enet_host_create(NULL, 1, rate, rate);

		if (clienthost) {
			enet_host_connect(clienthost, &address, 1);
			enet_host_flush(clienthost);
			connecting = lastmillis;
			connattempts = 0;
		} else {
			conoutf(@"could not connect to server");
			disconnect();
		}
	}
}

void
disconnect(int onlyclean, int async)
{
	if (clienthost) {







<
|
|

|
|
>


|


|
>
|

|
|
|
|
|
|
|
|
<







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
108
109
110

111
112
113
114
115
116
117
{
	fprintf(f, "name \"%s\"\nteam \"%s\"\n", player1->name, player1->team);
}

void
connects(OFString *servername)
{

	disconnect(1); // reset state
	addserver(servername);

	conoutf(@"attempting to connect to %@", servername);
	ENetAddress address = {ENET_HOST_ANY, CUBE_SERVER_PORT};
	@autoreleasepool {
		if (enet_address_set_host(&address, servername.UTF8String) <
		    0) {
			conoutf(@"could not resolve server %@", servername);
			return;
		}
	}

	clienthost = enet_host_create(NULL, 1, rate, rate);

	if (clienthost) {
		enet_host_connect(clienthost, &address, 1);
		enet_host_flush(clienthost);
		connecting = lastmillis;
		connattempts = 0;
	} else {
		conoutf(@"could not connect to server");
		disconnect();

	}
}

void
disconnect(int onlyclean, int async)
{
	if (clienthost) {