From 60841c1d96073b0adbb687f29dfc059619ad3919 Mon Sep 17 00:00:00 2001 From: Lukas Werling Date: Tue, 19 Feb 2019 15:28:12 +0100 Subject: [PATCH] Write text files with unix file endings The old LineFeed constant caused problems with Qt. Using \n directly is easier and I don't think there's a reason left to use \r\n anyways. We've always converted the files in the repository. Nowadays, even notepad.exe works with unix file endings. --- src/control/C4GameSave.cpp | 4 ++-- src/editor/C4ConsoleQt.h | 1 - src/graphics/C4DrawGLCtx.cpp | 1 - src/landscape/C4Material.cpp | 4 ++-- src/landscape/C4Texture.cpp | 12 ++++++------ src/lib/Standard.h | 2 -- src/lib/StdCompiler.cpp | 6 +++--- src/object/C4Object.cpp | 18 +++++++++--------- src/platform/PlatformAbstraction.cpp | 1 - 9 files changed, 22 insertions(+), 27 deletions(-) diff --git a/src/control/C4GameSave.cpp b/src/control/C4GameSave.cpp index 5d6cab8fd..cece02a49 100644 --- a/src/control/C4GameSave.cpp +++ b/src/control/C4GameSave.cpp @@ -239,7 +239,7 @@ bool C4GameSave::SaveDesc(C4Group &hToGroup) // Scenario title sBuffer.Append(Game.ScenarioTitle.getData()); - sBuffer.Append(LineFeed LineFeed); + sBuffer.Append("\n\n"); // OK; each specializations has its own desc format WriteDesc(sBuffer); @@ -256,7 +256,7 @@ bool C4GameSave::SaveDesc(C4Group &hToGroup) void C4GameSave::WriteDescLineFeed(StdStrBuf &sBuf) { // paragraph end + cosmetics - sBuf.Append(LineFeed LineFeed); + sBuf.Append("\n\n"); } void C4GameSave::WriteDescDate(StdStrBuf &sBuf, bool fRecord) diff --git a/src/editor/C4ConsoleQt.h b/src/editor/C4ConsoleQt.h index dd297e4ef..274907330 100644 --- a/src/editor/C4ConsoleQt.h +++ b/src/editor/C4ConsoleQt.h @@ -22,7 +22,6 @@ #ifdef WITH_QT_EDITOR // Avoid some name conflicts -#undef LineFeed #undef new #undef delete // disable OPENGL_ES diff --git a/src/graphics/C4DrawGLCtx.cpp b/src/graphics/C4DrawGLCtx.cpp index 8a7eded66..02a782b55 100644 --- a/src/graphics/C4DrawGLCtx.cpp +++ b/src/graphics/C4DrawGLCtx.cpp @@ -528,7 +528,6 @@ bool CStdGLCtx::PageFlip() #endif // USE_* #ifdef WITH_QT_EDITOR -#undef LineFeed // conflicts with Qt #undef new #undef delete #include diff --git a/src/landscape/C4Material.cpp b/src/landscape/C4Material.cpp index e05acb2b0..69c3696c0 100644 --- a/src/landscape/C4Material.cpp +++ b/src/landscape/C4Material.cpp @@ -575,11 +575,11 @@ bool C4MaterialMap::SaveEnumeration(C4Group &hGroup) { char *mapbuf = new char [1000]; mapbuf[0]=0; - SAppend("[Enumeration]",mapbuf); SAppend(LineFeed,mapbuf); + SAppend("[Enumeration]",mapbuf); SAppend("\n",mapbuf); for (int32_t cnt=0; cntName.getData()); + Buf.AppendFormat("[%s]\n", pNaming->Name.getData()); else Buf.AppendFormat("%s=", pNaming->Name.getData()); // Set flag diff --git a/src/object/C4Object.cpp b/src/object/C4Object.cpp index 2f1e4792e..f2790456e 100644 --- a/src/object/C4Object.cpp +++ b/src/object/C4Object.cpp @@ -1633,38 +1633,38 @@ StdStrBuf C4Object::GetDataString() // Owner if (ValidPlr(Owner)) { - Output.Append(LineFeed); + Output.Append("\n"); Output.AppendFormat(LoadResStr("IDS_CNS_OWNER"),::Players.Get(Owner)->GetName()); } // Contents if (Contents.ObjectCount()) { - Output.Append(LineFeed); + Output.Append("\n"); Output.Append(LoadResStr("IDS_CNS_CONTENTS")); Output.Append(Contents.GetNameList(::Definitions)); } // Action if (GetAction()) { - Output.Append(LineFeed); + Output.Append("\n"); Output.Append(LoadResStr("IDS_CNS_ACTION")); Output.Append(GetAction()->GetName()); } // Properties - Output.Append(LineFeed); + Output.Append("\n"); Output.Append(LoadResStr("IDS_CNS_PROPERTIES")); - Output.Append(LineFeed " "); - AppendDataString(&Output, LineFeed " "); + Output.Append("\n "); + AppendDataString(&Output, "\n "); // Effects if (pEffects) { - Output.Append(LineFeed); + Output.Append("\n"); Output.Append(LoadResStr("IDS_CNS_EFFECTS")); Output.Append(": "); } for (C4Effect *pEffect = pEffects; pEffect; pEffect = pEffect->pNext) { - Output.Append(LineFeed); + Output.Append("\n"); // Effect name Output.AppendFormat(" %s: Priority %d, Interval %d", pEffect->GetName(), pEffect->iPriority, pEffect->iInterval); } @@ -1674,7 +1674,7 @@ StdStrBuf C4Object::GetDataString() DecompileToBuf_Log(mkNamingAdapt(mkInsertAdapt(mkParAdapt(*this, &numbers), mkNamingAdapt(numbers, "Values"), false), "Object"), &Output2, "C4Object::GetDataString"); - Output.Append(LineFeed); + Output.Append("\n"); Output.Append(Output2); return Output; } diff --git a/src/platform/PlatformAbstraction.cpp b/src/platform/PlatformAbstraction.cpp index 2f4828d9b..20b591186 100644 --- a/src/platform/PlatformAbstraction.cpp +++ b/src/platform/PlatformAbstraction.cpp @@ -65,7 +65,6 @@ bool EraseItemSafe(const char *szFilename) } #if defined(WITH_QT_EDITOR) -#undef LineFeed #include #include bool OpenURL(char const* url)