Skip to content

Commit 7db0a01

Browse files
Fixed Naval Robocode versioning so that the newest version can be checked via Internet and compared to current installed version.
The first line of naval-robocode-versions.md will control the current version of Naval Robocode similar to classic Robocode versions.md file. The version was set to version 0.9.2 in the profiles.xml file. 'Naval Robocode' is written in the titles instead of 'Robocode'. But not everywhere.
1 parent 2f41894 commit 7db0a01

File tree

9 files changed

+31
-31
lines changed

9 files changed

+31
-31
lines changed

naval-robocode-versions.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
## Naval Robocode Version 0.9.3 (28-Feb-2015)
2-
3-
### Bug fixes
4-
* Now able to use naval-robocode.bat to start Naval Robocode
5-
* Fixed a few UnitTests that fell short due to a few missing classes
6-
7-
## Naval Robocode Version 0.9.2 (24-Feb-2015)
1+
## Naval Robocode Version 0.9.2 (28-Feb-2015)
82

93
### Changes
104
* Merged all changes with Naval Robocode with Robocode 1.9.2.4 (newest version).
115
* Flemming clean-up and Naval Robocode specification
6+
* Now able to use naval-robocode.bat to start Naval Robocode
7+
* Fixed a few UnitTests that fell short due to a few missing classes
128

139
### Bug fixes
1410
* Mines now have a blast Radius. (See NavalRules)

robocode.api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
3535
</execution>
3636
</executions>
3737
<configuration>
38-
<windowtitle>Robocode ${project.version} API</windowtitle>
38+
<windowtitle>Naval Robocode ${project.version} API</windowtitle>
3939
<docfilessubdirs>true</docfilessubdirs>
4040
<doctitle>
4141
<![CDATA[<h1>Robocode ${project.version} API</h1>]]>

robocode.core/src/main/java/net/sf/robocode/version/VersionManager.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*/
3030
public final class VersionManager implements IVersionManager {
3131

32-
private static final String VERSIONS_TXT = "versions.md";
32+
private static final String VERSIONS_TXT = "naval-robocode-versions.md";
3333
private static final String UNKNOWN_VERSION = "unknown";
3434

3535
private static Version version;
@@ -54,7 +54,7 @@ public String checkForNewVersion() {
5454
BufferedReader reader = null;
5555

5656
try {
57-
URL url = new URL("http://robocode.sourceforge.net/version/version.html");
57+
URL url = new URL("http://robocode.sourceforge.net/version/naval-version.html");
5858

5959
URLConnection urlConnection = url.openConnection();
6060

@@ -135,7 +135,7 @@ private static String getVersionFromJar() {
135135
in = new BufferedReader(new InputStreamReader(is));
136136

137137
versionString = in.readLine();
138-
while (versionString != null && !versionString.startsWith("## Version ")) {
138+
while (versionString != null && !versionString.startsWith("## Naval Robocode Version ")) {
139139
versionString = in.readLine();
140140
}
141141
}
@@ -184,10 +184,10 @@ private static String getVersionFromFile() {
184184

185185
versionString = in.readLine();
186186
} catch (FileNotFoundException e) {
187-
logError("No " + VERSIONS_TXT + " file.");
187+
System.err.println("No " + VERSIONS_TXT + " file.");
188188
versionString = UNKNOWN_VERSION;
189189
} catch (IOException e) {
190-
logError("IO Exception reading " + VERSIONS_TXT, e);
190+
System.err.println("IO Exception reading " + VERSIONS_TXT + "\n" + e.getLocalizedMessage());
191191
versionString = UNKNOWN_VERSION;
192192
} finally {
193193
if (fileReader != null) {
@@ -213,7 +213,7 @@ private static String getVersionFromFile() {
213213
}
214214

215215
private static String versionFileLineToVersion(String versionFileLine) {
216-
String version = versionFileLine.substring("## Version ".length());
216+
String version = versionFileLine.substring("## Naval Robocode Version ".length());
217217

218218
int index = version.indexOf('(');
219219
if (index >= 0) {

robocode.distribution/setup.asm.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,9 @@
9292
<source>../versions.md</source>
9393
<lineEnding>lf</lineEnding> <!-- for Unix/Linux -->
9494
</file>
95+
<file>
96+
<source>../naval-robocode-versions.md</source>
97+
<lineEnding>lf</lineEnding> <!-- for Unix/Linux -->
98+
</file>
9599
</files>
96100
</assembly>

robocode.installer/src/main/java/net/sf/robocode/installer/AutoExtract.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ private static boolean install(File suggestedDir) {
399399

400400
// Create shortcuts and file associations
401401
if (extractor.extract(installDir)) {
402-
extractor.createShortcuts(installDir, "robocode.bat", "Naval Robocode", "Naval Robocode");
402+
extractor.createShortcuts(installDir, "naval-robocode.bat", "Naval Robocode", "Naval Robocode");
403403
extractor.createFileAssociations(installDir);
404404
return true;
405405
}
@@ -467,21 +467,21 @@ private void createShortcuts(File installDir, String runnable, String folder, St
467467
if (createWindowsShortcuts(installDir, runnable, folder, name) == false) {
468468
JOptionPane.showMessageDialog(null,
469469
message + "\n" + "To start Naval Robocode, enter the following at a command prompt:\n" + "cd "
470-
+ installDir.getAbsolutePath() + "\n" + "robocode.bat");
470+
+ installDir.getAbsolutePath() + "\n" + "naval-robocode.bat");
471471
}
472472
} else if (osName.toLowerCase().indexOf("mac") == 0) {
473473
if (osVersion >= 10.1) {
474474
JOptionPane.showMessageDialog(null,
475-
message + "\n" + "To start Naval Robocode, browse to " + installDir + " then double-click robocode.sh\n");
475+
message + "\n" + "To start Naval Robocode, browse to " + installDir + " then double-click naval-robocode.command\n");
476476
} else {
477477
JOptionPane.showMessageDialog(null,
478-
message + "\n" + "To start Naval Robocode, enter the following at a command prompt:\n"
479-
+ installDir.getAbsolutePath() + "/robocode.sh");
478+
message + "\n" + "To start Naval Robocode, enter the following at a shell:\n"
479+
+ installDir.getAbsolutePath() + "/naval-robocode.sh");
480480
}
481481
} else {
482482
JOptionPane.showMessageDialog(null,
483-
message + "\n" + "To start Naval Robocode, enter the following at a command prompt:\n"
484-
+ installDir.getAbsolutePath() + "/robocode.sh");
483+
message + "\n" + "To start Naval Robocode, enter the following at a shell:\n"
484+
+ installDir.getAbsolutePath() + "/naval-robocode.sh");
485485
}
486486
}
487487

@@ -632,7 +632,7 @@ private static String createWindowsRegistryFileAssociation(String installDir, St
632632
sb.append(HKCR).append(progId).append("\\shell]\n");
633633
sb.append(HKCR).append(progId).append("\\shell\\open]\n");
634634
sb.append(HKCR).append(progId).append("\\shell\\open\\command]\n");
635-
sb.append("@=\"").append(getWindowsCmd()).append("\\\"cd \\\"").append(installDir.replaceAll("[\\\\]", "\\\\\\\\")).append("\\\" && robocode.bat ").append(robocodeCmdParam).append(
635+
sb.append("@=\"").append(getWindowsCmd()).append("\\\"cd \\\"").append(installDir.replaceAll("[\\\\]", "\\\\\\\\")).append("\\\" && naval-robocode.bat ").append(robocodeCmdParam).append(
636636
" \\\"%1\\\"\\\"\"\n");
637637

638638
return sb.toString();

robocode.ui/src/main/java/net/sf/robocode/ui/WindowManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public String getDescription() {
230230
}
231231

232232
public void showVersionsTxt() {
233-
showInBrowser("file://" + new File(FileUtil.getCwd(), "").getAbsoluteFile() + File.separator + "versions.md");
233+
showInBrowser("file://" + new File(FileUtil.getCwd(), "").getAbsoluteFile() + File.separator + "naval-robocode-versions.md");
234234
}
235235

236236
public void showHelpApi() {

robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobocodeFrame.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,13 @@ public void takeScreenshot() {
193193
}
194194

195195
private void showLatestVersion(String version) {
196-
JOptionPane.showMessageDialog(this, "You have version " + version + ". This is the latest version of Robocode.",
196+
JOptionPane.showMessageDialog(this, "You have version " + version + ". This is the latest version of Naval Robocode.",
197197
"No update available", JOptionPane.INFORMATION_MESSAGE);
198198
}
199199

200200
private void showNewVersion(String newVersion) {
201201
if (JOptionPane.showConfirmDialog(this,
202-
"Version " + newVersion + " of Robocode is now available. Would you like to download it?",
202+
"Version " + newVersion + " of Naval Robocode is now available. Would you like to download it?",
203203
"Version " + newVersion + " available", JOptionPane.YES_NO_OPTION)
204204
== JOptionPane.YES_OPTION) {
205205
try {
@@ -534,7 +534,7 @@ private JToolBar getToolBar() {
534534
*/
535535
private void initialize() {
536536
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
537-
setTitle("Robocode");
537+
setTitle("Naval Robocode");
538538
setIconImage(ImageUtil.getImage("/net/sf/robocode/ui/icons/robocode-icon.png"));
539539
setResizable(true);
540540
setVisible(false);
@@ -731,7 +731,7 @@ public void windowClosed(WindowEvent e) {
731731
public void windowClosing(WindowEvent e) {
732732
exitOnClose = true;
733733
if (windowManager.isSlave()) {
734-
WindowUtil.message("If you wish to exit Robocode, please exit the program controlling it.");
734+
WindowUtil.message("If you wish to exit Naval Robocode, please exit the program controlling it.");
735735
exitOnClose = false;
736736
return;
737737
}
@@ -926,7 +926,7 @@ public void onTurnEnded(TurnEndedEvent event) {
926926
}
927927

928928
private void updateTitle() {
929-
StringBuffer title = new StringBuffer("Robocode");
929+
StringBuffer title = new StringBuffer("Naval Robocode");
930930

931931
if (isBattleRunning) {
932932
title.append(": ");

robocode.ui/src/main/resources/net/sf/robocode/ui/html/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<tr>
2525
<td><img src="{$robocode-icon-url}" align="middle"></td>
2626
<td class="title">
27-
&nbsp;&nbsp;Naval Robocode version 0.9.2 based on Robocode 1.9.2.4
27+
&nbsp;&nbsp;Naval Robocode version {$robocode-version} based on Robocode 1.9.2.4
2828
<table cellspacing="0" cellpadding="0" border="0" width="100%">
2929
<tr><td><img src="{$transparent}" width="1" height="5" border="0"></td></tr>
3030
</table>

super-pom/profiles.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ xsi:schemaLocation="http://maven.apache.org/PROFILES/1.0.0 http://maven.apache.o
1717
<activeByDefault>true</activeByDefault>
1818
</activation>
1919
<properties>
20-
<robocode.version>0.9.4</robocode.version> <!-- Any string, but no spaces (use '-' instead of space) -->
21-
<robocode.dotnet.version>0.9.4.0</robocode.dotnet.version> <!-- Only X.X.X.X format -->
20+
<robocode.version>0.9.2</robocode.version> <!-- Any string, but no spaces (use '-' instead of space) -->
21+
<robocode.dotnet.version>0.9.2.0</robocode.dotnet.version> <!-- Only X.X.X.X format -->
2222
</properties>
2323
</profile>
2424
</profiles>

0 commit comments

Comments
 (0)