Solved bug which was caused by obsoleting scouts when they have no upgrade

This commit is contained in:
Yair Morgenstern 2019-12-22 19:39:54 +02:00
parent 82d8670b16
commit 33ad922343
4 changed files with 62 additions and 45 deletions

View file

@ -788,6 +788,20 @@ ImprovementIcons/Quarry
orig: 100, 100
offset: 0, 0
index: -1
ImprovementIcons/Railroad
rotate: false
xy: 308, 238
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TileSets/Default/Railroad
rotate: false
xy: 308, 238
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
ImprovementIcons/Road
rotate: false
xy: 1838, 170
@ -1714,7 +1728,7 @@ TechIcons/Radio
index: -1
TechIcons/Railroad
rotate: false
xy: 308, 238
xy: 2, 226
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -1789,6 +1803,20 @@ TileSets/Default/CityOverlay
orig: 100, 100
offset: 0, 0
index: -1
TileSets/Default/CrosshatchHexagon
rotate: false
xy: 583, 1800
size: 273, 236
orig: 273, 236
offset: 0, 0
index: -1
TileSets/FantasyHex/CrosshatchHexagon
rotate: false
xy: 583, 1800
size: 273, 236
orig: 273, 236
offset: 0, 0
index: -1
TileSets/Default/FalloutOverlay
rotate: false
xy: 2, 1042
@ -1859,37 +1887,9 @@ TileSets/Default/OasisOverlay
orig: 100, 100
offset: 0, 0
index: -1
TileSets/Default/Railroad
rotate: false
xy: 410, 214
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
ImprovementIcons/Railroad
rotate: false
xy: 410, 214
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TileSets/FantasyHex/CrosshatchHexagon
rotate: false
xy: 583, 1800
size: 273, 236
orig: 273, 236
offset: 0, 0
index: -1
TileSets/Default/CrosshatchHexagon
rotate: false
xy: 583, 1800
size: 273, 236
orig: 273, 236
offset: 0, 0
index: -1
TileSets/FantasyHex/Railroad
rotate: false
xy: 2, 226
xy: 410, 214
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -2957,6 +2957,20 @@ TechIcons/Writing
orig: 100, 100
offset: 0, 0
index: -1
TileSets/Default/road
rotate: false
xy: 512, 90
size: 61, 11
orig: 61, 11
offset: 0, 0
index: -1
TileSets/FantasyHex/road
rotate: false
xy: 512, 90
size: 61, 11
orig: 61, 11
offset: 0, 0
index: -1
TileSets/FantasyHex/Tiles/Academy
rotate: false
xy: 818, 13
@ -4252,20 +4266,6 @@ TileSets/FantasyHex/Units/Work Boats
orig: 32, 26
offset: 0, 0
index: -1
TileSets/FantasyHex/road
rotate: false
xy: 512, 90
size: 61, 11
orig: 61, 11
offset: 0, 0
index: -1
TileSets/Default/road
rotate: false
xy: 512, 90
size: 61, 11
orig: 61, 11
offset: 0, 0
index: -1
UnitIcons/Submarine
rotate: false
xy: 2, 104

Binary file not shown.

Before

Width:  |  Height:  |  Size: 877 KiB

After

Width:  |  Height:  |  Size: 877 KiB

View file

@ -25,7 +25,6 @@
movement:2,
strength:5,
cost:25,
obsoleteTech:"Scientific Theory",
uniques:["Ignores terrain cost"],
attackSound:"nonmetalhit"
},

View file

@ -5,10 +5,13 @@ package de.tomgrill.gdxtesting.examples;
import com.badlogic.gdx.Gdx;
import com.unciv.UncivGame;
import com.unciv.models.ruleset.Ruleset;
import com.unciv.models.ruleset.unit.BaseUnit;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.Collection;
import de.tomgrill.gdxtesting.GdxTestRunner;
import static org.junit.Assert.assertTrue;
@ -37,6 +40,21 @@ public class BasicTests {
&& !new UncivGame("").getViewEntireMapForDebug());
}
// If there's a unit that obsoletes with no upgrade then when it obsoletes
// and we try to work on its upgrade, we'll get an exception - see techManager
@Test
public void allObsoletingUnitsHaveUpgrades() {
Collection<BaseUnit> units = new Ruleset(true).getUnits().values();
boolean allObsoletingUnitsHaveUpgrades = true;
for(BaseUnit unit : units){
if(unit.getObsoleteTech()!=null && unit.getUpgradesTo()==null) {
System.out.println(unit.name+" obsoletes but has no upgrade");
allObsoletingUnitsHaveUpgrades=false;
}
}
assertTrue(allObsoletingUnitsHaveUpgrades);
}
// @Test
// public void setMapEditorScreen() {