petra: check that we are dealing with a foundation before trying to provide it with builders, fixes #4271

This was SVN commit r18826.
This commit is contained in:
mimo 2016-10-10 16:41:31 +00:00
parent 9c2404e40e
commit 106e4bddbf

View File

@ -142,9 +142,10 @@ m.HQ.prototype.checkEvents = function (gameState, events, queues)
for (let evt of events.Create)
{
// Let's check if we have a building set to create a new base.
// Let's check if we have a valuable foundation needing builders quickly
// (normal foundations are taken care in baseManager.assignToFoundations)
let ent = gameState.getEntityById(evt.entity);
if (!ent || !ent.isOwn(PlayerID))
if (!ent || !ent.isOwn(PlayerID) || ent.foundationProgress() === undefined)
continue;
if (ent.getMetadata(PlayerID, "base") == -1)