Skip to content

Commit

Permalink
Clean-up (iterators to for..each, autoboxing, etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
rumour committed Apr 30, 2012
1 parent ff146b5 commit 16008fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
21 changes: 10 additions & 11 deletions src/org/gamehost/jtrek/javatrek/TrekBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public abstract class TrekBot extends TrekPlayer {
/**
* An abstract class for Bot functionality.
*
* @param serverIn
* @param shipNameIn
* @param serverIn - the trek server to attach the bot to
* @param shipNameIn - the name of the bot ship
*/
public TrekBot(TrekServer serverIn, String shipNameIn) {
try {
Expand Down Expand Up @@ -113,20 +113,19 @@ public void runMacro(String theMacro) {
char[] commands = theMacro.toCharArray();

TrekLog.logDebug(this.shipName + ": Running macro: " + new String(commands));
//System.out.println(this.shipName + ": Running macro: " + new String(commands).toString());

for (int m = 0; m < commands.length; m++) {
for (char command : commands) {

// If there is a backslash, then process the octal code.
if (Character.toString(commands[m]).equals("\\")) {
if (Character.toString(command).equals("\\")) {
octalCode = true;
}

if (octalCode) {
if (!Character.toString(commands[m]).equals("\\")) {
if (!Character.toString(command).equals("\\")) {

if (commands[m] >= 48 && commands[m] <= 57 || commands[m] == 114) {
this.actualOctalCode += Character.toString(commands[m]);
if (command >= 48 && command <= 57 || command == 114) {
this.actualOctalCode += Character.toString(command);
this.octalCount++;
} else {
actualOctalCode = "";
Expand All @@ -152,10 +151,10 @@ public void runMacro(String theMacro) {
actualOctalCode = "";
}
} else {
TrekLog.logDebug("Not an octal. Command: " + commands[m]);
TrekLog.logDebug("Not an octal. Command: " + command);

if (commands[m] != 0) {
doCommand(commands[m]);
if (command != 0) {
doCommand(command);
actualOctalCode = "";
this.octalCount = 0;
this.octalCode = false;
Expand Down
9 changes: 3 additions & 6 deletions src/org/gamehost/jtrek/javatrek/TrekSpatialAnomaly.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@
* User: Jay
* Date: Feb 2, 2005
* Time: 6:58:26 PM
* To change this template use File | Settings | File Templates.
*/
public class TrekSpatialAnomaly extends TrekWormhole {
int regenTime = 300000; // 5 minutes in millis
private int counterStart;

public TrekSpatialAnomaly(int x, int y, int z, String name, String scanletter) {
super(x, y, z, name, scanletter);
public TrekSpatialAnomaly(int x, int y, int z, String name, String scanLetter) {
super(x, y, z, name, scanLetter);
targetQuadrant = "";
activeCountdown = 180;
counterStart = activeCountdown;
Expand Down Expand Up @@ -92,7 +91,6 @@ protected void doTick() {
currentQuadrant.removeObjectByScanLetter(scanLetter);
regenTime = Math.abs(gen.nextInt() % 900000) + 300000; // from 5 to 20 minutes to respawn
}

}

protected String getTargetQuadrant(TrekShip targetShip) {
Expand All @@ -106,5 +104,4 @@ protected String getTargetQuadrant(TrekShip targetShip) {

return returnQuadrant;
}

}
}

0 comments on commit 16008fe

Please sign in to comment.