Resolved #1364 - Policy picker screen won't appear from the world screen if there are no possible policies to pick

This commit is contained in:
Yair Morgenstern 2019-11-24 00:02:28 +02:00
parent a8c98f60d7
commit 2a139ff732
5 changed files with 29 additions and 31 deletions

1
.gitignore vendored
View file

@ -136,3 +136,4 @@ android/assets/maps/
android/release/android.aab.sig
android/release/android-release.aab
tests/build/
desktop/packr/

View file

@ -50,7 +50,15 @@ class PolicyManager {
return true
}
fun canAdoptPolicy(): Boolean = freePolicies > 0 || storedCulture >= getCultureNeededForNextPolicy()
fun canAdoptPolicy(): Boolean {
if (freePolicies == 0 && storedCulture < getCultureNeededForNextPolicy())
return false
val hasAdoptablePolicies = GameBasics.PolicyBranches.values
.flatMap { it.policies.union(listOf(it)) }
.any { civInfo.policies.isAdoptable(it) }
return hasAdoptablePolicies
}
fun adopt(policy: Policy, branchCompletion: Boolean = false) {

View file

@ -188,7 +188,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
if(!isSomethingOpen && isPlayersTurn) {
when {
!gameInfo.oneMoreTurnMode && gameInfo.civilizations.any { it.victoryManager.hasWon() } -> game.setScreen(VictoryScreen())
viewingCiv.policies.freePolicies > 0 -> game.setScreen(PolicyPickerScreen(this))
viewingCiv.policies.freePolicies > 0 && viewingCiv.policies.canAdoptPolicy() -> game.setScreen(PolicyPickerScreen(this))
viewingCiv.greatPeople.freeGreatPeople > 0 -> game.setScreen(GreatPersonPickerScreen())
viewingCiv.popupAlerts.any() -> AlertPopup(this, viewingCiv.popupAlerts.first())
viewingCiv.tradeRequests.isNotEmpty() -> TradePopup(this)

View file

@ -1,3 +1,6 @@
import com.badlogicgames.packr.Packr
import com.badlogicgames.packr.PackrConfig
apply plugin: "kotlin"
sourceCompatibility = 1.6
@ -39,20 +42,20 @@ task dist(dependsOn: classes, type: Jar) {
}
}
//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);
//}
task packrWindows(){
PackrConfig config = new PackrConfig()
config.platform = PackrConfig.Platform.Windows64
config.jdk = "https://github.com/ojdkbuild/ojdkbuild/releases/download/java-1.8.0-openjdk-1.8.0.232-1.b09/java-1.8.0-openjdk-1.8.0.232-1.b09.ojdkbuild.windows.x86_64.zip"
config.executable = "Unciv"
config.classpath = Arrays.asList("desktop/build/libs/${appName}.jar".toString())
config.removePlatformLibs = config.classpath
config.mainClass = project.ext.mainClassName
config.vmArgs = Arrays.asList("Xmx1G")
config.minimizeJre = "soft"
config.outDir = new File("desktop/packr")
new Packr().pack(config)
}
eclipse {
project {
@ -70,9 +73,4 @@ task afterEclipseImport(description: "Post processing after project generation",
printer.setPreserveWhitespace(true)
printer.print(classpath)
}
}
//
//dependencies {
// implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
// implementation project(path: ':core')
//}
}

View file

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