I'm trying to do this:
var player:Player = new Player(); // class Player extends PlayerCore
var playerCore:PlayerCore = cast (player, PlayerCore);
var playerStr:String = Serializer.run(playerCore);
which compiles, but gives runtime error:
compile_server.command: line 3: 4267 Bus error: 10 ../bin/Server/Main
Cast works, it fails on serializer line. Except that Std.is(playerCore, PlayerCore)
and Std.is(playerCore, Player)
are both true, I don't know if it is expected result or not. Is this Haxe / hxcpp bug or am I doing something wrong?
Or alternatively, I need to convert object of type Player to it's parent type PlayerCore ("strip it off" the Player type features) and then serialize it. Is there a way to do this properly, or do I need to create new object and copy all the parameters manually?
Haxe 3.2.1, hxcpp 3.2.180, mac target