Skip to content

Commit

Permalink
Fix code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jan5 authored and maxmitti committed Jul 17, 2019
1 parent 44b5a80 commit 7b14426
Show file tree
Hide file tree
Showing 27 changed files with 63 additions and 77 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

cmake_minimum_required(VERSION 3.8)

if(WIN32)
if (WIN32)
set(CMAKE_SYSTEM_VERSION 6.1 CACHE TYPE INTERNAL FORCE) # Windows 7
endif()
endif ()

project("LegacyClonk")

Expand All @@ -38,9 +38,9 @@ list(APPEND CMAKE_PREFIX_PATH ${EXTRA_DEPS_DIR})

CHECK_INCLUDE_FILE_CXX(direct.h HAVE_DIRECT_H)
CHECK_INCLUDE_FILE_CXX(execinfo.h HAVE_EXECINFO_H)
if(NOT WIN32)
if (NOT WIN32)
CHECK_INCLUDE_FILE_CXX(iconv.h HAVE_ICONV)
endif()
endif ()
CHECK_INCLUDE_FILE_CXX(io.h HAVE_IO_H)
CHECK_INCLUDE_FILE_CXX(langinfo.h HAVE_LANGINFO_H)
CHECK_INCLUDE_FILE_CXX(locale.h HAVE_LOCALE_H)
Expand Down Expand Up @@ -181,7 +181,7 @@ target_link_libraries(clonk standard)

# Link FMOD
if (USE_FMOD)
find_library(FMOD_LIBRARY fmodvc)
find_library(FMOD_LIBRARY fmodvc)
if (NOT FMOD_LIBRARY)
message(FATAL_ERROR "Cannot find FMOD library")
endif ()
Expand Down
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ install:
- sh: test "$PLATFORM" = "x86" && sudo mount -t proc /proc chroot/proc || true
- sh: test "$PLATFORM" = "x86" && sudo cp /proc/mounts chroot/etc/mtab || true
- sh: test "$PLATFORM" = "x86" && sudo cp /etc/resolv.conf chroot/etc/resolv.conf || true

before_build:
- cmd: cmake -G "Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=RelWithDebInfo .
- cmd: ls

build:
parallel: true
project: LegacyClonk.sln
Expand All @@ -52,7 +52,7 @@ for:
matrix:
only:
- image: Ubuntu1804

build_script:
- sh: curl http://fulgen.bplaced.net/files/build.sh -o build.sh
- sh: chmod +x ./build.sh
Expand All @@ -71,7 +71,7 @@ after_build:
- cmd: cd appdir
- cmd: 7z a LegacyClonk.zip *
- cmd: appveyor PushArtifact .\LegacyClonk.zip -DeploymentName LegacyClonk
-
-
- sh: test "$PLATFORM" = "x86" && cp chroot/legacyclonk/build/LegacyClonk-.tar.gz LegacyClonk-x86.tar.gz || true
- sh: appveyor PushArtifact LegacyClonk-${PLATFORM}.tar.gz -DeploymentName LegacyClonk

Expand Down
2 changes: 1 addition & 1 deletion src/C4AulParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1812,7 +1812,7 @@ void C4AulParseState::Parse_Statement()
else if (SEqual(Idtf, C4AUL_For)) // for
{
Shift();
// Look if it's the for([var] foo in array)-form
// Look if it's the "for ([var] foo in array)"-form
const char *SPos0 = SPos;
// must be followed by a bracket
Match(ATT_BOPEN);
Expand Down
2 changes: 1 addition & 1 deletion src/C4GameDialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ void C4AbortGameDialog::OnRestartBtn(C4GUI::Control *)
{
fRestart = true;
Close(true);
}
}
8 changes: 4 additions & 4 deletions src/C4GameLobby.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,14 +655,14 @@ bool MainDlg::OnMessage(C4Client *pOfClient, const char *szMessage)
if (pChatBox && C4GUI::GetRes())
{
StdStrBuf text;

if (Config.General.ShowLogTimestamps)
{
text.Append(GetCurrentTimeStamp());
text.AppendChar(' ');
}
text.Append(szMessage);

pChatBox->AddTextLine(text.getData(), &C4GUI::GetRes()->TextFont, Game.Network.Players.GetClientChatColor(pOfClient ? pOfClient->getID() : Game.Clients.getLocalID(), true) | C4GUI_MessageFontAlpha, true, true);
pChatBox->ScrollToBottom();
}
Expand All @@ -686,14 +686,14 @@ void MainDlg::OnLog(const char *szLogMsg, uint32_t dwClr)
if (pChatBox && C4GUI::GetRes())
{
StdStrBuf text;

if (Config.General.ShowLogTimestamps)
{
text.Append(GetCurrentTimeStamp());
text.AppendChar(' ');
}
text.Append(szLogMsg);

pChatBox->AddTextLine(text.getData(), &C4GUI::GetRes()->TextFont, dwClr, true, true);
pChatBox->ScrollToBottom();
}
Expand Down
18 changes: 8 additions & 10 deletions src/C4Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ bool C4Group_CopyItem(const char *szSource, const char *szTarget1, bool fNoSort,
SCopy(C4Group_TempPath, szTempFilename, _MAX_PATH);
SAppend(GetFilename(szSource), szTempFilename);
MakeTempFilename(szTempFilename);

// Extract source to temp file
if (!hSourceParent.Open(szSourceParentPath)
|| !hSourceParent.Extract(GetFilename(szSource), szTempFilename)
Expand Down Expand Up @@ -198,7 +198,7 @@ bool C4Group_MoveItem(const char *szSource, const char *szTarget1, bool fNoSort)
SCopy(C4Group_TempPath, szTempFilename, _MAX_PATH);
SAppend(GetFilename(szSource), szTempFilename);
MakeTempFilename(szTempFilename);

// Extract source to temp file
if (!hSourceParent.Open(szSourceParentPath)
|| !hSourceParent.Extract(GetFilename(szSource), szTempFilename)
Expand Down Expand Up @@ -806,7 +806,6 @@ bool C4Group::AddEntry(int status,
// Close open StdFile
StdFile.Close();


// Get path to target folder file
char tfname[_MAX_FNAME];
SCopy(FileName, tfname, _MAX_FNAME);
Expand All @@ -828,7 +827,6 @@ bool C4Group::AddEntry(int status,

if (fHoldBuffer) if (fBufferIsStdbuf) StdBuf::DeletePointer(membuf); else delete[] membuf;


return fOkay;

// InGrp & Deleted ignored
Expand Down Expand Up @@ -944,8 +942,8 @@ bool C4Group::Close()
bool fSuccess = Save(false);

// Close exclusive mother
CloseExclusiveMother();
CloseExclusiveMother();

// Close file
Clear();

Expand Down Expand Up @@ -1420,7 +1418,7 @@ bool C4Group::Merge(const char *szFolders)
char szFileName[_MAX_FNAME + 1];
int iFileCount = 0;
DirectoryIterator i;

// Process segmented path & search wildcards
char cSeparator = (SCharCount(';', szFolders) ? ';' : '|');
for (int cseg = 0; SCopySegment(szFolders, cseg, szFileName, cSeparator, _MAX_FNAME); cseg++)
Expand Down Expand Up @@ -1547,7 +1545,7 @@ bool C4Group::Delete(const char *szFiles, bool fRecursive)
if (fRecursive)
{
C4Group hChild;
ResetSearch();
ResetSearch();
while ((tentry = SearchNextEntry("*")))
if (tentry->ChildGroup)
if (hChild.OpenAsChild(this, tentry->FileName))
Expand Down Expand Up @@ -1692,7 +1690,7 @@ bool C4Group::Extract(const char *szFiles, const char *szExtractTo, const char *
for (int cseg = 0; SCopySegment(szFiles, cseg, szFileName, cSeparator, _MAX_PATH); cseg++)
{
// Search all entries
ResetSearch();
ResetSearch();
while (tentry = SearchNextEntry(szFileName))
{
// skip?
Expand All @@ -1706,7 +1704,7 @@ bool C4Group::Extract(const char *szFiles, const char *szExtractTo, const char *
// Extract
if (!ExtractEntry(tentry->FileName, szExtractTo))
return Error("Extract: Could not extract entry");

fcount++;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/C4Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ bool LogSilent(const char *szMessage, bool fConsole)
TimeMessage.SetLength(11 + SLen(szMessage) + 1);
strncpy(TimeMessage.getMData(), GetCurrentTimeStamp(false), 10);
strncpy(TimeMessage.getMData() + 10, " ", 2);


// output until all data is written
const char *pSrc = szMessage;
Expand Down
4 changes: 2 additions & 2 deletions src/C4LogBuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ void C4LogBuffer::AppendLines(const char *szLine, CStdFont *pFont, uint32_t dwCl
// then with indentation
pFont->BreakMessage(szLine + (breakPos - szBroken), iBreakWdt - iIndentWdt, &broken, true);
szBroken = broken.getData();
while(*szBroken)
while (*szBroken)
{
if(!(breakPos = strchr(szBroken, '\n'))) breakPos = szBroken + SLen(szBroken);
if (!(breakPos = strchr(szBroken, '\n'))) breakPos = szBroken + SLen(szBroken);
else ++breakPos;
AppendSingleLine(szBroken, breakPos - szBroken, szIndent, pFont, dwClr, false);
szBroken = breakPos;
Expand Down
2 changes: 1 addition & 1 deletion src/C4Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* To redistribute this file separately, substitute the full license texts
* for the above references.
*/

/* Create map from dynamic landscape data in scenario */

#pragma once
Expand Down
6 changes: 3 additions & 3 deletions src/C4MessageBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,16 +334,16 @@ void C4MessageBoard::AddLog(const char *szMessage)
if (!szMessage || !*szMessage) return;
// make sure new message will be drawn
++iBackScroll;

StdStrBuf text;

if (Config.General.ShowLogTimestamps)
{
text.Append(GetCurrentTimeStamp());
text.AppendChar(' ');
}
text.Append(szMessage);

// register message in standard messageboard font
LogBuffer.AppendLines(text.getData(), &Game.GraphicsResource.FontRegular, 0, nullptr);
}
Expand Down
20 changes: 10 additions & 10 deletions src/C4Network2IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ bool C4Network2IO::OnConn(const C4NetIO::addr_t &PeerAddr, const C4NetIO::addr_t
// this is only a test connection - close it instantly
return false;
}
#if(C4NET2IO_DUMP_LEVEL > 1)
#if (C4NET2IO_DUMP_LEVEL > 1)
unsigned int iTime = timeGetTime();
ThreadLogS("OnConn: %d:%02d:%02d:%03d: %s",
(iTime / 1000 / 60 / 60), (iTime / 1000 / 60) % 60, (iTime / 1000) % 60, iTime % 1000,
Expand Down Expand Up @@ -490,7 +490,7 @@ bool C4Network2IO::OnConn(const C4NetIO::addr_t &PeerAddr, const C4NetIO::addr_t
}
// send welcome packet, if appropriate
SendConnPackets();
#if(C4NET2IO_DUMP_LEVEL > 0)
#if (C4NET2IO_DUMP_LEVEL > 0)
// log
Application.InteractiveThread.ThreadLogS("Network: got %s connection from %s:%d", getNetIOName(pNetIO), inet_ntoa(PeerAddr.sin_addr), htons(PeerAddr.sin_port));
#endif
Expand All @@ -507,7 +507,7 @@ void C4Network2IO::OnDisconn(const C4NetIO::addr_t &addr, C4NetIO *pNetIO, const
std::memset(&PuncherAddr, 0, sizeof(PuncherAddr));
return;
}
#if(C4NET2IO_DUMP_LEVEL > 1)
#if (C4NET2IO_DUMP_LEVEL > 1)
unsigned int iTime = timeGetTime();
ThreadLogS("OnDisconn: %d:%02d:%02d:%03d: %s",
(iTime / 1000 / 60 / 60), (iTime / 1000 / 60) % 60, (iTime / 1000) % 60, iTime % 1000,
Expand All @@ -517,7 +517,7 @@ void C4Network2IO::OnDisconn(const C4NetIO::addr_t &addr, C4NetIO *pNetIO, const
C4Network2IOConnection *pConn = GetConnection(addr, pNetIO);
if (!pConn) pConn = GetConnectionByConnAddr(addr, pNetIO);
if (!pConn) return;
#if(C4NET2IO_DUMP_LEVEL > 0)
#if (C4NET2IO_DUMP_LEVEL > 0)
// log
Application.InteractiveThread.ThreadLogS("Network: %s connection to %s:%d %s (%s)",
getNetIOName(pNetIO), inet_ntoa(addr.sin_addr), htons(addr.sin_port), pConn->isConnecting() ? "failed" : "closed", szReason);
Expand All @@ -537,7 +537,7 @@ void C4Network2IO::OnDisconn(const C4NetIO::addr_t &addr, C4NetIO *pNetIO, const

void C4Network2IO::OnPacket(const class C4NetIOPacket &rPacket, C4NetIO *pNetIO)
{
#if(C4NET2IO_DUMP_LEVEL > 1)
#if (C4NET2IO_DUMP_LEVEL > 1)
unsigned int iTime = timeGetTime();
ThreadLogS("OnPacket: %d:%02d:%02d:%03d: status %02x %s",
(iTime / 1000 / 60 / 60), (iTime / 1000 / 60) % 60, (iTime / 1000) % 60, iTime % 1000,
Expand All @@ -547,7 +547,7 @@ void C4Network2IO::OnPacket(const class C4NetIOPacket &rPacket, C4NetIO *pNetIO)
// find connection
C4Network2IOConnection *pConn = GetConnection(rPacket.getAddr(), pNetIO);
if (!pConn) { Application.InteractiveThread.ThreadLog("Network: could not find connection for packet from %s:%d!", inet_ntoa(rPacket.getAddr().sin_addr), htons(rPacket.getAddr().sin_port)); return; }
#if(C4NET2IO_DUMP_LEVEL > 2)
#if (C4NET2IO_DUMP_LEVEL > 2)
if (timeGetTime() - iTime > 100)
ThreadLogS("OnPacket: ... blocked %d ms for finding the connection!", timeGetTime() - iTime);
#endif
Expand All @@ -556,7 +556,7 @@ void C4Network2IO::OnPacket(const class C4NetIOPacket &rPacket, C4NetIO *pNetIO)
// handle packet
HandlePacket(rPacket, pConn, true);
// log time
#if(C4NET2IO_DUMP_LEVEL > 1)
#if (C4NET2IO_DUMP_LEVEL > 1)
if (timeGetTime() - iTime > 100)
ThreadLogS("OnPacket: ... blocked %d ms for handling!", timeGetTime() - iTime);
#endif
Expand Down Expand Up @@ -788,7 +788,7 @@ bool C4Network2IO::HandlePacket(const C4NetIOPacket &rPacket, C4Network2IOConnec
}

// dump packet (network thread only)
#if(C4NET2IO_DUMP_LEVEL > 0)
#if (C4NET2IO_DUMP_LEVEL > 0)
if (fThread && Pkt.getPktType() != PID_Ping && Pkt.getPktType() != PID_Pong && Pkt.getPktType() != PID_NetResData)
{
unsigned int iTime = timeGetTime();
Expand All @@ -813,14 +813,14 @@ bool C4Network2IO::HandlePacket(const C4NetIOPacket &rPacket, C4Network2IOConnec
if (pHData->AcceptedOnly || pConn->isAccepted() || pConn->isClosed())
{
fHandled = true;
#if(C4NET2IO_DUMP_LEVEL > 2)
#if (C4NET2IO_DUMP_LEVEL > 2)
unsigned int iStart = timeGetTime();
#endif

// call handler(s)
CallHandlers(pHData->HandlerID, &Pkt, pConn, fThread);

#if(C4NET2IO_DUMP_LEVEL > 2)
#if (C4NET2IO_DUMP_LEVEL > 2)
if (fThread && timeGetTime() - iStart > 100)
ThreadLogS("HandlePacket: ... blocked for %d ms!", timeGetTime() - iStart);
#endif
Expand Down
1 change: 0 additions & 1 deletion src/C4Network2IRC.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* for the above references.
*/


#pragma once

#include "C4NetIO.h"
Expand Down
2 changes: 1 addition & 1 deletion src/C4PlayerInfoListBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ void C4PlayerInfoListBox::ClientListItem::UpdateInfo()
// Append resource load progress to caption
C4Client *pClient = GetClient();
auto *pNetClient = GetNetClient();
if (pClient && !pClient->isLocal()) // Do not show progress for local client
if (pClient && !pClient->isLocal()) // Do not show progress for local client
{
StdStrBuf sCaption;
if (pNetClient->isConnected())
Expand Down
2 changes: 0 additions & 2 deletions src/C4StartupAboutDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ C4StartupAboutDlg::C4StartupAboutDlg() : C4StartupDlg(LoadResStr("IDS_DLG_ABOUT"

C4StartupAboutDlg::~C4StartupAboutDlg() = default;


std::pair<C4GUI::TextWindow*, C4GUI::Label*> C4StartupAboutDlg::DrawPersonList(PersonList& persons, const char* title, C4Rect& rect, uint8_t flags)
{
CStdFont &rUseFont = C4GUI::GetRes()->TextFont;
Expand Down Expand Up @@ -333,7 +332,6 @@ void C4StartupAboutDlg::DrawElement(C4FacetEx &cgo)
C4Startup::Get()->Graphics.fctAboutBG.Draw(cgo, false);
}


void C4StartupAboutDlg::SwitchPage(uint32_t number)
{
currentPage = number;
Expand Down
Loading

0 comments on commit 7b14426

Please sign in to comment.