Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/ai/petra/queue.js
Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | |||||
m.Queue.prototype.Deserialize = function(gameState, data) | m.Queue.prototype.Deserialize = function(gameState, data) | ||||
{ | { | ||||
this.paused = data.paused; | this.paused = data.paused; | ||||
this.switched = data.switched; | this.switched = data.switched; | ||||
this.plans = []; | this.plans = []; | ||||
for (let dataPlan of data.plans) | for (let dataPlan of data.plans) | ||||
{ | { | ||||
let plan; | let plan; | ||||
if (dataPlan.prop.category == "unit") | if (dataPlan.category == "unit") | ||||
plan = new m.TrainingPlan(gameState, dataPlan.prop.type); | plan = new m.TrainingPlan(gameState, dataPlan.type); | ||||
else if (dataPlan.prop.category == "building") | else if (dataPlan.category == "building") | ||||
plan = new m.ConstructionPlan(gameState, dataPlan.prop.type); | plan = new m.ConstructionPlan(gameState, dataPlan.type); | ||||
else if (dataPlan.prop.category == "technology") | else if (dataPlan.category == "technology") | ||||
plan = new m.ResearchPlan(gameState, dataPlan.prop.type); | plan = new m.ResearchPlan(gameState, dataPlan.type); | ||||
else | else | ||||
{ | { | ||||
API3.warn("Petra deserialization error: plan unknown " + uneval(dataPlan)); | API3.warn("Petra deserialization error: plan unknown " + uneval(dataPlan)); | ||||
continue; | continue; | ||||
} | } | ||||
plan.Deserialize(gameState, dataPlan); | plan.Deserialize(gameState, dataPlan); | ||||
this.plans.push(plan); | this.plans.push(plan); | ||||
} | } | ||||
}; | }; | ||||
return m; | return m; | ||||
}(PETRA); | }(PETRA); |
Wildfire Games · Phabricator