HeapsIO / hxbit

Haxe Binary serialization and network synchronization library
155 stars 30 forks source link

Fix @:increment using previous value for marking #40

Closed trethaller closed 5 years ago

trethaller commented 5 years ago

Fix missing markings, because in the set_ function the marking is done before the affectation.

Code after change:

function set_reviveRemaining(v:Float) {
    if ((this.reviveRemaining != v)) {
        if ((Math.floor(v / 0.05) != this.__ref_reviveRemaining)) {
            this.__ref_reviveRemaining = Math.floor(v / 0.05);
            if ((this.__host != null && (this.__host.isAuth || this.__host.checkWrite(this, 20)) && (this.__next != null || this.__host.mark(this)))) this.__bits |= 1048576;
        };
    };
    return this.reviveRemaining = v;
}

Code before change:

function set_reviveRemaining(v:Float) {
    if ((this.reviveRemaining != v)) {
        if ((Math.floor(this.reviveRemaining / 0.05) != this.__ref_reviveRemaining)) {
            this.__ref_reviveRemaining = Math.floor(this.reviveRemaining / 0.05);
            if ((this.__host != null && (this.__host.isAuth || this.__host.checkWrite(this, 20)) && (this.__next != null || this.__host.mark(this)))) this.__bits |= 1048576;
        };
    };
    return this.reviveRemaining = v;
}