Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
permissions:
actions: read
contents: read
pull-requests: write
security-events: write

steps:
Expand All @@ -33,8 +34,30 @@ jobs:
run: ./gradlew build

- name: Lint
id: lint
continue-on-error: true
run: ./gradlew lint

- name: Count lint violations
id: count_violations
if: steps.lint.outcome == 'failure'
run: |
./gradlew lint || echo "::warning::Checkstyle found violations. See the checkstyle-report artifact for details."
count=$(grep -r '<error ' build/reports/checkstyle/ | wc -l)
echo "count=$count" >> $GITHUB_OUTPUT

- name: Comment on PR if lint failed
if: steps.lint.outcome == 'failure' && github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const count = ${{ steps.count_violations.outputs.count }};
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `:warning: **Checkstyle found ${count} style violation${count === 1 ? '' : 's'}.** Download the **checkstyle-report** artifact from the [Actions run](${runUrl}) for details.`
})

- name: Determine artifact name
id: find_artifact
Expand Down
13 changes: 7 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ fun getHash(): String {
?.trim() ?: "00000000"
}

val lwjglVersion = "3.4.1"
// Weird Parth's desktop stuff, remove before merge
val lwjglVersion = "3.3.3"
val lwjglNatives = listOf(
"natives-freebsd",
"natives-linux-arm32", "natives-linux-arm64",
"natives-linux-ppc64le", "natives-linux-riscv64",
// "natives-freebsd",
// "natives-linux-arm32", "natives-linux-arm64",
// "natives-linux-ppc64le", "natives-linux-riscv64",
"natives-linux",
"natives-macos", "natives-macos-arm64",
"natives-windows-x86", "natives-windows", "natives-windows-arm64",
// "natives-macos", "natives-macos-arm64",
// "natives-windows-x86", "natives-windows", "natives-windows-arm64",
)

repositories {
Expand Down
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#Fri Apr 17 23:09:51 EDT 2026
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 3 additions & 0 deletions src/main/java/lwjglwindow/LWJGLWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ protected void init()

GLFWErrorCallback.createPrint(System.err).set();

if (System.getProperty("os.name").toLowerCase().contains("linux"))
GLFW.glfwInitHint(GLFW.GLFW_PLATFORM, GLFW.GLFW_PLATFORM_X11);

if (!glfwInit())
throw new IllegalStateException("Unable to initialize GLFW");

Expand Down
13 changes: 12 additions & 1 deletion src/main/java/tanks/Crusade.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import tanks.network.ServerHandler;
import tanks.network.event.*;
import tanks.tank.*;
import tanks.tankson.*;

import java.util.*;

Expand Down Expand Up @@ -294,7 +295,17 @@ public void begin()

public void loadLevel()
{
Level l = new Level(this.levels.get(this.currentLevel).levelString, this.customTanks);
Level l;
try
{
l = (Level) Serializer.fromTanksON(this.levels.get(this.currentLevel).levelString);
l.init(customTanks);
l.levelString = this.levels.get(this.currentLevel).levelString;
}
catch (RuntimeException e)
{
l = new Level(this.levels.get(this.currentLevel).levelString, customTanks);
}

Game.player.hotbar.enabledCoins = true;
Game.player.hotbar.itemBar.showItems = true;
Expand Down
27 changes: 24 additions & 3 deletions src/main/java/tanks/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import tanks.registry.*;
import tanks.rendering.*;
import tanks.tank.*;
import tanks.tankson.Serializer;

import com.codedisaster.steamworks.SteamMatchmaking;

Expand Down Expand Up @@ -1373,7 +1374,17 @@ public static boolean loadLevel(BaseFile f, ILevelPreviewScreen s)
line.append(f.nextLine()).append("\n");
}

Level l = new Level(line.substring(0, line.length() - 1));
Level l;
try
{
l = (Level) Serializer.fromTanksON(line.substring(0, line.length() - 1));
l.init();
l.levelString = line.substring(0, line.length() - 1);
}
catch (RuntimeException e)
{
l = new Level(line.substring(0, line.length() - 1));
}
l.loadLevel(s);

f.stopReading();
Expand All @@ -1388,8 +1399,18 @@ public static boolean loadLevel(BaseFile f, ILevelPreviewScreen s)

public static int compareVersions(String v1, String v2)
{
String[] a = v1.substring(v1.indexOf(" v") + 2).split("\\.");
String[] b = v2.substring(v2.indexOf(" v") + 2).split("\\.");
String[] a;
String[] b;
if (v1.contains(" v") && v2.contains(" v"))
{
a = v1.substring(v1.indexOf(" v") + 2).split("\\.");
b = v2.substring(v2.indexOf(" v") + 2).split("\\.");
}
else
{
a = v1.split("\\.");
b = v2.split("\\.");
}

for (int i = 0; i < Math.max(a.length, b.length); i++)
{
Expand Down
Loading
Loading