Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Core/GameEngine/Include/Common/GameDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@
#define ENABLE_GUI_HACKS (1)
#endif

// Tell our computer identity in the LAN lobby. Disable for privacy.
// Was enabled in the retail game and exposed the computer login and host names.
#ifdef RTS_DEBUG
#ifndef TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY
#define TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY (1)
#endif
#endif

#define MIN_DISPLAY_BIT_DEPTH 16
#define DEFAULT_DISPLAY_BIT_DEPTH 32
#define DEFAULT_DISPLAY_WIDTH 800 // The standard resolution this game was designed for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ extern const Color acceptFalseColor;

void lanUpdateSlotList( void );
void updateGameOptions( void );

void setLANPlayerTooltip(LANPlayer* player);

//Enum is used for the utility function so other windows do not need
//to know about controls on LanGameOptions window.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,8 @@ static void playerTooltip(GameWindow *window,
TheMouse->setCursorTooltip( UnicodeString::TheEmptyString );
return;
}
UnicodeString tooltip;
tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str());
#if defined(RTS_DEBUG)
UnicodeString ip;
ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP()));
tooltip.concat(ip);
#endif

TheMouse->setCursorTooltip( tooltip );
setLANPlayerTooltip(player);
}

void StartPressed(void)
Expand Down Expand Up @@ -903,6 +896,29 @@ void updateGameOptions( void )
}


//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
void setLANPlayerTooltip(LANPlayer* player)
{
UnicodeString tooltip;

if (!player->getLogin().isEmpty() || !player->getHost().isEmpty())
{
tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str());
}

#if defined(RTS_DEBUG)
UnicodeString ip;
ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP()));
tooltip.concat(ip);
#endif

if (!tooltip.isEmpty())
{
TheMouse->setCursorTooltip( tooltip );
}
}


//-------------------------------------------------------------------------------------------------
/** This is called when a shutdown is complete for this menu */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,8 @@ static void playerTooltip(GameWindow *window,
//TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:LobbyPlayers") );
return;
}
UnicodeString tooltip;
tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str());
#if defined(RTS_DEBUG)
UnicodeString ip;
ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP()));
tooltip.concat(ip);
#endif
TheMouse->setCursorTooltip( tooltip );

setLANPlayerTooltip(player);
}


Expand Down
26 changes: 18 additions & 8 deletions Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,29 @@ void LANAPI::init( void )

m_lastGameopt = "";

unsigned long bufSize = UNLEN + 1;
#if TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY
char userName[UNLEN + 1];
if (!GetUserName(userName, &bufSize))
DWORD bufSize = ARRAY_SIZE(userName);
if (GetUserNameA(userName, &bufSize))
{
strcpy(userName, "unknown");
m_userName.set(userName, bufSize);
}
else
{
m_userName = "unknown";
}
m_userName = userName;

bufSize = MAX_COMPUTERNAME_LENGTH + 1;
char computerName[MAX_COMPUTERNAME_LENGTH + 1];
if (!GetComputerName(computerName, &bufSize))
bufSize = ARRAY_SIZE(computerName);
if (GetComputerNameA(computerName, &bufSize))
{
m_hostName.set(computerName, bufSize);
}
else
{
strcpy(computerName, "unknown");
m_hostName = "unknown";
}
m_hostName = computerName;
#endif
}

void LANAPI::reset( void )
Expand Down Expand Up @@ -445,11 +453,13 @@ void LANAPI::update( void )
}
else
{
#if TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY
AsciiString text;
text.format("User=%s", m_userName.str());
RequestGameOptions( text, true );
text.format("Host=%s", m_hostName.str());
RequestGameOptions( text, true );
#endif
RequestGameOptions( "HELLO", false );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ extern const Color acceptFalseColor;

void lanUpdateSlotList( void );
void updateGameOptions( void );

void setLANPlayerTooltip(LANPlayer* player);

//Enum is used for the utility function so other windows do not need
//to know about controls on LanGameOptions window.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,8 @@ static void playerTooltip(GameWindow *window,
TheMouse->setCursorTooltip( UnicodeString::TheEmptyString );
return;
}
UnicodeString tooltip;
tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str());
#if defined(RTS_DEBUG)
UnicodeString ip;
ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP()));
tooltip.concat(ip);
#endif

TheMouse->setCursorTooltip( tooltip );
setLANPlayerTooltip(player);
}

void StartPressed(void)
Expand Down Expand Up @@ -998,6 +991,29 @@ void updateGameOptions( void )
}


//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
void setLANPlayerTooltip(LANPlayer* player)
{
UnicodeString tooltip;

if (!player->getLogin().isEmpty() || !player->getHost().isEmpty())
{
tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str());
}

#if defined(RTS_DEBUG)
UnicodeString ip;
ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP()));
tooltip.concat(ip);
#endif

if (!tooltip.isEmpty())
{
TheMouse->setCursorTooltip( tooltip );
}
}


//-------------------------------------------------------------------------------------------------
/** This is called when a shutdown is complete for this menu */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,8 @@ static void playerTooltip(GameWindow *window,
//TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:LobbyPlayers") );
return;
}
UnicodeString tooltip;
tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getLogin().str(), player->getHost().str());
#if defined(RTS_DEBUG)
UnicodeString ip;
ip.format(L" - %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(player->getIP()));
tooltip.concat(ip);
#endif
TheMouse->setCursorTooltip( tooltip );

setLANPlayerTooltip(player);
}


Expand Down
26 changes: 18 additions & 8 deletions GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,29 @@ void LANAPI::init( void )

m_lastGameopt = "";

unsigned long bufSize = UNLEN + 1;
#if TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY
char userName[UNLEN + 1];
if (!GetUserName(userName, &bufSize))
DWORD bufSize = ARRAY_SIZE(userName);
if (GetUserNameA(userName, &bufSize))
{
strcpy(userName, "unknown");
m_userName.set(userName, bufSize);
}
else
{
m_userName = "unknown";
}
m_userName = userName;

bufSize = MAX_COMPUTERNAME_LENGTH + 1;
char computerName[MAX_COMPUTERNAME_LENGTH + 1];
if (!GetComputerName(computerName, &bufSize))
bufSize = ARRAY_SIZE(computerName);
if (GetComputerNameA(computerName, &bufSize))
{
m_hostName.set(computerName, bufSize);
}
else
{
strcpy(computerName, "unknown");
m_hostName = "unknown";
}
m_hostName = computerName;
#endif
}

void LANAPI::reset( void )
Expand Down Expand Up @@ -445,11 +453,13 @@ void LANAPI::update( void )
}
else
{
#if TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY
AsciiString text;
text.format("User=%s", m_userName.str());
RequestGameOptions( text, true );
text.format("Host=%s", m_hostName.str());
RequestGameOptions( text, true );
#endif
RequestGameOptions( "HELLO", false );
}
}
Expand Down
Loading