Browse Source

hxd.net.Serializer fixes (#198)

* Fix PObj unserialize
* Fix conflicts between Enum value and class name
Pascal Peridont 8 years ago
parent
commit
77027a3bca
1 changed files with 5 additions and 3 deletions
  1. 5 3
      hxd/net/Macros.hx

+ 5 - 3
hxd/net/Macros.hx

@@ -399,7 +399,7 @@ class Macros {
 				Context.error("Too many nullable fields", v.pos);
 			var ct = t.t;
 			return macro {
-				var fbits = $ctx.getByte();
+				var fbits = $ctx.getInt();
 				if( fbits == 0 )
 					$v = null;
 				else {
@@ -526,12 +526,14 @@ class Macros {
 				meta : noCompletion,
 				kind : FVar(macro : Int, macro @:privateAccess hxd.net.Serializer.allocUID()),
 			});
+	
+		var clName = StringTools.endsWith(cl.module,"."+cl.name) ? cl.module.split(".") : [cl.name];
 		fields.push({
 			name : "__clid",
 			pos : pos,
 			access : [AStatic],
 			meta : noCompletion,
-			kind : FVar(macro : Int, macro @:privateAccess hxd.net.Serializer.registerClass($i{cl.name})),
+			kind : FVar(macro : Int, macro @:privateAccess hxd.net.Serializer.registerClass($p{clName})),
 		});
 		fields.push({
 			name : "getCLID",
@@ -1403,4 +1405,4 @@ class Macros {
 
 	#end
 
-}
+}