Debug option: simulate game until certain turn (#1812)

This commit is contained in:
lyrjie
2020-01-31 15:10:32 +03:00
committed by GitHub
parent 7577655264
commit 58fa5d6dd5
3 changed files with 11 additions and 2 deletions

View File

@ -41,6 +41,12 @@ class UncivGame(
/** For when you need to test something in an advanced game and don't have time to faff around */
val superchargedForDebug = false
/** Simulate until this turn on the first "Next turn" button press.
* Does not update World View changes until finished.
* Set to 0 to disable.
*/
val simulateUntilTurnForDebug: Int = 0
var rewriteTranslationFiles = false
lateinit var worldScreen: WorldScreen

View File

@ -80,7 +80,9 @@ class GameInfo {
switchTurn()
while(thisPlayer.playerType==PlayerType.AI){
while (thisPlayer.playerType == PlayerType.AI
|| UncivGame.Current.simulateUntilTurnForDebug > turns
) {
if(thisPlayer.isBarbarian() || !thisPlayer.isDefeated()) {
NextTurnAutomation().automateCivMoves(thisPlayer)

View File

@ -39,7 +39,8 @@ class BasicTests {
Assert.assertTrue("This test will only pass if the game is not run with debug modes",
!game.superchargedForDebug
&& !game.viewEntireMapForDebug
&& !game.rewriteTranslationFiles)
&& !game.rewriteTranslationFiles
&& game.simulateUntilTurnForDebug <= 0)
}
// If there's a unit that obsoletes with no upgrade then when it obsoletes