(svn r1510) -Add: Improved Network Lobby GUI: (bociusz)
authortruelight
Fri, 14 Jan 2005 21:47:35 +0000
changeset 1011 2587838541bf
parent 1010 17470a8e5eb7
child 1012 bdb66f548899
(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
network.h
network_client.c
network_data.h
network_gui.c
network_server.c
network_udp.c
--- a/network.h	Fri Jan 14 19:44:42 2005 +0000
+++ b/network.h	Fri Jan 14 21:47:35 2005 +0000
@@ -81,6 +81,7 @@
 	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, ..)
--- a/network_client.c	Fri Jan 14 19:44:42 2005 +0000
+++ b/network_client.c	Fri Jan 14 21:47:35 2005 +0000
@@ -301,6 +301,7 @@
 		_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++)
--- a/network_data.h	Fri Jan 14 19:44:42 2005 +0000
+++ b/network_data.h	Fri Jan 14 21:47:35 2005 +0000
@@ -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
 
--- a/network_gui.c	Fri Jan 14 19:44:42 2005 +0000
+++ b/network_gui.c	Fri Jan 14 21:47:35 2005 +0000
@@ -716,10 +716,18 @@
 		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;
--- a/network_server.c	Fri Jan 14 19:44:42 2005 +0000
+++ b/network_server.c	Fri Jan 14 21:47:35 2005 +0000
@@ -102,6 +102,13 @@
 		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]);
 
--- a/network_udp.c	Fri Jan 14 19:44:42 2005 +0000
+++ b/network_udp.c	Fri Jan 14 21:47:35 2005 +0000
@@ -169,6 +169,13 @@
 		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]);