reformatted code

This commit is contained in:
Bokros Bálint 2016-04-24 23:01:34 +02:00
parent d0d656452c
commit 1ab13398bb
19 changed files with 365 additions and 382 deletions

View File

@ -1,7 +1,6 @@
package cicaprojekt; package cicaprojekt;
public class Box implements Pickable, Destroyable public class Box implements Pickable, Destroyable {
{
private int weight = 5; private int weight = 5;

View File

@ -3,12 +3,10 @@ package cicaprojekt;
import java.io.*; import java.io.*;
public class Dungeon { public class Dungeon {
cicaprojekt.Tile buildDungeon(File input) throws IOException cicaprojekt.Tile buildDungeon(File input) throws IOException {
{
Tile oneilllocation = null; Tile oneilllocation = null;
Tile jaffalocation = null; Tile jaffalocation = null;
try(BufferedReader reader = new BufferedReader(new FileReader(input))) try (BufferedReader reader = new BufferedReader(new FileReader(input))) {
{
String[] sizedata = reader.readLine().split("x"); // read size data at beginning of file String[] sizedata = reader.readLine().split("x"); // read size data at beginning of file
reader.readLine(); // throw empty line away reader.readLine(); // throw empty line away
int width = Integer.parseInt(sizedata[0]); int width = Integer.parseInt(sizedata[0]);
@ -19,11 +17,9 @@ public class Dungeon {
String line = null; String line = null;
Gate gate = new Gate(); Gate gate = new Gate();
Gate lastgate = gate; Gate lastgate = gate;
for (int y = 0; y < height; ++y) for (int y = 0; y < height; ++y) {
{
line = reader.readLine().replaceAll("\\s", ""); // read line and remove whitespaces line = reader.readLine().replaceAll("\\s", ""); // read line and remove whitespaces
for (int x = 0; x < width; ++x) for (int x = 0; x < width; ++x) {
{
switch (line.charAt(x)) // set the dungeon up switch (line.charAt(x)) // set the dungeon up
{ {
case 'W': case 'W':
@ -74,10 +70,8 @@ public class Dungeon {
// NOTE: code seems to be correct till this point based on a debugger run-through // NOTE: code seems to be correct till this point based on a debugger run-through
/* setting up Tile cross references */ /* setting up Tile cross references */
for (int y = 0; y < height; ++y) for (int y = 0; y < height; ++y) {
{ for (int x = 0; x < width; ++x) {
for (int x = 0; x < width; ++x)
{
if (x - 1 >= 0) // leftwards Tile reference if (x - 1 >= 0) // leftwards Tile reference
dungeon[y][x].setAdajacentTile(dungeon[y][x - 1], Direction.WEST); dungeon[y][x].setAdajacentTile(dungeon[y][x - 1], Direction.WEST);
else else

View File

@ -3,8 +3,7 @@ package cicaprojekt;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class Field extends cicaprojekt.Tile public class Field extends cicaprojekt.Tile {
{
private static int recursionLimit = 0; private static int recursionLimit = 0;

View File

@ -8,7 +8,6 @@ public class FlowOfTime extends Timer{
private long gametime; private long gametime;
public void start() public void start() {
{
} }
} }

View File

@ -2,9 +2,12 @@ package cicaprojekt;
public class Game { public class Game {
private Player oneill; private Player oneill;
private Dungeon dungeon; private Dungeon dungeon;
private FlowOfTime flowoftime; private FlowOfTime flowoftime;
public static void main(String[] args) {
}
public void allZPMsCollected() { public void allZPMsCollected() {
this.stopGame(); this.stopGame();
@ -15,6 +18,4 @@ public class Game {
public void stopGame() { public void stopGame() {
} }
public static void main(String[] args) {}
} }

View File

@ -1,7 +1,6 @@
package cicaprojekt; package cicaprojekt;
public class Gap extends cicaprojekt.Tile public class Gap extends cicaprojekt.Tile {
{
public Gap() { public Gap() {
super(); super();
} }

View File

@ -1,7 +1,6 @@
package cicaprojekt; package cicaprojekt;
public class Gate extends Tile public class Gate extends Tile {
{
private boolean open = false; private boolean open = false;
public Gate() { public Gate() {
@ -15,8 +14,7 @@ public class Gate extends Tile
public void onEntry(PlayerBase playerBase) { public void onEntry(PlayerBase playerBase) {
if (open) { if (open) {
playerBase.setCurrentTile(this); playerBase.setCurrentTile(this);
} } else
else
return; return;
} }

View File

@ -7,13 +7,11 @@ public class Menu {
public static String tabulator = "\t"; public static String tabulator = "\t";
public static void addTab() public static void addTab() {
{
tabulator += '\t'; tabulator += '\t';
} }
public static void removeTab() public static void removeTab() {
{
tabulator = tabulator.substring(0, tabulator.length() - 1); tabulator = tabulator.substring(0, tabulator.length() - 1);
} }

View File

@ -24,8 +24,7 @@ public class Player extends PlayerBase{
} }
@Override @Override
public void pickZPM(Tile tile) public void pickZPM(Tile tile) {
{
zpmContainer.add(tile.getZPMFromTile()); zpmContainer.add(tile.getZPMFromTile());
} }

View File

@ -6,7 +6,8 @@ public class PlayerBase implements Destroyable{
protected Direction facingDirection; protected Direction facingDirection;
public void destroy() {} public void destroy() {
}
public Tile getCurrentTile() { public Tile getCurrentTile() {
return currentTile; return currentTile;

View File

@ -1,14 +1,12 @@
package cicaprojekt; package cicaprojekt;
public class Stargate { public class Stargate {
private boolean isSpawned;
public static final Stargate yellowStargate = new Stargate(); public static final Stargate yellowStargate = new Stargate();
public static final Stargate blueStargate = new Stargate(); public static final Stargate blueStargate = new Stargate();
public static final Stargate redStargate = new Stargate(); public static final Stargate redStargate = new Stargate();
public static final Stargate greenStargate = new Stargate(); public static final Stargate greenStargate = new Stargate();
public /*final*/ Stargate other; //TODO find better ways to do this public /*final*/ Stargate other; //TODO find better ways to do this
private boolean isSpawned;
private Wall currentWall; private Wall currentWall;

View File

@ -21,8 +21,7 @@ public class Wall extends Tile {
public void onEntry(PlayerBase playerBase) { public void onEntry(PlayerBase playerBase) {
if (sg == null) { if (sg == null) {
return; return;
} } else {
else {
sg.teleport(playerBase.facingDirection); sg.teleport(playerBase.facingDirection);
} }
} }

View File

@ -1,7 +1,6 @@
package cicaprojekt; package cicaprojekt;
public class ZPM implements Pickable public class ZPM implements Pickable {
{
public void pick() { public void pick() {
} }