Skip to content

Commit eb404b3

Browse files
committed
style: improve code formatting and consistency across multiple files
1 parent 1597b21 commit eb404b3

File tree

7 files changed

+19
-18
lines changed

7 files changed

+19
-18
lines changed

src/Area/Area.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class Area {
1313

1414
public:
1515
Area(int a1, int a2, int b1, int b2, string name);
16-
Area(Area &tmp);
17-
bool operator==(Area tmp);
16+
Area(Area& tmp);
17+
bool operator==(Area tmp);
1818
bool checkInArea(int x, int y);
1919
string getName();
2020

@@ -35,7 +35,6 @@ class AreaList {
3535
AreaList(int c = 10);
3636
bool addArea(Area a);
3737
Area* search(string name);
38-
3938
};
4039

4140
#endif

src/Location/Location.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ string Point::getStr() {
4343
}
4444

4545
int Point::getDistance(Point temp) {
46-
return pow((x - temp.getX()) , 2) + pow((y - temp.getY()) , 2);
46+
return pow((x - temp.getX()), 2) + pow((y - temp.getY()), 2);
4747
}

src/Location/Location.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
#ifndef LOCATION_H
33
#define LOCATION_H
44

5-
#include <string>
65
#include <cmath>
6+
#include <string>
7+
78
#include "debug.h"
89
using namespace std;
910

src/Main/debug.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ using namespace std;
1212

1313
#if DEBUG
1414

15-
#define log2(X, Y) \
15+
#define log2(X, Y) \
1616
cout << Color_Gray << "LOG >>> " << X << ": " << Y << Color_Reset \
1717
<< endl;
1818

19-
#define log3(X, Y, Z) \
19+
#define log3(X, Y, Z) \
2020
cout << Color_Gray << "LOG >>> " << X << ": " << Y << ", " << Z \
2121
<< Color_Reset << endl;
2222

23-
#define Err2(X, Y) \
23+
#define Err2(X, Y) \
2424
cout << Color_Red << "Err >>> " << Color_Reset << X << ": " << Y \
2525
<< endl;
2626

27-
#define Err3(X, Y, Z) \
27+
#define Err3(X, Y, Z) \
2828
cout << Color_Red << "Err >>> " << Color_Reset << X << ": " << Y ", " \
2929
<< Z << endl;
3030

src/Main/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
int main() {
44

5-
// create a db for Branchs
5+
// create a db for Branch's
66
pizzaDataBase* db = new pizzaDataBase;
77
AreaList* l = new AreaList;
88
KDTree* ap = new KDTree;

src/PizzaBranch/kdTree.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -631,22 +631,21 @@ branch* KDTree::findNearstBranchFilter(Point t, string main_name) {
631631
return NULL;
632632
}
633633

634-
void KDTree::helpFindInRadius(Point t, int r, treeNode* root, int depth, vector<branch*>* vec) {
634+
void KDTree::helpFindInRadius(Point t, int r, treeNode* root, int depth,
635+
vector<branch*>* vec) {
635636

636637
if (root == NULL) return;
637638

638-
if (t.getDistance(root->getPoint()) <= pow(r,2)){
639+
if (t.getDistance(root->getPoint()) <= pow(r, 2)) {
639640
vec->push_back(root->getNode());
640641
}
641642

642643
int root_x = root->getPoint().getX();
643644
int root_y = root->getPoint().getY();
644645

645-
646646
helpFindInRadius(t, r, root->getLeft(), ++depth, vec);
647647

648648
helpFindInRadius(t, r, root->getRight(), ++depth, vec);
649-
650649
}
651650

652651
vector<branch*> KDTree::findInRadius(Point t, int r) {

src/PizzaBranch/kdTree.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,15 @@ class KDTree {
7272

7373
treeNode* helpFindNearstBranch(Point t, treeNode* root, treeNode* near,
7474
int depth);
75-
76-
treeNode* helpFindNearstBranchFilter(Point t, treeNode* root, treeNode* near,
77-
int depth, string name);
75+
76+
treeNode* helpFindNearstBranchFilter(Point t, treeNode* root,
77+
treeNode* near, int depth,
78+
string name);
7879

7980
int checkOtherBr(Point t, treeNode* root, int depth);
8081

81-
void helpFindInRadius(Point t, int r, treeNode* root, int depth, vector<branch*>* vec);
82+
void helpFindInRadius(Point t, int r, treeNode* root, int depth,
83+
vector<branch*>* vec);
8284

8385
public:
8486
KDTree();

0 commit comments

Comments
 (0)