Skip to content

Commit

Permalink
Merge pull request #6 from BME-MIT-IET/manual-and-sonarcloud-review
Browse files Browse the repository at this point in the history
Manual and sonarcloud review
  • Loading branch information
ErikSkare authored May 19, 2024
2 parents 081611f + 296d3e7 commit 179db39
Show file tree
Hide file tree
Showing 20 changed files with 404 additions and 403 deletions.
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"vscjava.vscode-java-pack",
"SonarSource.sonarlint-vscode"
]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"sonarlint.connectedMode.project": {
"connectionId": "bme-mit-iet-org",
"projectKey": "BME-MIT-IET_iet-hf-2024-nomad-szabotorok"
}
},
"java.configuration.updateBuildConfiguration": "interactive"
}
6 changes: 2 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
<version>1.0-SNAPSHOT</version>

<name>pipe_game</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<sonar.organization>bme-mit-iet-org</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>
Expand Down
34 changes: 17 additions & 17 deletions src/main/java/hu/bme/mit/iet/pipe_game/Cistern.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class Cistern extends SystemPart {
private boolean hasPipe = false;
private int pCount = 0;
private int timeLeft = 2;
private Random rand = new Random();

/**
* Konstruktor, ami beállítja az id-t az osztály nevére és egy eltérő számra
Expand All @@ -39,13 +40,13 @@ public Cistern() {
* A csőnek mindkét szomszégjának magát állítja be,
* hogy ne legyen szabad és ne folyon ki belőle a víz
*/
public void CreatePipe() {
public void createPipe() {
Pipe p = new Pipe();
Control.AddPipe(p);
p.AddNeighbour(this);
p.AddNeighbour(this);
AddNeighbour(p);
AddNeighbour(p);
Control.addPipe(p);
p.addNeighbour(this);
p.addNeighbour(this);
addNeighbour(p);
addNeighbour(p);
pipe = p;
hasPipe = true;
pCount++;
Expand All @@ -54,17 +55,17 @@ public void CreatePipe() {
/**
* Létrehoz egy új pumpát és eltárolja azt a tagváltozójába
*/
public void CreatePump() {
public void createPump() {
pump = new Pump();
Control.AddPump(pump);
Control.addPump(pump);
}

/**
* A tagváltozóban eltárolt pumpa felvétele
* @return visszadjuk a pumpát
*/
@Override
public Pump CarryPump() {
public Pump carryPump() {

Pump p = pump;
pump = null;
Expand All @@ -78,12 +79,12 @@ public Pump CarryPump() {
* @return visszadja hogy mennyi vizet gyűjtött össze
*/
@Override
public int PullWater() {
public int pullWater() {

int points = 0;
for (SystemPart pipe: neighbours) {
points += pipe.getWater();
pipe.setWater(0);
for (SystemPart _pipe: neighbours) {
points += _pipe.getWater();
_pipe.setWater(0);
}
return points;
}
Expand All @@ -92,16 +93,15 @@ public int PullWater() {
* A control minden körben meghívja,
* ha letelik az idő akkor generál egy pumpát vagy csövet
*/
public void Generate() {
Random rand = new Random();
public void generate() {
int coin = rand.nextInt(2);

if (--timeLeft == 0) {
if (coin == 1 ) {
CreatePump();
createPump();
}
else {
CreatePipe();
createPipe();
}
timeLeft = 2;
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/hu/bme/mit/iet/pipe_game/CisternView.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public CisternView(View view, Cistern cistern) {
* frissíti a part JButtont a jelenlegi állapotoknak megfelelően
*/
@Override
public void Update() {
public void update() {
button.setBounds(x,y,50,50);
button.setBackground(Color.RED);

Expand All @@ -42,7 +42,7 @@ public void Update() {
*/
view.getPanel().remove(button);

while (players.size() > 0){
while (!players.isEmpty()){
view.getPanel().remove(players.get(0));
players.remove(0);
}
Expand Down Expand Up @@ -79,6 +79,7 @@ public void Update() {
* getter fügvény ID-re
* @return ID-t adja vissza
*/
@Override
public String getID(){
return cistern.getId();
}
Expand Down
Loading

0 comments on commit 179db39

Please sign in to comment.