mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-20 21:43:50 +00:00
Remove this.events from AIs
`this.events` is only valid during one turn. When it is used in the next turnn it might be outdated. So it makes no sense to keep it alive untill the next turn.
This commit is contained in:
@@ -49,7 +49,6 @@ BaseAI.prototype.CustomInit = function()
|
||||
BaseAI.prototype.HandleMessage = function(state, playerID, sharedAI)
|
||||
{
|
||||
PlayerID = playerID;
|
||||
this.events = sharedAI.events;
|
||||
this.territoryMap = sharedAI.territoryMap;
|
||||
|
||||
if (this.isDeserialized)
|
||||
|
||||
@@ -92,14 +92,14 @@ PetraBot.prototype.OnUpdate = function(sharedScript)
|
||||
if (this.gameFinished || this.gameState.playerData.state == "defeated")
|
||||
return;
|
||||
|
||||
for (const i in this.events)
|
||||
for (const i in sharedScript.events)
|
||||
{
|
||||
if (i == "AIMetadata") // not used inside petra
|
||||
continue;
|
||||
if (this.savedEvents[i] !== undefined)
|
||||
this.savedEvents[i] = this.savedEvents[i].concat(this.events[i]);
|
||||
this.savedEvents[i] = this.savedEvents[i].concat(sharedScript.events[i]);
|
||||
else
|
||||
this.savedEvents[i] = this.events[i];
|
||||
this.savedEvents[i] = sharedScript.events[i];
|
||||
}
|
||||
|
||||
// Run the update every n turns, offset depending on player ID to balance the load
|
||||
|
||||
Reference in New Issue
Block a user