File diff r8106:01dbd10fde05 → r8107:82461791b7a2
src/network/network_gui.cpp
Show inline comments
 
/* $Id$ */
 

	
 
#ifdef ENABLE_NETWORK
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "../string.h"
 
#include "../strings.h"
 
#include "../table/sprites.h"
 
#include "network.h"
 
#include "../date.h"
 

	
 
#include "../fios.h"
 
#include "table/strings.h"
 
#include "../functions.h"
 
#include "network_data.h"
 
#include "network_client.h"
 
#include "network_gui.h"
 
#include "network_gamelist.h"
 
#include "../gui.h"
 
#include "../window_gui.h"
 
#include "../textbuf_gui.h"
 
#include "../gfx.h"
 
#include "../command.h"
 
#include "../variables.h"
 
#include "network_server.h"
 
#include "network_udp.h"
 
#include "../settings.h"
 
#include "../string.h"
 
#include "../town.h"
 
#include "../newgrf.h"
 
#include "../helpers.hpp"
 

	
 
#define BGC 5
 
#define BTC 15
 

	
 
struct chatquerystr_d : public querystr_d {
 
	int dest;
 
};
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(chatquerystr_d));
 

	
 
struct network_d {
 
	PlayerID company;        // select company in network lobby
 
	byte field;              // select text-field in start-server and game-listing
 
	byte widget_id;          ///< The widget that has the pop-up input menu
 
	NetworkGameList *server; // selected server in lobby and game-listing
 
	FiosItem *map;           // selected map in start-server
 
};
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(network_d));
 

	
 
struct network_ql_d {
 
	network_d n;                 // see above; general stuff
 
	querystr_d q;                // text-input in start-server and game-listing
 
	NetworkGameList **sort_list; // list of games (sorted)
 
	list_d l;                    // accompanying list-administration
 
};
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(network_ql_d));
 

	
 
/* Global to remember sorting after window has been closed */
 
static Listing _ng_sorting;
 

	
 
static char _edit_str_buf[150];
 
static bool _chat_tab_completion_active;
 

	
 
static void ShowNetworkStartServerWindow();
 
static void ShowNetworkLobbyWindow(NetworkGameList *ngl);
 
extern void SwitchMode(int new_mode);
 

	
 
static const StringID _connection_types_dropdown[] = {
 
	STR_NETWORK_LAN_INTERNET,
 
	STR_NETWORK_INTERNET_ADVERTISE,
 
	INVALID_STRING_ID
 
};
 

	
 
static const StringID _lan_internet_types_dropdown[] = {
 
	STR_NETWORK_LAN,
 
	STR_NETWORK_INTERNET,
 
	INVALID_STRING_ID
 
};
 

	
 
static StringID _language_dropdown[NETLANG_COUNT + 1] = {STR_NULL};
 

	
 
void SortNetworkLanguages()
 
{
 
	/* Init the strings */
 
	if (_language_dropdown[0] == STR_NULL) {
 
		for (int i = 0; i < NETLANG_COUNT; i++) _language_dropdown[i] = STR_NETWORK_LANG_ANY + i;
 
		_language_dropdown[NETLANG_COUNT] = INVALID_STRING_ID;
 
	}