Skip to content

Commit 4b0831f

Browse files
committed
Reformat code
1 parent e5739a8 commit 4b0831f

8 files changed

Lines changed: 29 additions & 20 deletions

File tree

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SortIncludes: Never

.idea/misc.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Chart.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ class ChartMeta {
6262

6363
[[nodiscard]] int GetKeyLaneCount() const { return KeyMode; }
6464
[[nodiscard]] int GetScratchLaneCount() const { return IsDP ? 2 : 1; }
65-
[[nodiscard]] int GetTotalLaneCount() const { return KeyMode + GetScratchLaneCount(); }
65+
[[nodiscard]] int GetTotalLaneCount() const {
66+
return KeyMode + GetScratchLaneCount();
67+
}
6668

6769
[[nodiscard]] std::vector<int> GetKeyLaneIndices() const {
6870
switch (KeyMode) {

src/Parser.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ inline bool Parser::MatchHeader(const std::string_view &str,
105105
return true;
106106
}
107107

108-
void Parser::Parse(const std::filesystem::path& fpath, Chart **chart,
108+
void Parser::Parse(const std::filesystem::path &fpath, Chart **chart,
109109
bool addReadyMeasure, bool metaOnly,
110110
std::atomic_bool &bCancelled) {
111111
#if BMS_PARSER_VERBOSE == 1
@@ -503,7 +503,9 @@ void Parser::Parse(const std::vector<unsigned char> &bytes, Chart **chart,
503503
const auto g = Gcd(j, dataCount);
504504
// ReSharper disable PossibleLossOfFraction
505505

506-
const auto position = static_cast<double>(j / g) / static_cast<double>(dataCount / g); // NOLINT(*-integer-division)
506+
const auto position =
507+
static_cast<double>(j / g) /
508+
static_cast<double>(dataCount / g); // NOLINT(*-integer-division)
507509

508510
if (timelines.find(position) == timelines.end()) {
509511
timelines[position] = new TimeLine(TempKey, metaOnly);
@@ -667,17 +669,17 @@ void Parser::Parse(const std::vector<unsigned char> &bytes, Chart **chart,
667669

668670
break;
669671
case P1MineKeyBase: {
670-
// landmine
671-
++totalLandmineNotes;
672-
if (metaOnly) {
673-
break;
674-
}
675-
const auto damage = static_cast<float>(ParseInt(val, true)) / 2.0f;
676-
timeline->SetNote(laneNumber, new LandmineNote{damage});
672+
// landmine
673+
++totalLandmineNotes;
674+
if (metaOnly) {
677675
break;
676+
}
677+
const auto damage = static_cast<float>(ParseInt(val, true)) / 2.0f;
678+
timeline->SetNote(laneNumber, new LandmineNote{damage});
679+
break;
678680
}
679681
default:
680-
break;
682+
break;
681683
}
682684
}
683685
}
@@ -859,7 +861,7 @@ void Parser::ParseHeader(Chart *Chart, std::string_view cmd,
859861
}
860862
StopLengthTable[id] = std::strtod(Value.c_str(), nullptr);
861863
} else if (MatchHeader(cmd, "MIDIFILE")) {
862-
// TODO: handle this
864+
// TODO: handle this
863865
} else if (MatchHeader(cmd, "VIDEOFILE")) {
864866
} else if (MatchHeader(cmd, "PLAYLEVEL")) {
865867
Chart->Meta.PlayLevel =
@@ -923,7 +925,8 @@ void Parser::ParseHeader(Chart *Chart, std::string_view cmd,
923925
}
924926
}
925927

926-
inline unsigned long long Parser::Gcd(unsigned long long A, unsigned long long B) {
928+
inline unsigned long long Parser::Gcd(unsigned long long A,
929+
unsigned long long B) {
927930
while (true) {
928931
if (B == 0) {
929932
return A;

src/Parser.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class Parser {
3131
Parser();
3232
void SetRandomSeed(unsigned int RandomSeed);
3333

34-
void Parse(const std::filesystem::path& path, Chart **Chart, bool addReadyMeasure,
35-
bool metaOnly, std::atomic_bool &bCancelled);
34+
void Parse(const std::filesystem::path &path, Chart **Chart,
35+
bool addReadyMeasure, bool metaOnly, std::atomic_bool &bCancelled);
3636
~Parser();
3737
void Parse(const std::vector<unsigned char> &bytes, Chart **chart,
3838
bool addReadyMeasure, bool metaOnly, std::atomic_bool &bCancelled);
@@ -54,8 +54,9 @@ class Parser {
5454
void ParseHeader(Chart *Chart, std::string_view cmd, std::string_view Xx,
5555
const std::string &Value);
5656
static inline bool MatchHeader(const std::string_view &str,
57-
const std::string_view &headerUpper);
58-
static inline unsigned long long Gcd(unsigned long long A, unsigned long long B);
57+
const std::string_view &headerUpper);
58+
static inline unsigned long long Gcd(unsigned long long A,
59+
unsigned long long B);
5960
inline bool CheckResourceIdRange(int Id) const;
6061
inline int ToWaveId(Chart *Chart, std::string_view Wav, bool metaOnly);
6162
};

src/SHA256.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include <string>
33
#include <vector>
44

5-
65
// http://www.zedwood.com/article/cpp-sha256-function
76
namespace bms_parser {
87
class SHA256 {

src/TimeLine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class TimeLine {
4444
double Pos = 0;
4545

4646
explicit TimeLine(int lanes, bool metaOnly);
47-
47+
4848
TimeLine *SetNote(int lane, Note *note);
4949

5050
TimeLine *SetInvisibleNote(int lane, Note *note);

src/md5.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class MD5 {
6464
void init();
6565
typedef unsigned char uint1; // 8bit
6666
typedef unsigned int uint4; // 32bit
67-
enum { blocksize = 64 }; // VC6 won't eat a const static int here
67+
enum { blocksize = 64 }; // VC6 won't eat a const static int here
6868

6969
void transform(const uint1 block[blocksize]);
7070
static void decode(uint4 output[], const uint1 input[], size_type len);

0 commit comments

Comments
 (0)