fixed “lost sprites bug”

ensure duplicated sprites keep wearing their current costume through
save and re-load
pull/3/merge
jmoenig 2014-07-24 08:04:00 +02:00
rodzic 2fbdf855c2
commit 1b382458c8
2 zmienionych plików z 11 dodań i 2 usunięć

Wyświetl plik

@ -2222,3 +2222,7 @@ ______
140723 140723
------ ------
* Objects: Scale down oversized images to current stage dimensions. Thanks, Dan, for reporting this! * Objects: Scale down oversized images to current stage dimensions. Thanks, Dan, for reporting this!
140724
------
* Objects: fixed “lost sprites bug” - ensure duplicated sprites keep wearing their current costume through save and re-load

Wyświetl plik

@ -125,7 +125,7 @@ PrototypeHatBlockMorph*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.objects = '2014-July-23'; modules.objects = '2014-July-24';
var SpriteMorph; var SpriteMorph;
var StageMorph; var StageMorph;
@ -1331,6 +1331,7 @@ SpriteMorph.prototype.init = function (globals) {
SpriteMorph.prototype.fullCopy = function () { SpriteMorph.prototype.fullCopy = function () {
var c = SpriteMorph.uber.fullCopy.call(this), var c = SpriteMorph.uber.fullCopy.call(this),
myself = this,
arr = [], arr = [],
cb; cb;
@ -1352,7 +1353,11 @@ SpriteMorph.prototype.fullCopy = function () {
}); });
}); });
this.costumes.asArray().forEach(function (costume) { this.costumes.asArray().forEach(function (costume) {
arr.push(costume.copy()); var cst = costume.copy();
arr.push(cst);
if (costume === myself.costume) {
c.costume = cst;
}
}); });
c.costumes = new List(arr); c.costumes = new List(arr);
arr = []; arr = [];