Fixes tests.

Changes direct access of EndGameManager.gameType to getter function, by
convention

This was SVN commit r15525.
This commit is contained in:
historic_bruno 2014-07-13 19:45:44 +00:00
parent 1b5ab8142e
commit 7b15b526ac
3 changed files with 13 additions and 1 deletions

View File

@ -21,6 +21,11 @@ EndGameManager.prototype.Init = function()
this.alliedVictory = true;
};
EndGameManager.prototype.GetGameType = function()
{
return this.gameType;
};
EndGameManager.prototype.SetGameType = function(newGameType)
{
this.gameType = newGameType;

View File

@ -119,7 +119,7 @@ GuiInterface.prototype.GetSimulationState = function(player)
// and the game type
var cmpEndGameManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_EndGameManager);
ret.gameType = cmpEndGameManager.gameType;
ret.gameType = cmpEndGameManager.GetGameType();
return ret;
};

View File

@ -4,6 +4,7 @@ Engine.LoadComponentScript("interfaces/Auras.js");
Engine.LoadComponentScript("interfaces/Barter.js");
Engine.LoadComponentScript("interfaces/Builder.js");
Engine.LoadComponentScript("interfaces/DamageReceiver.js");
Engine.LoadComponentScript("interfaces/EndGameManager.js");
Engine.LoadComponentScript("interfaces/EntityLimits.js");
Engine.LoadComponentScript("interfaces/Foundation.js");
Engine.LoadComponentScript("interfaces/GarrisonHolder.js");
@ -36,6 +37,10 @@ AddMock(SYSTEM_ENTITY, IID_Barter, {
}},
});
AddMock(SYSTEM_ENTITY, IID_EndGameManager, {
GetGameType: function() { return "conquest"; }
});
AddMock(SYSTEM_ENTITY, IID_PlayerManager, {
GetNumPlayers: function() { return 2; },
GetPlayerByID: function(id) { TS_ASSERT(id === 0 || id === 1); return 100+id; },
@ -244,6 +249,7 @@ TS_ASSERT_UNEVAL_EQUALS(cmp.GetSimulationState(), {
],
circularMap: false,
timeElapsed: 0,
gameType: "conquest",
});
TS_ASSERT_UNEVAL_EQUALS(cmp.GetExtendedSimulationState(), {
@ -339,6 +345,7 @@ TS_ASSERT_UNEVAL_EQUALS(cmp.GetExtendedSimulationState(), {
],
circularMap: false,
timeElapsed: 0,
gameType: "conquest",
barterPrices: {buy: {food: 150}, sell: {food: 25}}
});