Page MenuHomeWildfire Games

fix autostart for missing GameType
ClosedPublic

Authored by mimo on Feb 3 2018, 5:52 PM.

Details

Summary

Victory conditions are not set for autostart games.

The changes to the ai are not part of the patch, only for test purposes.

Test Plan

Set a regicide autostart game, for example with ./pyrogenesis -autostart='random/mainland' -autostart-ai=1:petra -autostart-ai=2:petra -autostart-aidiff=1:5 -autostart-aidiff=2:5 -autostart-nonvisual -autostart-victory="regicide"

Without the GameSetup.cpp changes, the gametype transfered to petra is the default conquest, no heroes are spawned and the game never stop.
With the full patch, the gametype is regicide, heroes are spawned and the game stops and prints the stats as soon as one hero is killed.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mimo created this revision.Feb 3 2018, 5:52 PM
elexis accepted this revision.Feb 3 2018, 6:15 PM
elexis added a subscriber: elexis.

Didn't test, hope for the best.
Might want to wait for the other guys input.

source/ps/GameSetup/GameSetup.cpp
1151 ↗(On Diff #5641)

Here the defaults are mentioned, should be done for gametype too I suppose

1161 ↗(On Diff #5641)

^

1164 ↗(On Diff #5641)

^

1168 ↗(On Diff #5641)

^

1465 ↗(On Diff #5641)

(Was wondering if it should print to stdout that it's conquest or endless by default, so that the user knows what (not) to expect. But none of the other defaults do that, so) ok.

(Another option to keep the user informed was to make the property mandatory. But the other settings are optional to, so there's that.)

1469 ↗(On Diff #5641)

Since this diff was copied and just opens the json file, it should continue to work.

This revision is now accepted and ready to land.Feb 3 2018, 6:15 PM
Vulcan added a subscriber: Vulcan.Feb 3 2018, 6:45 PM

Successful build - Chance fights ever on the side of the prudent.

Updating workspaces...
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (309 tests).....................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (309 tests).....................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...
Vulcan added a comment.Feb 3 2018, 6:47 PM
Executing section Default...
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/ai/common-api/shared.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/ai/common-api/shared.js
|  74|  74| 	this.timeElapsed = state.timeElapsed;
|  75|  75| 	this.circularMap = state.circularMap;
|  76|  76| 	this.mapSize = state.mapSize;
|  77|    |-warn("petra victory " + state.gameType);
|    |  77|+	warn("petra victory " + state.gameType);
|  78|  78| 	this.victoryConditions = new Set([state.gameType]);
|  79|  79| 	this.alliedVictory = state.alliedVictory;
|  80|  80| 	this.ceasefireActive = state.ceasefireActive;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/ai/common-api/shared.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/ai/common-api/shared.js
|  89|  89| 		 error("AI shared component inconsistent sizes: map=" + this.mapSize + " while territory=" + this.territoryMap.width);
|  90|  90| 	this.territoryMap.cellSize = this.mapSize / this.territoryMap.width;
|  91|  91| 
|  92|    |-/*
|    |  92|+	/*
|  93|  93| 	let landPassMap = new Uint8Array(this.passabilityMap.data.length);
|  94|  94| 	let waterPassMap = new Uint8Array(this.passabilityMap.data.length);
|  95|  95| 	let obstructionMaskLand = this.passabilityClasses["default-terrain-only"];
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/ai/common-api/shared.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/ai/common-api/shared.js
| 132| 132| 	for (let player of this._players)
| 133| 133| 	{
| 134| 134| 		this.gameState[player] = new m.GameState();
| 135|    |-		this.gameState[player].init(this,state, player);
|    | 135|+		this.gameState[player].init(this, state, player);
| 136| 136| 	}
| 137| 137| };
| 138| 138| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/ai/common-api/shared.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/ai/common-api/shared.js
| 201| 201| 	}
| 202| 202| 
| 203| 203| 	for (let evt of state.events.EntityRenamed)
| 204|    |-	{	// Switch the metadata: TODO entityCollections are updated only because of the owner change. Should be done properly
|    | 204|+		// Switch the metadata: TODO entityCollections are updated only because of the owner change. Should be done properly
| 205| 205| 		for (let player of this._players)
| 206| 206| 		{
| 207| 207| 			this._entityMetadata[player][evt.newentity] = this._entityMetadata[player][evt.entity];
| 208| 208| 			this._entityMetadata[player][evt.entity] = {};
| 209| 209| 		}
| 210|    |-	}
|    | 210|+	
| 211| 211| 
| 212| 212| 	for (let evt of state.events.TrainingFinished)
| 213| 213| 	{	// Apply metadata stored in training queues
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/ai/common-api/shared.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/ai/common-api/shared.js
| 210| 210| 	}
| 211| 211| 
| 212| 212| 	for (let evt of state.events.TrainingFinished)
| 213|    |-	{	// Apply metadata stored in training queues
|    | 213|+		// Apply metadata stored in training queues
| 214| 214| 		for (let entId of evt.entities)
| 215| 215| 			if (this._entities.has(entId))
| 216| 216| 				for (let key in e
This revision was automatically updated to reflect the committed changes.