summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--network.h1
-rw-r--r--network_client.c1
-rw-r--r--network_data.h2
-rw-r--r--network_gui.c8
-rw-r--r--network_server.c7
-rw-r--r--network_udp.c7
6 files changed, 25 insertions, 1 deletions
diff --git a/network.h b/network.h
index e104d55bd..c03aedcca 100644
--- a/network.h
+++ b/network.h
@@ -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, ..)
diff --git a/network_client.c b/network_client.c
index 5b4c0f1e4..613cf8549 100644
--- a/network_client.c
+++ b/network_client.c
@@ -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++)
diff --git a/network_data.h b/network_data.h
index 13da75823..b01115041 100644
--- a/network_data.h
+++ b/network_data.h
@@ -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
diff --git a/network_gui.c b/network_gui.c
index d59917f5c..774f15316 100644
--- a/network_gui.c
+++ b/network_gui.c
@@ -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;
diff --git a/network_server.c b/network_server.c
index dfa9b0e9d..106cc6a29 100644
--- a/network_server.c
+++ b/network_server.c
@@ -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]);
diff --git a/network_udp.c b/network_udp.c
index 0d62dec3a..2505ab01e 100644
--- a/network_udp.c
+++ b/network_udp.c
@@ -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]);