|
@@ -68,24 +68,26 @@ static void NetworkTruncateString(char *
|
|
|
}
|
|
|
}
|
|
|
|
|
|
extern const char _openttd_revision[];
|
|
|
|
|
|
static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
|
|
|
{
|
|
|
switch(e->event) {
|
|
|
case WE_PAINT: {
|
|
|
if (_selected_item == NULL)
|
|
|
w->disabled_state = (1<<17) | (1<<18);
|
|
|
else if (!_selected_item->online)
|
|
|
w->disabled_state = (1<<17); // Server offline, join button disabled
|
|
|
else if (_selected_item->info.clients_on == _selected_item->info.clients_max)
|
|
|
w->disabled_state = (1<<17); // Server full, join button disabled
|
|
|
#ifdef WITH_REV
|
|
|
else if (strncmp(_selected_item->info.server_revision, _openttd_revision, NETWORK_REVISION_LENGTH - 1) != 0) {
|
|
|
if (strncmp(_selected_item->info.server_revision, "norev000", sizeof(_selected_item->info.server_revision)) != 0)
|
|
|
w->disabled_state = (1<<17); // Revision mismatch, join button disabled
|
|
|
w->disabled_state = 0;
|
|
|
|
|
|
if (_selected_item == NULL) {
|
|
|
SETBIT(w->disabled_state, 17); SETBIT(w->disabled_state, 18);
|
|
|
} else if (!_selected_item->online) {
|
|
|
SETBIT(w->disabled_state, 17); // Server offline, join button disabled
|
|
|
} else if (_selected_item->info.clients_on == _selected_item->info.clients_max) {
|
|
|
SETBIT(w->disabled_state, 17); // Server full, join button disabled
|
|
|
|
|
|
// revisions don't match, check if server has no revision; then allow connection
|
|
|
} else if (strncmp(_selected_item->info.server_revision, _openttd_revision, NETWORK_REVISION_LENGTH - 1) != 0) {
|
|
|
if (strncmp(_selected_item->info.server_revision, NOREV_STRING, sizeof(_selected_item->info.server_revision)) != 0)
|
|
|
SETBIT(w->disabled_state, 17); // Revision mismatch, join button disabled
|
|
|
}
|
|
|
#endif
|
|
|
else
|
|
|
w->disabled_state = 0;
|
|
|
|
|
|
SetDParam(0, 0x00);
|
|
|
SetDParam(2, STR_NETWORK_LAN + _network_connection);
|
|
@@ -105,12 +107,8 @@ static void NetworkGameWindowWndProc(Win
|
|
|
char servername[NETWORK_NAME_LENGTH];
|
|
|
const NetworkGameList *cur_item = _network_game_list;
|
|
|
while (cur_item != NULL) {
|
|
|
#ifdef WITH_REV
|
|
|
bool compatible = (strncmp(cur_item->info.server_revision, _openttd_revision, NETWORK_REVISION_LENGTH - 1) == 0);
|
|
|
#else
|
|
|
bool compatible = true; // We have no idea if we are compatible...
|
|
|
#endif
|
|
|
if (strncmp(cur_item->info.server_revision, "norev000", sizeof(cur_item->info.server_revision)) == 0)
|
|
|
if (strncmp(cur_item->info.server_revision, NOREV_STRING, sizeof(cur_item->info.server_revision)) == 0)
|
|
|
compatible = true;
|
|
|
|
|
|
if (cur_item == _selected_item)
|
|
@@ -200,17 +198,15 @@ static void NetworkGameWindowWndProc(Win
|
|
|
|
|
|
y+=2;
|
|
|
|
|
|
#ifdef WITH_REV
|
|
|
if (strncmp(_selected_item->info.server_revision, _openttd_revision, NETWORK_REVISION_LENGTH - 1) != 0) {
|
|
|
if (strncmp(_selected_item->info.server_revision, "norev000", sizeof(_selected_item->info.server_revision)) != 0)
|
|
|
if (strncmp(_selected_item->info.server_revision, NOREV_STRING, sizeof(_selected_item->info.server_revision)) != 0)
|
|
|
DrawStringMultiCenter(360, y, STR_NETWORK_VERSION_MISMATCH, 2); // server mismatch
|
|
|
} else
|
|
|
#endif
|
|
|
if (_selected_item->info.clients_on == _selected_item->info.clients_max)
|
|
|
} else if (_selected_item->info.clients_on == _selected_item->info.clients_max) {
|
|
|
// Show: server full, when clients_on == clients_max
|
|
|
DrawStringMultiCenter(360, y, STR_NETWORK_SERVER_FULL, 2); // server full
|
|
|
else if (_selected_item->info.use_password)
|
|
|
} else if (_selected_item->info.use_password)
|
|
|
DrawStringMultiCenter(360, y, STR_NETWORK_PASSWORD, 2); // password warning
|
|
|
|
|
|
y+=10;
|
|
|
}
|
|
|
} break;
|