Skip to content

Commit

Permalink
style: improve code formatting and consistency across multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-MRF-Dev committed Jan 16, 2025
1 parent 1597b21 commit eb404b3
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
5 changes: 2 additions & 3 deletions src/Area/Area.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Area {

public:
Area(int a1, int a2, int b1, int b2, string name);
Area(Area &tmp);
bool operator==(Area tmp);
Area(Area& tmp);
bool operator==(Area tmp);
bool checkInArea(int x, int y);
string getName();

Expand All @@ -35,7 +35,6 @@ class AreaList {
AreaList(int c = 10);
bool addArea(Area a);
Area* search(string name);

};

#endif
2 changes: 1 addition & 1 deletion src/Location/Location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ string Point::getStr() {
}

int Point::getDistance(Point temp) {
return pow((x - temp.getX()) , 2) + pow((y - temp.getY()) , 2);
return pow((x - temp.getX()), 2) + pow((y - temp.getY()), 2);
}
3 changes: 2 additions & 1 deletion src/Location/Location.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#ifndef LOCATION_H
#define LOCATION_H

#include <string>
#include <cmath>
#include <string>

#include "debug.h"
using namespace std;

Expand Down
8 changes: 4 additions & 4 deletions src/Main/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ using namespace std;

#if DEBUG

#define log2(X, Y) \
#define log2(X, Y) \
cout << Color_Gray << "LOG >>> " << X << ": " << Y << Color_Reset \
<< endl;

#define log3(X, Y, Z) \
#define log3(X, Y, Z) \
cout << Color_Gray << "LOG >>> " << X << ": " << Y << ", " << Z \
<< Color_Reset << endl;

#define Err2(X, Y) \
#define Err2(X, Y) \
cout << Color_Red << "Err >>> " << Color_Reset << X << ": " << Y \
<< endl;

#define Err3(X, Y, Z) \
#define Err3(X, Y, Z) \
cout << Color_Red << "Err >>> " << Color_Reset << X << ": " << Y ", " \
<< Z << endl;

Expand Down
2 changes: 1 addition & 1 deletion src/Main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

int main() {

// create a db for Branchs
// create a db for Branch's
pizzaDataBase* db = new pizzaDataBase;
AreaList* l = new AreaList;
KDTree* ap = new KDTree;
Expand Down
7 changes: 3 additions & 4 deletions src/PizzaBranch/kdTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,22 +631,21 @@ branch* KDTree::findNearstBranchFilter(Point t, string main_name) {
return NULL;
}

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

if (root == NULL) return;

if (t.getDistance(root->getPoint()) <= pow(r,2)){
if (t.getDistance(root->getPoint()) <= pow(r, 2)) {
vec->push_back(root->getNode());
}

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


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

helpFindInRadius(t, r, root->getRight(), ++depth, vec);

}

vector<branch*> KDTree::findInRadius(Point t, int r) {
Expand Down
10 changes: 6 additions & 4 deletions src/PizzaBranch/kdTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ class KDTree {

treeNode* helpFindNearstBranch(Point t, treeNode* root, treeNode* near,
int depth);

treeNode* helpFindNearstBranchFilter(Point t, treeNode* root, treeNode* near,
int depth, string name);

treeNode* helpFindNearstBranchFilter(Point t, treeNode* root,
treeNode* near, int depth,
string name);

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

void helpFindInRadius(Point t, int r, treeNode* root, int depth, vector<branch*>* vec);
void helpFindInRadius(Point t, int r, treeNode* root, int depth,
vector<branch*>* vec);

public:
KDTree();
Expand Down

0 comments on commit eb404b3

Please sign in to comment.