Skip to content

Commit 8b68efd

Browse files
author
Marek Kulik
committed
Fix for code formatting
1 parent 8bf0653 commit 8b68efd

File tree

4 files changed

+143
-80
lines changed

4 files changed

+143
-80
lines changed

Client/core/CChat.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ CChat::CChat ( CGUI* pManager, const CVector2D & vecPosition )
5757
m_pCacheTexture = NULL;
5858
m_iCacheTextureRevision = 0;
5959
m_iReportCount = 0;
60-
m_fPositionOffsetX = 0.0125;
61-
m_fPositionOffsetY = 0.0150;
60+
m_fPositionOffsetX = 0.0125f;
61+
m_fPositionOffsetY = 0.0150f;
6262
m_ePositionHorizontal = Chat::Position::Horizontal::LEFT;
6363
m_ePositionVertical = Chat::Position::Vertical::TOP;
6464
m_eTextAlign = Chat::Text::Align::LEFT;
@@ -192,7 +192,8 @@ void CChat::Draw ( bool bUseCacheTexture )
192192
return;
193193

194194
// Is it time to update all the chat related cvars?
195-
if( m_iCVarsRevision != CClientVariables::GetSingleton ().GetRevision () ) {
195+
if( m_iCVarsRevision != CClientVariables::GetSingleton ().GetRevision () )
196+
{
196197
m_iCVarsRevision = CClientVariables::GetSingleton ().GetRevision ();
197198
LoadCVars ();
198199
UpdateGUI ();
@@ -222,6 +223,7 @@ void CChat::Draw ( bool bUseCacheTexture )
222223
{
223224
SAFE_RELEASE( m_pCacheTexture );
224225
}
226+
225227
// Create rendertarget if required
226228
if ( !m_pCacheTexture && ( CTickCount::Now () - m_lastRenderTargetCreationFail ).ToLongLong () > 60000 )
227229
{
@@ -372,7 +374,8 @@ void CChat::GetDrawList ( SDrawList& outDrawList )
372374
{
373375
CVector2D vecOffset;
374376

375-
if ( m_eTextAlign == Chat::Text::Align::RIGHT ) {
377+
if ( m_eTextAlign == Chat::Text::Align::RIGHT )
378+
{
376379
vecOffset.fX = fMaxLineWidth - m_Lines[ uiLine ].GetWidth();
377380
}
378381

@@ -546,7 +549,9 @@ void CChat::ClearInput ( void )
546549
m_strInputText.clear ();
547550
m_InputLine.Clear ();
548551
m_vecInputSize = CalcInputSize ();
549-
if ( m_pInput ) {
552+
553+
if ( m_pInput )
554+
{
550555
m_pInput->SetSize ( m_vecInputSize );
551556
UpdatePosition();
552557
}
@@ -648,7 +653,8 @@ bool CChat::CharacterKeyHandler ( CGUIKeyEventArgs KeyboardArgs )
648653
// Check if there is another player after our last result
649654
if ( m_strLastPlayerName.size () != 0 )
650655
{
651-
if ( strPlayerName.CompareI ( m_strLastPlayerName ) ) {
656+
if ( strPlayerName.CompareI ( m_strLastPlayerName ) )
657+
{
652658
m_strLastPlayerName.clear ();
653659
if ( *iter == vPlayerNames.back () )
654660
{
@@ -891,7 +897,8 @@ void CChat::UpdatePosition ( void )
891897

892898
m_pBackground->SetPosition ( m_vecBackgroundPosition );
893899

894-
if ( m_pInput ) {
900+
if ( m_pInput )
901+
{
895902
m_pInput->SetPosition ( m_vecInputPosition );
896903
}
897904
}
@@ -960,7 +967,9 @@ void CChat::SetInputText ( const char* szText )
960967
m_strInputText.resize ( szRemainingText - szText );
961968

962969
m_vecInputSize = CalcInputSize ();
963-
if ( m_pInput ) {
970+
971+
if ( m_pInput )
972+
{
964973
m_pInput->SetSize ( m_vecInputSize );
965974
UpdatePosition();
966975
}
@@ -996,7 +1005,9 @@ float CChat::GetFontHeight ( float fScale )
9961005
{
9971006
return g_pChat->m_pFont->GetFontHeight ( fScale );
9981007
}
1008+
9991009
fScale *= g_pChat->m_fRcpUsingDxFontScale;
1010+
10001011
return g_pCore->GetGraphics ()->GetDXFontHeight ( fScale, g_pChat->m_pDXFont );
10011012
}
10021013

@@ -1010,7 +1021,9 @@ float CChat::GetTextExtent ( const char * szText, float fScale )
10101021
{
10111022
return g_pChat->m_pFont->GetTextExtent ( szText, fScale );
10121023
}
1024+
10131025
fScale *= g_pChat->m_fRcpUsingDxFontScale;
1026+
10141027
return g_pCore->GetGraphics ()->GetDXTextExtent ( szText, fScale, g_pChat->m_pDXFont );
10151028
}
10161029

@@ -1036,8 +1049,7 @@ void CChat::DrawTextString ( const char * szText, CRect2D DrawArea, float fZ, CR
10361049
if ( DrawArea.fY1 + fLineHeight - RenderBounds.fY1 > 1 )
10371050
g_pCore->GetGraphics ()->DrawText ( ( int ) DrawArea.fX1, ( int ) RenderBounds.fY1, ( int ) DrawArea.fX2, ( int ) DrawArea.fY1 + fLineHeight, ulColor, szText, fScaleX, fScaleY, DT_LEFT | DT_BOTTOM | DT_SINGLELINE , g_pChat->m_pDXFont );
10381051
}
1039-
else
1040-
if ( DrawArea.fY1 + fLineHeight > RenderBounds.fY2 )
1052+
else if ( DrawArea.fY1 + fLineHeight > RenderBounds.fY2 )
10411053
{
10421054
// Clip text at the bottom
10431055
if ( RenderBounds.fY2 - DrawArea.fY1 > 1 )

Client/core/CClientVariables.cpp

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ bool CClientVariables::Load ( void )
3838

3939
// Load the cvars
4040
m_pStorage = pRoot->FindSubNode ( CONFIG_NODE_CVARS );
41-
if ( !m_pStorage ) {
41+
42+
if ( !m_pStorage )
43+
{
4244
// Non-existant, create a new node
4345
m_pStorage = pRoot->CreateSubNode ( CONFIG_NODE_CVARS );
4446
}
@@ -59,9 +61,12 @@ bool CClientVariables::Get ( const std::string& strVariable, CVector &val )
5961
strVal = Node ( strVariable )->GetTagContent ();
6062
ss.str ( strVal );
6163

62-
try {
64+
try
65+
{
6366
ss >> val.fX >> val.fY >> val.fZ;
64-
} catch (...) {
67+
}
68+
catch (...)
69+
{
6570
return false;
6671
}
6772

@@ -78,9 +83,12 @@ bool CClientVariables::Get ( const std::string& strVariable, CVector2D &val )
7883
strVal = Node ( strVariable )->GetTagContent ();
7984
ss.str ( strVal );
8085

81-
try {
86+
try
87+
{
8288
ss >> val.fX >> val.fY;
83-
} catch (...) {
89+
}
90+
catch (...)
91+
{
8492
return false;
8593
}
8694

@@ -98,13 +106,16 @@ bool CClientVariables::Get ( const std::string& strVariable, CColor &val )
98106
strVal = Node ( strVariable )->GetTagContent ();
99107
ss.str ( strVal );
100108

101-
try {
109+
try
110+
{
102111
ss >> iR >> iG >> iB >> iA;
103112
val.R = iR;
104113
val.G = iG;
105114
val.B = iB;
106115
val.A = iA;
107-
} catch (...) {
116+
}
117+
catch (...)
118+
{
108119
return false;
109120
}
110121

@@ -161,7 +172,9 @@ CXMLNode* CClientVariables::Node ( const std::string& strVariable )
161172

162173
// Try and grab the sub node
163174
pNode = m_pStorage->FindSubNode ( strVariable.c_str () );
164-
if ( !pNode ) {
175+
176+
if ( !pNode )
177+
{
165178
// Non-existant, create a new sub node
166179
pNode = m_pStorage->CreateSubNode ( strVariable.c_str () );
167180
}
@@ -227,29 +240,29 @@ void CClientVariables::ValidateValues ( void )
227240
uint uiViewportWidth = CCore::GetSingleton().GetGraphics ()->GetViewportWidth ();
228241
uint uiViewportHeight = CCore::GetSingleton().GetGraphics ()->GetViewportHeight ();
229242

230-
ClampValue ( "console_pos", CVector2D ( 0, 0 ), CVector2D ( uiViewportWidth - 32, uiViewportHeight - 32 ) );
231-
ClampValue ( "console_size", CVector2D ( 50, 50 ), CVector2D ( uiViewportWidth - 32, uiViewportHeight - 32 ) );
232-
ClampValue ( "fps_limit", 0, 100 );
233-
ClampValue ( "chat_font", 0, 3 );
234-
ClampValue ( "chat_lines", 3, 62 );
235-
ClampValue ( "chat_color", CColor (0,0,0,0), CColor (255,255,255,255) );
236-
ClampValue ( "chat_text_color", CColor (0,0,0,128), CColor (255,255,255,255) );
237-
ClampValue ( "chat_input_color", CColor (0,0,0,0), CColor (255,255,255,255) );
238-
ClampValue ( "chat_input_prefix_color", CColor (0,0,0,128), CColor (255,255,255,255) );
239-
ClampValue ( "chat_input_text_color", CColor (0,0,0,128), CColor (255,255,255,255) );
240-
ClampValue ( "chat_scale", CVector2D ( 0.5f, 0.5f ), CVector2D ( 3, 3 ) );
241-
ClampValue ( "chat_width", 0.5f, 4.f );
242-
ClampValue ( "chat_line_life", 1000, 120000000 );
243-
ClampValue ( "chat_line_fade_out", 1000, 30000000 );
244-
ClampValue ( "chat_position_offset_x", -1.0f, 1.0f );
245-
ClampValue ( "chat_position_offset_y", -1.0f, 1.0f );
246-
ClampValue ( "chat_position_horizontal",Chat::Position::Horizontal::LEFT, Chat::Position::Horizontal::RIGHT );
247-
ClampValue ( "chat_position_vertical", Chat::Position::Vertical::TOP, Chat::Position::Vertical::BOTTOM );
248-
ClampValue ( "chat_text_alignment", Chat::Text::Align::LEFT, Chat::Text::Align::RIGHT );
249-
ClampValue ( "text_scale", 0.8f, 3.0f );
250-
ClampValue ( "mtavolume", 0.0f, 1.0f );
251-
ClampValue ( "voicevolume", 0.0f, 1.0f );
252-
ClampValue ( "mapalpha", 0, 255 );
243+
ClampValue ( "console_pos", CVector2D ( 0, 0 ), CVector2D ( uiViewportWidth - 32, uiViewportHeight - 32 ) );
244+
ClampValue ( "console_size", CVector2D ( 50, 50 ), CVector2D ( uiViewportWidth - 32, uiViewportHeight - 32 ) );
245+
ClampValue ( "fps_limit", 0, 100 );
246+
ClampValue ( "chat_font", 0, 3 );
247+
ClampValue ( "chat_lines", 3, 62 );
248+
ClampValue ( "chat_color", CColor (0,0,0,0), CColor (255,255,255,255) );
249+
ClampValue ( "chat_text_color", CColor (0,0,0,128), CColor (255,255,255,255) );
250+
ClampValue ( "chat_input_color", CColor (0,0,0,0), CColor (255,255,255,255) );
251+
ClampValue ( "chat_input_prefix_color", CColor (0,0,0,128), CColor (255,255,255,255) );
252+
ClampValue ( "chat_input_text_color", CColor (0,0,0,128), CColor (255,255,255,255) );
253+
ClampValue ( "chat_scale", CVector2D ( 0.5f, 0.5f ), CVector2D ( 3, 3 ) );
254+
ClampValue ( "chat_width", 0.5f, 4.f );
255+
ClampValue ( "chat_line_life", 1000, 120000000 );
256+
ClampValue ( "chat_line_fade_out", 1000, 30000000 );
257+
ClampValue ( "chat_position_offset_x", -1.0f, 1.0f );
258+
ClampValue ( "chat_position_offset_y", -1.0f, 1.0f );
259+
ClampValue ( "chat_position_horizontal", Chat::Position::Horizontal::LEFT, Chat::Position::Horizontal::RIGHT );
260+
ClampValue ( "chat_position_vertical", Chat::Position::Vertical::TOP, Chat::Position::Vertical::BOTTOM );
261+
ClampValue ( "chat_text_alignment", Chat::Text::Align::LEFT, Chat::Text::Align::RIGHT );
262+
ClampValue ( "text_scale", 0.8f, 3.0f );
263+
ClampValue ( "mtavolume", 0.0f, 1.0f );
264+
ClampValue ( "voicevolume", 0.0f, 1.0f );
265+
ClampValue ( "mapalpha", 0, 255 );
253266
}
254267

255268

@@ -259,9 +272,9 @@ void CClientVariables::LoadDefaults ( void )
259272
Set(__x,__y)
260273
#define _S(__x) std::string(__x)
261274

262-
if(!Exists("nick"))
275+
if (!Exists("nick"))
263276
{
264-
DEFAULT ( "nick", _S(CNickGen::GetRandomNickname()) ); // nickname
277+
DEFAULT ( "nick", _S(CNickGen::GetRandomNickname()) ); // nickname
265278
CCore::GetSingleton ().RequestNewNickOnStart(); // Request the user to set a new nickname
266279
}
267280

0 commit comments

Comments
 (0)