Skip to content

Commit

Permalink
Apply win-apply-clang-format.bat
Browse files Browse the repository at this point in the history
  • Loading branch information
patrikjuvonen committed Apr 8, 2023
1 parent 4d6a86e commit 483cd28
Show file tree
Hide file tree
Showing 179 changed files with 3,186 additions and 3,527 deletions.
15 changes: 7 additions & 8 deletions Client/cefweb/CWebView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,7 @@ bool CWebView::GetFullPathFromLocal(SString& strPath)
bool result = false;

g_pCore->GetWebCore()->WaitForTask(
[&](bool aborted)
{
[&](bool aborted) {
if (aborted)
return;

Expand Down Expand Up @@ -518,8 +517,7 @@ bool CWebView::VerifyFile(const SString& strPath, CBuffer& outFileData)
bool result = false;

g_pCore->GetWebCore()->WaitForTask(
[&](bool aborted)
{
[&](bool aborted) {
if (aborted)
return;

Expand Down Expand Up @@ -812,15 +810,15 @@ bool CWebView::OnBeforeBrowse(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame>
if (host != "mta")
{
if (IsLocal() || g_pCore->GetWebCore()->GetDomainState(host, true) != eURLState::WEBPAGE_ALLOWED)
bResult = true; // Block remote here
bResult = true; // Block remote here
else
bResult = false; // Allow
}
else
bResult = false;
}
else
bResult = true; // Block other schemes
bResult = true; // Block other schemes

// Check if we're in the browser's main frame or only a frame element of the current page
bool bIsMainFrame = frame->IsMain();
Expand Down Expand Up @@ -1044,8 +1042,9 @@ bool CWebView::OnConsoleMessage(CefRefPtr<CefBrowser> browser, cef_log_severity_
if (g_pCore->GetWebCore()->IsTestModeEnabled())
{
g_pCore->GetWebCore()->AddEventToEventQueue(
[message, source]()
{ g_pCore->DebugPrintfColor("[BROWSER] Console: %s (%s)", 255, 0, 0, UTF16ToMbUTF8(message).c_str(), UTF16ToMbUTF8(source).c_str()); },
[message, source]() {
g_pCore->DebugPrintfColor("[BROWSER] Console: %s (%s)", 255, 0, 0, UTF16ToMbUTF8(message).c_str(), UTF16ToMbUTF8(source).c_str());
},
this, "OnConsoleMessage");
}

Expand Down
5 changes: 1 addition & 4 deletions Client/core/CAdditionalVertexStreamManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ namespace
// Helper functions for this file only

// Convert size of PT stream to sizeof of N stream
uint ConvertPTSize(uint SizePT)
{
return SizePT * 12 / 20;
}
uint ConvertPTSize(uint SizePT) { return SizePT * 12 / 20; }

// Get 64 bit key for a triangle by using the ordered vertex indices
long long getTriKey(WORD a, WORD b, WORD c)
Expand Down
40 changes: 20 additions & 20 deletions Client/core/CClientVariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,27 +270,27 @@ void CClientVariables::LoadDefaults()
CCore::GetSingleton().RequestNewNickOnStart(); // Request the user to set a new nickname
}

DEFAULT("host", _S("127.0.0.1")); // hostname
DEFAULT("port", 22003); // port
DEFAULT("password", _S("")); // password
DEFAULT("qc_host", _S("127.0.0.1")); // quick connect hostname
DEFAULT("qc_port", 22003); // quick connect port
DEFAULT("qc_password", _S("")); // quick connect password
DEFAULT("debugfile", _S("")); // debug filename
DEFAULT("console_pos", CVector2D(0, 0)); // console position
DEFAULT("console_size", CVector2D(200, 200)); // console size
DEFAULT("serverbrowser_size", CVector2D(720.0f, 495.0f)); // serverbrowser size
DEFAULT("fps_limit", 100); // frame limiter
DEFAULT("chat_font", 2); // chatbox font type
DEFAULT("chat_lines", 10); // chatbox lines
DEFAULT("chat_color", CColor(0, 0, 0, 0)); // chatbox background color
DEFAULT("chat_text_color", CColor(172, 213, 254, 255)); // chatbox text color
DEFAULT("host", _S("127.0.0.1")); // hostname
DEFAULT("port", 22003); // port
DEFAULT("password", _S("")); // password
DEFAULT("qc_host", _S("127.0.0.1")); // quick connect hostname
DEFAULT("qc_port", 22003); // quick connect port
DEFAULT("qc_password", _S("")); // quick connect password
DEFAULT("debugfile", _S("")); // debug filename
DEFAULT("console_pos", CVector2D(0, 0)); // console position
DEFAULT("console_size", CVector2D(200, 200)); // console size
DEFAULT("serverbrowser_size", CVector2D(720.0f, 495.0f)); // serverbrowser size
DEFAULT("fps_limit", 100); // frame limiter
DEFAULT("chat_font", 2); // chatbox font type
DEFAULT("chat_lines", 10); // chatbox lines
DEFAULT("chat_color", CColor(0, 0, 0, 0)); // chatbox background color
DEFAULT("chat_text_color", CColor(172, 213, 254, 255)); // chatbox text color
DEFAULT("chat_text_outline", false);
DEFAULT("chat_input_color", CColor(0, 0, 0, 0)); // chatbox input background color
DEFAULT("chat_input_prefix_color", CColor(172, 213, 254, 255)); // chatbox input prefix color
DEFAULT("chat_input_text_color", CColor(172, 213, 254, 255)); // chatbox input text color
DEFAULT("chat_scale", CVector2D(1.0f, 1.0f)); // chatbox scale
DEFAULT("chat_width", 1.5f); // chatbox width
DEFAULT("chat_input_color", CColor(0, 0, 0, 0)); // chatbox input background color
DEFAULT("chat_input_prefix_color", CColor(172, 213, 254, 255)); // chatbox input prefix color
DEFAULT("chat_input_text_color", CColor(172, 213, 254, 255)); // chatbox input text color
DEFAULT("chat_scale", CVector2D(1.0f, 1.0f)); // chatbox scale
DEFAULT("chat_width", 1.5f); // chatbox width

DEFAULT("chat_css_style_text", false); // chatbox css/hl style text
DEFAULT("chat_css_style_background", false); // chatbox css/hl style background
Expand Down
2 changes: 1 addition & 1 deletion Client/core/CEntryHistory.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CEntryHistoryItem

bool operator!=(const SString& other) const { return entry != other; }
bool operator==(const SString& other) const { return entry == other; }
operator const char*() const { return entry.c_str(); }
operator const char*() const { return entry.c_str(); }
};

class CEntryHistory
Expand Down
2 changes: 1 addition & 1 deletion Client/core/CFileFormatJpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ bool JpegEncode(uint uiWidth, uint uiHeight, uint uiQuality, const void* pData,
unsigned char* membuffer = NULL;
jpeg_mem_dest(&cinfo, &membuffer, &memlen);

cinfo.image_width = uiWidth; /* image width and height, in pixels */
cinfo.image_width = uiWidth; /* image width and height, in pixels */
cinfo.image_height = uiHeight;
cinfo.input_components = 3; /* # of color components per pixel */
cinfo.in_color_space = JCS_RGB; /* colorspace of input image */
Expand Down
57 changes: 22 additions & 35 deletions Client/core/CKeyBinds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,19 +416,16 @@ bool CKeyBinds::ProcessKeyStroke(const SBindableKey* pKey, bool bState)
bool wasBindFound = false;
std::list<CCommandBind*> processedCommandBinds;

auto wasCommandBindProcessed = [&processedCommandBinds](CCommandBind* commandBind)
{
auto iter = std::find_if(processedCommandBinds.begin(), processedCommandBinds.end(),
[&](CCommandBind* processedCommandBind)
{
if (processedCommandBind->triggerState != commandBind->triggerState)
return false;
auto wasCommandBindProcessed = [&processedCommandBinds](CCommandBind* commandBind) {
auto iter = std::find_if(processedCommandBinds.begin(), processedCommandBinds.end(), [&](CCommandBind* processedCommandBind) {
if (processedCommandBind->triggerState != commandBind->triggerState)
return false;

if (processedCommandBind->command != commandBind->command)
return false;
if (processedCommandBind->command != commandBind->command)
return false;

return commandBind->arguments.empty() || processedCommandBind->arguments == commandBind->arguments;
});
return commandBind->arguments.empty() || processedCommandBind->arguments == commandBind->arguments;
});
return iter != processedCommandBinds.end();
};

Expand Down Expand Up @@ -552,8 +549,9 @@ void CKeyBinds::RemoveDeletedBinds()

void CKeyBinds::ClearCommandsAndControls()
{
const auto predicate = [](const KeyBindPtr& bind)
{ return !bind->isBeingDeleted && bind->type != KeyBindType::FUNCTION && bind->type != KeyBindType::CONTROL_FUNCTION; };
const auto predicate = [](const KeyBindPtr& bind) {
return !bind->isBeingDeleted && bind->type != KeyBindType::FUNCTION && bind->type != KeyBindType::CONTROL_FUNCTION;
};
RemoveBinds(m_binds, !m_bProcessingKeyStroke, predicate);
}

Expand Down Expand Up @@ -671,8 +669,7 @@ bool CKeyBinds::RemoveCommand(const char* szKey, const char* szCommand, bool bCh

std::string_view command{szCommand};

const auto predicate = [&](const KeyBindPtr& bind)
{
const auto predicate = [&](const KeyBindPtr& bind) {
if (bind->isBeingDeleted || bind->type != KeyBindType::COMMAND)
return false;

Expand All @@ -695,8 +692,7 @@ bool CKeyBinds::RemoveAllCommands(const char* szKey, bool bCheckState, bool bSta
if (!szKey)
return false;

const auto predicate = [&](const KeyBindPtr& bind)
{
const auto predicate = [&](const KeyBindPtr& bind) {
if (bind->isBeingDeleted || bind->type != KeyBindType::COMMAND)
return false;

Expand Down Expand Up @@ -934,8 +930,7 @@ void CKeyBinds::UserChangeCommandBoundKey(CCommandBind* pBind, const SBindableKe
//
void CKeyBinds::SortCommandBinds()
{
auto compare = [](const KeyBindPtr& lhs, const KeyBindPtr& rhs)
{
auto compare = [](const KeyBindPtr& lhs, const KeyBindPtr& rhs) {
// Group command binds last
if (lhs->type != KeyBindType::COMMAND && rhs->type == KeyBindType::COMMAND)
return true;
Expand Down Expand Up @@ -1025,8 +1020,7 @@ bool CKeyBinds::RemoveGTAControl(const char* szKey, const char* szControl)
if (!szKey || !szControl)
return false;

const auto predicate = [&](const KeyBindPtr& bind)
{
const auto predicate = [&](const KeyBindPtr& bind) {
if (bind->isBeingDeleted || bind->type != KeyBindType::GTA_CONTROL)
return false;

Expand All @@ -1042,8 +1036,7 @@ bool CKeyBinds::RemoveAllGTAControls(const char* szKey)
if (!szKey)
return false;

const auto predicate = [&](const KeyBindPtr& bind)
{
const auto predicate = [&](const KeyBindPtr& bind) {
if (bind->isBeingDeleted || bind->type != KeyBindType::GTA_CONTROL)
return false;

Expand Down Expand Up @@ -1338,8 +1331,7 @@ bool CKeyBinds::RemoveFunction(const char* szKey, KeyFunctionBindHandler Handler

bool CKeyBinds::RemoveFunction(const SBindableKey* pKey, KeyFunctionBindHandler Handler, bool bCheckState, bool bState)
{
const auto predicate = [&](const KeyBindPtr& bind)
{
const auto predicate = [&](const KeyBindPtr& bind) {
if (bind->isBeingDeleted || bind->type != KeyBindType::FUNCTION)
return false;

Expand All @@ -1356,8 +1348,7 @@ bool CKeyBinds::RemoveFunction(const SBindableKey* pKey, KeyFunctionBindHandler

bool CKeyBinds::RemoveAllFunctions(KeyFunctionBindHandler Handler)
{
const auto predicate = [&](const KeyBindPtr& bind)
{
const auto predicate = [&](const KeyBindPtr& bind) {
if (bind->isBeingDeleted || bind->type != KeyBindType::FUNCTION)
return false;

Expand Down Expand Up @@ -1444,8 +1435,7 @@ bool CKeyBinds::RemoveControlFunction(const char* szControl, ControlFunctionBind

bool CKeyBinds::RemoveControlFunction(SBindableGTAControl* pControl, ControlFunctionBindHandler Handler, bool bCheckState, bool bState)
{
const auto predicate = [&](const KeyBindPtr& bind)
{
const auto predicate = [&](const KeyBindPtr& bind) {
if (bind->isBeingDeleted || bind->type != KeyBindType::CONTROL_FUNCTION)
return false;

Expand All @@ -1462,8 +1452,7 @@ bool CKeyBinds::RemoveControlFunction(SBindableGTAControl* pControl, ControlFunc

bool CKeyBinds::RemoveAllControlFunctions(ControlFunctionBindHandler Handler)
{
const auto predicate = [&](const KeyBindPtr& bind)
{
const auto predicate = [&](const KeyBindPtr& bind) {
if (bind->isBeingDeleted || bind->type != KeyBindType::CONTROL_FUNCTION)
return false;

Expand Down Expand Up @@ -2198,8 +2187,7 @@ bool CKeyBinds::SaveToXML(CXMLNode* pMainNode)

CXMLAttributes& attributes = bindNode->GetAttributes();

auto createAttribute = [&attributes](const char* key, const char* value)
{
auto createAttribute = [&attributes](const char* key, const char* value) {
if (value && value[0])
{
CXMLAttribute* attribute = attributes.Create(key);
Expand Down Expand Up @@ -2478,8 +2466,7 @@ void CKeyBinds::PrintBindsCommand(const char* szCmdLine)

CConsoleInterface* console = m_pCore->GetConsole();

auto print = [console](const KeyBindPtr& bind)
{
auto print = [console](const KeyBindPtr& bind) {
switch (bind->type)
{
case KeyBindType::COMMAND:
Expand Down
2 changes: 1 addition & 1 deletion Client/core/CMainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ void CMainMenu::SetMenuVerticalPosition(int iPosY)

void CMainMenu::SetMenuUnhovered() // Dehighlight all our items
{
if (m_bIsIngame) // CEGUI hack
if (m_bIsIngame) // CEGUI hack
{
float fAlpha = m_pDisconnect->image->GetAlpha();
m_pDisconnect->image->SetAlpha(0.35f);
Expand Down
2 changes: 1 addition & 1 deletion Client/core/CModManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void CModManager::DoPulsePostFrame()
if (m_pClientBase)
CCore::GetSingleton().EnsureFrameRateLimitApplied(); // Catch missed frames
else
CCore::GetSingleton().ApplyFrameRateLimit(88); // Limit when not connected
CCore::GetSingleton().ApplyFrameRateLimit(88); // Limit when not connected

// Load/unload requested?
if (m_bUnloadRequested)
Expand Down
8 changes: 4 additions & 4 deletions Client/core/CScreenShot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ SString CScreenShot::GetScreenshotPath()
// Get the system time
SYSTEMTIME sysTime;
GetLocalTime(&sysTime);
return SString("%s\\mta-screen_%d-%02d-%02d_%02d-%02d-%02d.png", *ms_strScreenDirectoryPath, sysTime.wYear, sysTime.wMonth, sysTime.wDay,
sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
return SString("%s\\mta-screen_%d-%02d-%02d_%02d-%02d-%02d.png", *ms_strScreenDirectoryPath, sysTime.wYear, sysTime.wMonth, sysTime.wDay, sysTime.wHour,
sysTime.wMinute, sysTime.wSecond);
}

//
// Take a screenshot if needed.
// @ bool bBeforeGUI: whenever we try to capture screenshot before GUI gets drawn
//
//
void CScreenShot::CheckForScreenShot(bool bBeforeGUI)
{
if (!ms_bScreenShot)
Expand Down Expand Up @@ -117,7 +117,7 @@ void CScreenShot::CheckForScreenShot(bool bBeforeGUI)
// Callback for threaded save
DWORD CScreenShot::ThreadProc(LPVOID lpdwThreadParam)
{
uint uiLinePitch = ms_uiWidth * 4;
uint uiLinePitch = ms_uiWidth * 4;
void* pData = ms_ScreenShotBuffer.GetData();

// Create the screen data buffer
Expand Down
4 changes: 2 additions & 2 deletions Client/core/CScreenShot.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
class CScreenShot
{
public:
static void InitiateScreenShot(bool bIsCameraShot);
static void CheckForScreenShot(bool bBeforeGUI);
static void InitiateScreenShot(bool bIsCameraShot);
static void CheckForScreenShot(bool bBeforeGUI);

protected:
static void StartSaveThread();
Expand Down
9 changes: 3 additions & 6 deletions Client/core/CVersionUpdater.Util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ namespace
BUTTON_3,
};

CQuestionBox& GetQuestionBox()
{
return *CCore::GetSingleton().GetLocalGUI()->GetMainMenu()->GetQuestionWindow();
}
CQuestionBox& GetQuestionBox() { return *CCore::GetSingleton().GetLocalGUI()->GetMainMenu()->GetQuestionWindow(); }

} // namespace

Expand Down Expand Up @@ -169,8 +166,8 @@ namespace

public:
CValueInt(int iValue = 0) : m_iValue(iValue) {}
void operator=(int iValue) { m_iValue = iValue; }
operator int() const { return m_iValue; }
void operator=(int iValue) { m_iValue = iValue; }
operator int() const { return m_iValue; }
virtual bool SetFromString(const SString& str)
{
m_iValue = atoi(str);
Expand Down

0 comments on commit 483cd28

Please sign in to comment.