Skip to content
Open
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
11 changes: 7 additions & 4 deletions Client/core/CConnectManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,14 @@ bool CConnectManager::Connect(const char* szHost, unsigned short usPort, const c
OpenServerFirewall(m_Address, CServerBrowser::GetSingletonPtr()->FindServerHttpPort(m_strHost, m_usPort), true);

// Display the status box
SString strBuffer(_("Connecting to %s:%u ..."), m_strHost.c_str(), m_usPort);
std::string message;
if (m_bReconnect)
strBuffer = SString(_("Reconnecting to %s:%u ..."), m_strHost.c_str(), m_usPort);
CCore::GetSingleton().ShowMessageBox(_("CONNECTING"), strBuffer, MB_BUTTON_CANCEL | MB_ICON_INFO, m_pOnCancelClick);
WriteDebugEvent(SString("Connecting to %s:%u ...", m_strHost.c_str(), m_usPort));
message = mtasa::format(_("Reconnecting to {0}:{1} ..."), m_strHost, m_usPort);
else
message = mtasa::format(_("Connecting to {0}:{1} ..."), m_strHost, m_usPort);

CCore::GetSingleton().ShowMessageBox(_("CONNECTING"), message.c_str(), MB_BUTTON_CANCEL | MB_ICON_INFO, m_pOnCancelClick);
WriteDebugEvent(std::format("Connecting to {}:{} ...", m_strHost, m_usPort));

return true;
}
Expand Down
18 changes: 18 additions & 0 deletions Shared/sdk/SharedUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,21 @@
#define strnicmp strncasecmp
#endif
#endif

// Ensure that the C++ version is at least C++20
#if __cplusplus >= 202002L

/*
The function prevents a compilation error caused by using non-constant format strings and
correctly forwards the arguments to std::format for formatting
*/
namespace mtasa
{
template <class... _Types>
inline std::string format(const std::string_view fmt, _Types&&... _Args)
{
return std::vformat(fmt, std::make_format_args(_Args...));
}
}

#endif