Skip to content

Commit

Permalink
Update to v0.2.1 (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmitch215 committed Jun 26, 2024
2 parents 814fd80 + eba9573 commit 05bd71f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ jobs:
cache: 'gradle'
- name: Change Permissions
run: chmod +x ./gradlew
- name: Install Firefox
uses: browser-actions/setup-firefox@v1
- name: Publish to Repository
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "xyz.calcugames"
version = "0.1.2-SNAPSHOT"
version = "0.2.1-SNAPSHOT"

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions src/commonMain/kotlin/xyz/calcugames/levelz/parser/parser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,15 @@ internal fun parse(file: Array<String>, seed: Random): Level {
if (line.isEmpty()) continue
if (line.equals(END, ignoreCase = true)) break

val ci = line.indexOf('#')
val line0 = (if (ci != -1) line.substring(0, ci) else line).trim()

if (is2D) {
val blocks2D = read2DLine(line, seed)
val blocks2D = read2DLine(line0, seed)
for (c in blocks2D.second)
blocks.add(LevelObject(blocks2D.first, c))
} else {
val blocks3D = read3DLine(line, seed)
val blocks3D = read3DLine(line0, seed)
for (c in blocks3D.second)
blocks.add(LevelObject(blocks3D.first, c))
}
Expand Down
2 changes: 1 addition & 1 deletion src/commonTest/resources/examples
11 changes: 11 additions & 0 deletions src/jvmTest/kotlin/xyz/calcugames/levelz/parser/TestLevelParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ class TestLevelParser {
val l3 = parseLevel(f3) as Level3D

assertEquals(l3.spawn, Coordinate3D(0, 0, 0))

val f4 = TestLevelParser::class.java.getResourceAsStream("/examples/2D/volcano/4.lvlz") ?: throw Exception("File not found")
val l4 = parseLevel(f4) as Level2D

assertEquals(l4.scroll, Scroll.NONE)
assertEquals(l4.spawn, Coordinate2D(5, 1))

val f5 = TestLevelParser::class.java.getResourceAsStream("/examples/3D/grasslands/3.lvlz") ?: throw Exception("File not found")
val l5 = parseLevel(f5) as Level3D

assertEquals(l5.spawn, Coordinate3D(0, 10, 0))
}

}

0 comments on commit 05bd71f

Please sign in to comment.