Changeset - r773:522f1f87e9c6
[Not reviewed]
master
0 24 0
darkvater - 19 years ago 2004-12-22 23:24:53
darkvater@openttd.org
(svn r1239) -Feature: Added gui option of setting company password. It can be found in the 'company information' window
-Spiced up 'set company_pw' a bit, where if no pw is typed, it shows the current one.
-Added a space between company name and player; looks better
24 files changed with 99 insertions and 56 deletions:
0 comments (0 inline, 0 general)
console_cmds.c
Show inline comments
 
@@ -682,17 +682,11 @@ DEF_CONSOLE_CMD(ConSet) {
 
			return NULL;
 
		}
 
		if (argc == 3) {
 
			if (strncmp(argv[2], "*", NETWORK_PASSWORD_LENGTH) == 0) {
 
				_network_player_info[_local_player].password[0] = '\0';
 
			} else {
 
				ttd_strlcpy(_network_player_info[_local_player].password, argv[2], sizeof(_network_player_info[_local_player].password));
 
			}
 
			if (!_network_server)
 
				SEND_COMMAND(PACKET_CLIENT_SET_PASSWORD)(_network_player_info[_local_player].password);
 
			IConsolePrintF(_iconsole_color_warning, "Company protected with '%s'", _network_player_info[_local_player].password);
 
			NetworkChangeCompanyPassword(argv[2]);
 
		} else {
 
			IConsolePrint(_iconsole_color_default, "'set company_pw' sets a password on your company, so no-one without the correct password can join.");
 
			IConsolePrint(_iconsole_color_default, "'set company_pw' sets a password for your company, so no-one without the correct password can join.");
 
			IConsolePrint(_iconsole_color_warning, "Usage: set company_pw \"<password>\".   Use * as <password> to set no password.");
 
			IConsolePrintF(_iconsole_color_warning, "Current password is: '%s'", _network_player_info[_local_player].password);
 
		}
 
		return NULL;
 
	}
lang/american.txt
Show inline comments
 
@@ -1954,7 +1954,7 @@ STR_683B_HOSTILE						:Hostile
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Player {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}New Face
 
STR_7005_COLOR_SCHEME						:{BLACK}Color Scheme
lang/catalan.txt
Show inline comments
 
@@ -1944,7 +1944,7 @@ STR_683B_HOSTILE						:Hostil
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Jugador {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Nova Cara
 
STR_7005_COLOR_SCHEME						:{BLACK}Esquema de Colors
lang/czech.txt
Show inline comments
 
@@ -1954,7 +1954,7 @@ STR_683B_HOSTILE						:zaujatý
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(hrac {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Nový oblicej
 
STR_7005_COLOR_SCHEME						:{BLACK}Barva
lang/danish.txt
Show inline comments
 
@@ -1803,7 +1803,7 @@ STR_683B_HOSTILE						:Fjendtlig
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Spiller {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Nyt Ansigt
 
STR_7005_COLOR_SCHEME						:{BLACK}Farvetema
lang/dutch.txt
Show inline comments
 
@@ -1944,7 +1944,7 @@ STR_683B_HOSTILE						:Negatief
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Speler {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Nieuw gezicht
 
STR_7005_COLOR_SCHEME						:{BLACK}Kleurenschema
lang/english.txt
Show inline comments
 
@@ -1954,7 +1954,7 @@ STR_683B_HOSTILE						:Hostile
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Player {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}New Face
 
STR_7005_COLOR_SCHEME						:{BLACK}Colour Scheme
 
@@ -2071,6 +2071,9 @@ STR_RELOCATE_COMPANY_HEADQUARTERS				:{B
 
STR_7071_CAN_T_BUILD_COMPANY_HEADQUARTERS			:{WHITE}Can't build company headquarters...
 
STR_7072_VIEW_HQ						:{BLACK}View HQ
 
STR_RELOCATE_HQ							:{BLACK}Relocate HQ
 
STR_COMPANY_PASSWORD          :{BLACK}Password
 
STR_COMPANY_PASSWORD_TOOLTIP  :{BLACK}Password-protect your company to prevent unauthorised users from joining. Use '*' to empty password.
 
STR_SET_COMPANY_PASSWORD      :Set company password
 
STR_7073_WORLD_RECESSION_FINANCIAL				:{BIGFONT}{BLACK}World Recession!{}{}Financial experts fear worst as economy slumps!
 
STR_7074_RECESSION_OVER_UPTURN_IN				:{BIGFONT}{BLACK}Recession Over!{}{}Upturn in trade gives confidence to industries as economy strengthens!
 
STR_7075_TOGGLE_LARGE_SMALL_WINDOW				:{BLACK}Toggle large/small window size
lang/finnish.txt
Show inline comments
 
@@ -1936,7 +1936,7 @@ STR_683B_HOSTILE						:Vihamielinen
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Pelaaja {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Uudet kasvot
 
STR_7005_COLOR_SCHEME						:{BLACK}Väriteema
lang/french.txt
Show inline comments
 
@@ -1954,7 +1954,7 @@ STR_683B_HOSTILE						:Hostile
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Joueur {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Nouveau visage
 
STR_7005_COLOR_SCHEME						:{BLACK}Couleur
lang/galician.txt
Show inline comments
 
@@ -1881,7 +1881,7 @@ STR_683B_HOSTILE						:Hostil
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Xogador {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Nova Cara
 
STR_7005_COLOR_SCHEME						:{BLACK}Esquema de Cor
lang/german.txt
Show inline comments
 
@@ -1954,7 +1954,7 @@ STR_683B_HOSTILE						:Feindlich
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Spieler {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Neues Gesicht
 
STR_7005_COLOR_SCHEME						:{BLACK}Farbauswahl
lang/hungarian.txt
Show inline comments
 
@@ -1954,7 +1954,7 @@ STR_683B_HOSTILE						:Ellenséges
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:({COMMA16}. játékos)
 
STR_7004_NEW_FACE						:{BLACK}Új arc
 
STR_7005_COLOR_SCHEME						:{BLACK}Szín váltása
lang/italian.txt
Show inline comments
 
@@ -1803,7 +1803,7 @@ STR_683B_HOSTILE						:Ostile
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Giocatore {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Nuova Faccia
 
STR_7005_COLOR_SCHEME						:{BLACK}Colore Società
lang/norwegian.txt
Show inline comments
 
@@ -1922,7 +1922,7 @@ STR_683B_HOSTILE						:Fientlig
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Spiller {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Nytt ansikt
 
STR_7005_COLOR_SCHEME						:{BLACK}Firmafarge
lang/polish.txt
Show inline comments
 
@@ -1939,7 +1939,7 @@ STR_683B_HOSTILE						:Wrogie
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Gracz {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}nowa twarz
 
STR_7005_COLOR_SCHEME						:{BLACK}Schemat koloru
lang/portuguese.txt
Show inline comments
 
@@ -1863,7 +1863,7 @@ STR_683B_HOSTILE						:Hostil
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Jogador {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Nova Cara
 
STR_7005_COLOR_SCHEME						:{BLACK}Cores
lang/romanian.txt
Show inline comments
 
@@ -1944,7 +1944,7 @@ STR_683B_HOSTILE						:ostilã
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Jucãtorul {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Schimbã foto
 
STR_7005_COLOR_SCHEME						:{BLACK}Culoare
lang/slovak.txt
Show inline comments
 
@@ -1909,7 +1909,7 @@ STR_683B_HOSTILE						:Nepriatelsky
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Hrac {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Nova tvar
 
STR_7005_COLOR_SCHEME						:{BLACK}Farebna schema
lang/spanish.txt
Show inline comments
 
@@ -1942,7 +1942,7 @@ STR_683B_HOSTILE						:Hostil
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Jugador {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Nueva Cara
 
STR_7005_COLOR_SCHEME						:{BLACK}Esquema Color
lang/swedish.txt
Show inline comments
 
@@ -1942,7 +1942,7 @@ STR_683B_HOSTILE						:Fientlig
 

	
 
##id 0x7000
 
STR_7000							:
 
STR_7001							:{WHITE}{STRING}{BLACK}{STRING}
 
STR_7001							:{WHITE}{STRING} {BLACK}{STRING}
 
STR_7002_PLAYER							:(Spelare {COMMA16})
 
STR_7004_NEW_FACE						:{BLACK}Nytt ansikte
 
STR_7005_COLOR_SCHEME						:{BLACK}Färgval
network.c
Show inline comments
 
@@ -1360,6 +1360,20 @@ void NetworkShutDown(void)
 
	#endif
 
}
 

	
 
void NetworkChangeCompanyPassword(const char *str)
 
{
 
	if (strncmp(str, "*", sizeof(_network_player_info[_local_player].password)) == 0) {
 
		_network_player_info[_local_player].password[0] = '\0';
 
		IConsolePrint(_iconsole_color_warning, "Company password protection removed.");
 
	} else {
 
		ttd_strlcpy(_network_player_info[_local_player].password, str, sizeof(_network_player_info[_local_player].password));
 
		IConsolePrintF(_iconsole_color_warning, "Company protected with password '%s'.", _network_player_info[_local_player].password);
 
	}
 

	
 
	if (!_network_server)
 
		SEND_COMMAND(PACKET_CLIENT_SET_PASSWORD)(_network_player_info[_local_player].password);
 
}
 

	
 
#else
 

	
 
void ParseConnectionString(const byte **player, const byte **port, byte *connection_string) {}
network.h
Show inline comments
 
@@ -200,5 +200,6 @@ void NetworkUpdateClientInfo(uint16 clie
 
void NetworkAddServer(const byte *b);
 
void NetworkRebuildHostList();
 
NetworkGameList *NetworkQueryServer(const byte* host, unsigned short port, bool game_info);
 
void NetworkChangeCompanyPassword(const char *str);
 

	
 
#endif /* NETWORK_H */
network_core.h
Show inline comments
 
@@ -13,7 +13,7 @@
 
#	include <winsock2.h>
 
#	include <ws2tcpip.h>
 
#	pragma comment (lib, "ws2_32.lib")
 
#	define ENABLE_NETWORK // On windows, the network is always enabled
 
//#	define ENABLE_NETWORK // On windows, the network is always enabled
 
#	define GET_LAST_ERROR() WSAGetLastError()
 
#	define EWOULDBLOCK WSAEWOULDBLOCK
 
// Windows has some different names for some types..
player_gui.c
Show inline comments
 
@@ -9,6 +9,12 @@
 
#include "command.h"
 
#include "vehicle.h"
 
#include "economy.h"
 
#include "network.h"
 

	
 
#ifdef ENABLE_NETWORK
 
#include "network_data.h"
 
#include "network_client.h"
 
#endif
 

	
 
static void DoShowPlayerFinances(int player, bool small);
 

	
 
@@ -349,14 +355,16 @@ static const WindowDesc _select_player_f
 
};
 

	
 
static const Widget _my_player_company_widgets[] = {
 
{    WWT_TEXTBTN,    14,     0,    10,     0,    13, STR_00C5,								STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,    14,    11,   359,     0,    13, STR_7001,								STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{     WWT_IMGBTN,    14,     0,   359,    14,   157, 0x0,											STR_NULL},
 
{ WWT_PUSHTXTBTN,    14,     0,    89,   158,   169, STR_7004_NEW_FACE,				STR_7030_SELECT_NEW_FACE_FOR_PRESIDENT},
 
{ WWT_PUSHTXTBTN,    14,    90,   179,   158,   169, STR_7005_COLOR_SCHEME,		STR_7031_CHANGE_THE_COMPANY_VEHICLE},
 
{ WWT_PUSHTXTBTN,    14,   180,   269,   158,   169, STR_7009_PRESIDENT_NAME,	STR_7032_CHANGE_THE_PRESIDENT_S},
 
{ WWT_PUSHTXTBTN,    14,   270,   359,   158,   169, STR_7008_COMPANY_NAME,		STR_7033_CHANGE_THE_COMPANY_NAME},
 
{ WWT_PUSHTXTBTN,    14,   266,   355,    18,    29, STR_706F_BUILD_HQ,				STR_7070_BUILD_COMPANY_HEADQUARTERS},
 
{    WWT_TEXTBTN,    14,     0,    10,     0,    13, STR_00C5,                STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,    14,    11,   359,     0,    13, STR_7001,                STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{     WWT_IMGBTN,    14,     0,   359,    14,   157, 0x0,                     STR_NULL},
 
{ WWT_PUSHTXTBTN,    14,     0,    89,   158,   169, STR_7004_NEW_FACE,       STR_7030_SELECT_NEW_FACE_FOR_PRESIDENT},
 
{ WWT_PUSHTXTBTN,    14,    90,   179,   158,   169, STR_7005_COLOR_SCHEME,   STR_7031_CHANGE_THE_COMPANY_VEHICLE},
 
{ WWT_PUSHTXTBTN,    14,   180,   269,   158,   169, STR_7009_PRESIDENT_NAME, STR_7032_CHANGE_THE_PRESIDENT_S},
 
{ WWT_PUSHTXTBTN,    14,   270,   359,   158,   169, STR_7008_COMPANY_NAME,   STR_7033_CHANGE_THE_COMPANY_NAME},
 
{ WWT_PUSHTXTBTN,    14,   266,   355,    18,    29, STR_706F_BUILD_HQ,       STR_7070_BUILD_COMPANY_HEADQUARTERS},
 
{      WWT_EMPTY,    14,   266,   355,    32,    43, 0x0,                     STR_NULL},
 
{ WWT_PUSHTXTBTN,    14,   266,   355,   138,   149, STR_COMPANY_PASSWORD,    STR_COMPANY_PASSWORD_TOOLTIP},
 
{   WIDGETS_END},
 
};
 

	
 
@@ -376,15 +384,16 @@ static const Widget _other_player_compan
 
};
 

	
 
static const Widget _my_player_company_bh_widgets[] = {
 
{    WWT_TEXTBTN,    14,     0,    10,     0,    13, STR_00C5,					STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,    14,    11,   359,     0,    13, STR_7001,					STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{     WWT_IMGBTN,    14,     0,   359,    14,   157, 0x0,								STR_NULL},
 
{ WWT_PUSHTXTBTN,    14,     0,    89,   158,   169, STR_7004_NEW_FACE, STR_7030_SELECT_NEW_FACE_FOR_PRESIDENT},
 
{ WWT_PUSHTXTBTN,    14,    90,   179,   158,   169, STR_7005_COLOR_SCHEME,		STR_7031_CHANGE_THE_COMPANY_VEHICLE},
 
{ WWT_PUSHTXTBTN,    14,   180,   269,   158,   169, STR_7009_PRESIDENT_NAME,	STR_7032_CHANGE_THE_PRESIDENT_S},
 
{ WWT_PUSHTXTBTN,    14,   270,   359,   158,   169, STR_7008_COMPANY_NAME,		STR_7033_CHANGE_THE_COMPANY_NAME},
 
{ WWT_PUSHTXTBTN,    14,   266,   355,    18,    29, STR_7072_VIEW_HQ,	STR_7070_BUILD_COMPANY_HEADQUARTERS},
 
{ WWT_PUSHTXTBTN,    14,   266,   355,    32,    43, STR_RELOCATE_HQ,		STR_RELOCATE_COMPANY_HEADQUARTERS},
 
{    WWT_TEXTBTN,    14,     0,    10,     0,    13, STR_00C5,                STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,    14,    11,   359,     0,    13, STR_7001,                STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{     WWT_IMGBTN,    14,     0,   359,    14,   157, 0x0,                     STR_NULL},
 
{ WWT_PUSHTXTBTN,    14,     0,    89,   158,   169, STR_7004_NEW_FACE,       STR_7030_SELECT_NEW_FACE_FOR_PRESIDENT},
 
{ WWT_PUSHTXTBTN,    14,    90,   179,   158,   169, STR_7005_COLOR_SCHEME,   STR_7031_CHANGE_THE_COMPANY_VEHICLE},
 
{ WWT_PUSHTXTBTN,    14,   180,   269,   158,   169, STR_7009_PRESIDENT_NAME, STR_7032_CHANGE_THE_PRESIDENT_S},
 
{ WWT_PUSHTXTBTN,    14,   270,   359,   158,   169, STR_7008_COMPANY_NAME,   STR_7033_CHANGE_THE_COMPANY_NAME},
 
{ WWT_PUSHTXTBTN,    14,   266,   355,    18,    29, STR_7072_VIEW_HQ,        STR_7070_BUILD_COMPANY_HEADQUARTERS},
 
{ WWT_PUSHTXTBTN,    14,   266,   355,    32,    43, STR_RELOCATE_HQ,         STR_RELOCATE_COMPANY_HEADQUARTERS},
 
{ WWT_PUSHTXTBTN,    14,   266,   355,   138,   149, STR_COMPANY_PASSWORD,    STR_COMPANY_PASSWORD_TOOLTIP},
 
{   WIDGETS_END},
 
};
 

	
 
@@ -481,8 +490,10 @@ static void PlayerCompanyWndProc(Window 
 
		Player *p = DEREF_PLAYER(w->window_number);
 
		uint32 dis;
 

	
 
		if (w->widget != _other_player_company_widgets)
 
					w->widget = (p->location_of_house != 0) ? _my_player_company_bh_widgets : _my_player_company_widgets;
 
		if (w->widget != _other_player_company_widgets) {
 
			w->widget = (p->location_of_house != 0) ? _my_player_company_bh_widgets : _my_player_company_widgets;
 
			if (!_networking) w->hidden_state |= (1 << 9); // hide company-password widget
 
		}
 

	
 
		SetDParam(0, p->name_1);
 
		SetDParam(1, p->name_2);
 
@@ -569,9 +580,19 @@ static void PlayerCompanyWndProc(Window 
 
			SetObjectToPlaceWnd(0x2D0, 1, w);
 
			SetTileSelectSize(2, 2);
 
			break;
 
		case 9: /* buy 25% */
 
			DoCommandP(0, w->window_number, 0, NULL, CMD_BUY_SHARE_IN_COMPANY | CMD_MSG(STR_707B_CAN_T_BUY_25_SHARE_IN_THIS));
 
			break;
 
		case 9: {/* buy 25% or password protect your company */
 
			#ifdef ENABLE_NETWORK
 
			if (w->widget != _other_player_company_widgets) {
 
				StringID str;
 
				WP(w,def_d).byte_1 = 2;
 
				str = AllocateName(_network_player_info[_local_player].password, 0);
 
				ShowQueryString(str, STR_SET_COMPANY_PASSWORD, sizeof(_network_player_info[_local_player].password), 250, w->window_class, w->window_number);
 
				DeleteName(str);
 
			} else
 
			#endif
 
				DoCommandP(0, w->window_number, 0, NULL, CMD_BUY_SHARE_IN_COMPANY | CMD_MSG(STR_707B_CAN_T_BUY_25_SHARE_IN_THIS));
 

	
 
		} break;
 

	
 
		case 10: /* sell 25% */
 
			DoCommandP(0, w->window_number, 0, NULL, CMD_SELL_SHARE_IN_COMPANY | CMD_MSG(STR_707C_CAN_T_SELL_25_SHARE_IN));
 
@@ -600,14 +621,24 @@ static void PlayerCompanyWndProc(Window 
 
		break;
 

	
 
	case WE_ON_EDIT_TEXT: {
 
		byte *b = e->edittext.str;
 
		if (*b == 0)
 
		char *b = (char*)e->edittext.str;
 

	
 
		if (*b == 0 && WP(w,def_d).byte_1 != 2) // empty string is allowed for password
 
			return;
 

	
 
		memcpy(_decode_parameters, b, 32);
 
		if (WP(w,def_d).byte_1) {
 
		switch (WP(w,def_d).byte_1) {
 
		case 0: /* Change president name */
 
			DoCommandP(0, w->window_number, 0, NULL, CMD_CHANGE_PRESIDENT_NAME | CMD_MSG(STR_700D_CAN_T_CHANGE_PRESIDENT));
 
			break;
 
		case 1: /* Change company name */
 
			DoCommandP(0, w->window_number, 0, NULL, CMD_CHANGE_COMPANY_NAME | CMD_MSG(STR_700C_CAN_T_CHANGE_COMPANY_NAME));
 
		} else {
 
			DoCommandP(0, w->window_number, 0, NULL, CMD_CHANGE_PRESIDENT_NAME | CMD_MSG(STR_700D_CAN_T_CHANGE_PRESIDENT));
 
			break;
 
		#ifdef ENABLE_NETWORK
 
		case 2: /* Change company password */
 
			if (*b == 0) *b = '*'; // empty password is a '*' because of console argument
 
			NetworkChangeCompanyPassword(b);
 
		#endif
 
		}
 
	} break;
 

	
0 comments (0 inline, 0 general)