mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r1510) -Add: Improved Network Lobby GUI: (bociusz)
- Added green dot if company income is positive (else red dot) - Added lock icon if company is password protected
This commit is contained in:
parent
3a838447a8
commit
e9a57c56b7
@ -81,6 +81,7 @@ typedef struct NetworkPlayerInfo {
|
||||
int64 money; // The amount of money the company has
|
||||
int64 income; // How much did the company earned last year
|
||||
uint16 performance; // What was his performance last month?
|
||||
byte use_password; // 0: No password 1: There is a password
|
||||
uint16 num_vehicle[NETWORK_VEHICLE_TYPES]; // How many vehicles are there of this type?
|
||||
uint16 num_station[NETWORK_STATION_TYPES]; // How many stations are there of this type?
|
||||
char players[NETWORK_PLAYERS_LENGTH]; // The players that control this company (Name1, name2, ..)
|
||||
|
@ -301,6 +301,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMPANY_INFO)
|
||||
_network_player_info[current].money = NetworkRecv_uint64(MY_CLIENT, p);
|
||||
_network_player_info[current].income = NetworkRecv_uint64(MY_CLIENT, p);
|
||||
_network_player_info[current].performance = NetworkRecv_uint16(MY_CLIENT, p);
|
||||
_network_player_info[current].use_password = NetworkRecv_uint8(MY_CLIENT, p);
|
||||
for (i = 0; i < NETWORK_VEHICLE_TYPES; i++)
|
||||
_network_player_info[current].num_vehicle[i] = NetworkRecv_uint16(MY_CLIENT, p);
|
||||
for (i = 0; i < NETWORK_STATION_TYPES; i++)
|
||||
|
@ -17,7 +17,7 @@
|
||||
// What version of game-info do we use?
|
||||
#define NETWORK_GAME_INFO_VERSION 1
|
||||
// What version of company info is this?
|
||||
#define NETWORK_COMPANY_INFO_VERSION 1
|
||||
#define NETWORK_COMPANY_INFO_VERSION 2
|
||||
// What version of master-server-protocol do we use?
|
||||
#define NETWORK_MASTER_SERVER_VERSION 1
|
||||
|
||||
|
@ -716,10 +716,18 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e)
|
||||
pos = w->vscroll.pos;
|
||||
while (pos < _network_lobby_company_count) {
|
||||
byte index = NetworkLobbyFindCompanyIndex(pos);
|
||||
bool income = false;
|
||||
if (_selected_company_item == index)
|
||||
GfxFillRect(11, y - 1, 139, y + 10, 155); // show highlighted item with a different colour
|
||||
|
||||
DoDrawString(_network_player_info[index].company_name, 13, y, 2);
|
||||
if(_network_player_info[index].use_password != 0)
|
||||
DrawSprite(SPR_LOCK, 120, y);
|
||||
|
||||
/* If the company's income was positive puts a green dot else a red dot */
|
||||
if ((_network_player_info[index].income) > 0)
|
||||
income = true;
|
||||
DrawSprite(SPR_BLOT | (income?0x30d8000:0x30b8000), 130, y);
|
||||
|
||||
pos++;
|
||||
y += NET_PRC__SIZE_OF_ROW_COMPANY;
|
||||
|
@ -102,6 +102,13 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_COMPANY_INFO)
|
||||
NetworkSend_uint64(p, _network_player_info[player->index].income);
|
||||
NetworkSend_uint16(p, _network_player_info[player->index].performance);
|
||||
|
||||
/* Send 1 if there is a passord for the company else send 0 */
|
||||
if (_network_player_info[player->index].password[0] != '\0') {
|
||||
NetworkSend_uint8 (p, 1);
|
||||
} else {
|
||||
NetworkSend_uint8 (p, 0);
|
||||
}
|
||||
|
||||
for (i = 0; i < NETWORK_VEHICLE_TYPES; i++)
|
||||
NetworkSend_uint16(p, _network_player_info[player->index].num_vehicle[i]);
|
||||
|
||||
|
@ -169,6 +169,13 @@ DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_DETAIL_INFO)
|
||||
NetworkSend_uint64(packet, _network_player_info[player->index].income);
|
||||
NetworkSend_uint16(packet, _network_player_info[player->index].performance);
|
||||
|
||||
/* Send 1 if there is a passord for the company else send 0 */
|
||||
if (_network_player_info[player->index].password[0] != '\0') {
|
||||
NetworkSend_uint8 (p, 1);
|
||||
} else {
|
||||
NetworkSend_uint8 (p, 0);
|
||||
}
|
||||
|
||||
for (i = 0; i < NETWORK_VEHICLE_TYPES; i++)
|
||||
NetworkSend_uint16(packet, _network_player_info[player->index].num_vehicle[i]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user