mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Remove this.isDeserialized from BaseAI
Some checks are pending
Some checks are pending
`this.isDeserialized` is only required for AIs which `Deserialize` function depends on the game state.
This commit is contained in:
parent
a4b580991b
commit
2f2cbb96bf
2 changed files with 3 additions and 7 deletions
|
|
@ -20,7 +20,6 @@ BaseAI.prototype.Serialize = function()
|
||||||
*/
|
*/
|
||||||
BaseAI.prototype.Deserialize = function(data, sharedScript)
|
BaseAI.prototype.Deserialize = function(data, sharedScript)
|
||||||
{
|
{
|
||||||
this.isDeserialized = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BaseAI.prototype.Init = function(state, playerID, sharedAI)
|
BaseAI.prototype.Init = function(state, playerID, sharedAI)
|
||||||
|
|
@ -47,12 +46,6 @@ BaseAI.prototype.HandleMessage = function(state, playerID, sharedAI)
|
||||||
{
|
{
|
||||||
PlayerID = playerID;
|
PlayerID = playerID;
|
||||||
this.territoryMap = sharedAI.territoryMap;
|
this.territoryMap = sharedAI.territoryMap;
|
||||||
|
|
||||||
if (this.isDeserialized)
|
|
||||||
{
|
|
||||||
this.Init(state, playerID, sharedAI);
|
|
||||||
this.isDeserialized = false;
|
|
||||||
}
|
|
||||||
this.OnUpdate(sharedAI);
|
this.OnUpdate(sharedAI);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,9 @@ PetraBot.prototype.CustomInit = function(gameState)
|
||||||
|
|
||||||
PetraBot.prototype.OnUpdate = function(sharedScript)
|
PetraBot.prototype.OnUpdate = function(sharedScript)
|
||||||
{
|
{
|
||||||
|
if (this.isDeserialized)
|
||||||
|
this.Init(state, playerID, sharedAI);
|
||||||
|
|
||||||
if (this.gameFinished || this.gameState.playerData.state == "defeated")
|
if (this.gameFinished || this.gameState.playerData.state == "defeated")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue