From 87be032adc82d4a66cba7c096b5241c1ef2c7ecc Mon Sep 17 00:00:00 2001 From: Ted John Date: Sun, 19 Feb 2017 21:37:06 +0000 Subject: [PATCH] Space out sections when writing config.ini --- src/openrct2/config/IniWriter.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/openrct2/config/IniWriter.cpp b/src/openrct2/config/IniWriter.cpp index bfee401403..04856ca677 100644 --- a/src/openrct2/config/IniWriter.cpp +++ b/src/openrct2/config/IniWriter.cpp @@ -22,7 +22,8 @@ class IniWriter final : public IIniWriter { private: - FileStream _fs; + FileStream _fs; + bool _firstSection = false; public: IniWriter(const std::string &path) @@ -32,6 +33,12 @@ public: void WriteSection(const std::string &name) override { + if (!_firstSection) + { + WriteLine(); + } + _firstSection = false; + WriteLine("[" + name + "]"); } @@ -78,10 +85,15 @@ private: WriteLine(name + " = " + value); } + void WriteLine() + { + _fs.Write(PLATFORM_NEWLINE, String::SizeOf(PLATFORM_NEWLINE)); + } + void WriteLine(const std::string &line) { _fs.Write(line.c_str(), line.size()); - _fs.Write(PLATFORM_NEWLINE, String::SizeOf(PLATFORM_NEWLINE)); + WriteLine(); } };