Fixed crash in tile editor as a result of adding Fallout, which has no "occursOn" terrains

This commit is contained in:
Yair Morgenstern 2019-11-23 21:35:03 +02:00
parent 4844a98af1
commit 1230b00688
6 changed files with 71 additions and 40 deletions

View file

@ -13,13 +13,16 @@ buildscript {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
maven{ url 'https://jitpack.io' } // for the anuken packr
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1'
// This is for wrapping the .jar file into a standalone executable
classpath "com.github.anuken:packr:-SNAPSHOT"
}
}
@ -56,7 +59,6 @@ allprojects {
project(":desktop") {
apply plugin: "kotlin"
dependencies {
implementation project(":core")
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
@ -67,6 +69,7 @@ project(":desktop") {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" // This iss so the JAR works with Kotlin
implementation 'com.github.MinnDevelopment:java-discord-rpc:v2.0.1'
}
}

View file

@ -181,7 +181,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
val tileInfo = TileInfo()
if (terrain.type == TerrainType.TerrainFeature) {
tileInfo.baseTerrain = when {
terrain.occursOn == null -> terrain.occursOn!!.first()
terrain.occursOn != null -> terrain.occursOn.first()
else -> "Grassland"
}
tileInfo.terrainFeature = terrain.name

View file

@ -24,7 +24,7 @@ task debug(dependsOn: classes, type: JavaExec) {
debug = true
}
task dist(type: Jar) {
task dist(dependsOn: classes, type: Jar) {
from files(sourceSets.main.output.resourcesDir)
from files(sourceSets.main.output.classesDirs)
// see Laurent1967's comment on https://github.com/libgdx/libgdx/issues/5491
@ -39,7 +39,20 @@ task dist(type: Jar) {
}
}
dist.dependsOn classes
//task packrWindows(){
// PackrConfig config = new PackrConfig();
// config.platform = PackrConfig.Platform.Windows32;
// config.jdk = "/User/badlogic/Downloads/openjdk-for-mac.zip";
// config.executable = "myapp";
// config.classpath = Arrays.asList("myjar.jar");
// config.removePlatformLibs = config.classpath;
// config.mainClass = "com.my.app.MainClass";
// config.vmArgs = Arrays.asList("Xmx1G");
// config.minimizeJre = "soft";
// config.outDir = new File("out-mac");
//
// new Packr().pack(config);
//}
eclipse {
project {
@ -58,8 +71,8 @@ task afterEclipseImport(description: "Post processing after project generation",
printer.print(classpath)
}
}
dependencies {
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
implementation project(path: ':core')
}
//
//dependencies {
// implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
// implementation project(path: ':core')
//}

9
out-mac/config.json Normal file
View file

@ -0,0 +1,9 @@
{
"classPath": [
"myjar.jar"
],
"mainClass": "com.my.app.MainClass",
"vmArgs": [
"-Xmx1G"
]
}

View file

@ -1,30 +0,0 @@
// Taken from https://github.com/TomGrill/gdx-testing
package de.tomgrill.gdxtesting.examples;
import com.badlogic.gdx.Gdx;
import com.unciv.models.gamebasics.GameBasics;
import org.junit.Test;
import org.junit.runner.RunWith;
import de.tomgrill.gdxtesting.GdxTestRunner;
import static org.junit.Assert.assertTrue;
@RunWith(GdxTestRunner.class)
public class AssetExistsExampleTest {
@Test
public void gamePngExists() {
assertTrue("This test will only pass when the game.png exists",
Gdx.files.local("game.png").exists());
}
@Test
public void gameBasicsLoad() {
assertTrue("This test will only pass when the game.png exists",
GameBasics.INSTANCE.getBuildings().size() > 0);
}
}

View file

@ -0,0 +1,36 @@
// Taken from https://github.com/TomGrill/gdx-testing
package de.tomgrill.gdxtesting.examples
import com.badlogic.gdx.Gdx
import com.unciv.UnCivGame
import com.unciv.models.gamebasics.GameBasics
import com.unciv.ui.mapeditor.MapEditorScreen
import de.tomgrill.gdxtesting.GdxTestRunner
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(GdxTestRunner::class)
class BasicTests {
@Test
fun gamePngExists() {
assertTrue("This test will only pass when the game.png exists",
Gdx.files.local("game.png").exists())
}
@Test
fun gameBasicsLoad() {
assertTrue("This test will only pass when the GameBasics can initialize, and there are buildings",
GameBasics.Buildings.size > 0)
}
@Test
fun canOpenMapEditorScreen() {
UnCivGame.Current.setScreen(MapEditorScreen(UnCivGame.Current.gameInfo.tileMap))
assertTrue("This test will only pass when we can open the map editor screen",
GameBasics.Buildings.size > 0)
}
}