Skip to content

Commit

Permalink
Revert #76
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed Aug 30, 2024
1 parent a084628 commit e12d3b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 32 deletions.
30 changes: 2 additions & 28 deletions hxbit/Macros.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1825,7 +1825,6 @@ class Macros {
var flushExpr = [];
var syncExpr = [];
var initExpr = [];
var condMarkCases: Array<Case> = [];
var noComplete : Metadata = [ { name : ":noCompletion", pos : pos } ];
var saveMask : haxe.Int64 = 0;
for( f in toSerialize ) {
Expand Down Expand Up @@ -1966,31 +1965,6 @@ class Macros {
}),
access : [AInline],
});
condMarkCases.push({
values : [macro $v{bitID}],
expr : markExpr,
});
}

if( toSerialize.length != 0 || !isSubSer ) {
var access = [APublic];
if( isSubSer )
access.push(AOverride);
var defaultCase = macro networkSetBit(b);
if( isSubSer )
defaultCase = macro super.networkSetBitCond(b);
var swExpr = { expr : ESwitch( { expr : EConst(CIdent("b")), pos : pos }, condMarkCases, defaultCase), pos : pos };
fields.push({
name : "networkSetBitCond",
pos : pos,
access : access,
meta : noComplete,
kind : FFun({
args : [ { name : "b", type : macro : Int } ],
ret : macro : Void,
expr : swExpr,
}),
});
}

// BUILD RPC
Expand Down Expand Up @@ -2664,8 +2638,8 @@ class Macros {
var bit : Int;
@:noCompletion public var __value(get, never) : $pt;
inline function get___value() : $pt return cast this;
public inline function mark() if( obj != null ) obj.networkSetBitCond(bit);
@:noCompletion public inline function networkSetBitCond(_) mark();
inline function mark() if( obj != null ) obj.networkSetBit(bit);
@:noCompletion public function networkSetBit(_) mark();
@:noCompletion public function bindHost(obj, bit) { this.obj = obj; this.bit = bit; }
@:noCompletion public function unbindHost() this.obj = null;
@:noCompletion public function toString() return hxbit.NetworkSerializable.BaseProxy.objToString(this);
Expand Down
7 changes: 3 additions & 4 deletions hxbit/NetworkSerializable.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package hxbit;

interface ProxyHost {
public function networkSetBitCond( bit : Int ) : Void;
public function networkSetBit( bit : Int ) : Void;
}

interface ProxyChild {
Expand Down Expand Up @@ -81,7 +81,6 @@ interface NetworkSerializable extends Serializable extends ProxyHost {
public function networkRPC( ctx : NetworkSerializer, rpcID : Int, clientResult : NetworkHost.NetworkClient ) : Bool;
public function networkAllow( op : Operation, propId : Int, client : NetworkSerializable ) : Bool;
public function networkGetName( propId : Int, isRPC : Bool = false ) : String;
public function networkSetBit( bit : Int ) : Void;

#if hxbit_visibility
public var __cachedVisibility : Map<hxbit.NetworkSerializable,Int>;
Expand All @@ -96,11 +95,11 @@ interface NetworkSerializable extends Serializable extends ProxyHost {
class BaseProxy implements ProxyHost implements ProxyChild {
public var obj : ProxyHost;
public var bit : Int;
@:noCompletion public inline function networkSetBitCond(_) {
public inline function networkSetBit(_) {
mark();
}
public inline function mark() {
if( obj != null ) obj.networkSetBitCond(bit);
if( obj != null ) obj.networkSetBit(bit);
}
public inline function bindHost(o, bit) {
if( obj != null && (o != this.obj || bit != this.bit) )
Expand Down

0 comments on commit e12d3b5

Please sign in to comment.