Fix (de)serialisation in the Researcher component.
A typo in the serialisation function.
Also just serialise the properties that are assigned in cmpResearcher
and cmpTrainer.
Introduced in e4925e02d0
Reported by: @nwtour
Differential revision: https://code.wildfiregames.com/D4386
Tested by: @nwtour
This was SVN commit r26105.
This commit is contained in:
parent
478164962f
commit
381bbb59e8
@ -167,15 +167,17 @@ Researcher.prototype.Item.prototype.Serialize = function(id)
|
||||
const result = {
|
||||
"id": id
|
||||
};
|
||||
for (const att in this.SerializableAttributes)
|
||||
result[att] = this[att];
|
||||
for (const att of this.SerializableAttributes)
|
||||
if (this.hasOwnProperty(att))
|
||||
result[att] = this[att];
|
||||
return result;
|
||||
};
|
||||
|
||||
Researcher.prototype.Item.prototype.Deserialize = function(data)
|
||||
{
|
||||
for (const att of this.SerializableAttributes)
|
||||
this[att] = data[att];
|
||||
for (const att in data)
|
||||
if (this.SerializableAttributes.includes(att))
|
||||
this[att] = data[att];
|
||||
};
|
||||
|
||||
Researcher.prototype.Init = function()
|
||||
|
@ -394,14 +394,16 @@ Trainer.prototype.Item.prototype.Serialize = function(id)
|
||||
"id": id
|
||||
};
|
||||
for (const att of this.SerializableAttributes)
|
||||
result[att] = this[att];
|
||||
if (this.hasOwnProperty(att))
|
||||
result[att] = this[att];
|
||||
return result;
|
||||
};
|
||||
|
||||
Trainer.prototype.Item.prototype.Deserialize = function(data)
|
||||
{
|
||||
for (const att of this.SerializableAttributes)
|
||||
this[att] = data[att];
|
||||
for (const att in data)
|
||||
if (this.SerializableAttributes.includes(att))
|
||||
this[att] = data[att];
|
||||
};
|
||||
|
||||
Trainer.prototype.Init = function()
|
||||
|
Loading…
Reference in New Issue
Block a user