@@ -471,12 +471,35 @@ def _add_property(
471471 if not offset :
472472 return
473473
474+ # Get the proper type to use for the prop
475+ if networked :
476+ if prop .type == SendPropType .INT :
477+ bit_count = prop .bits
478+ if bit_count < 1 :
479+ # Note: I have yet to encounter this, so I'm not
480+ # sure under what circumstances this can occur.
481+ # That is why this simply returns.
482+ return
483+ if bit_count >= 17 :
484+ prop_type = 'int'
485+ elif bit_count >= 9 :
486+ prop_type = '{0}short' .format (
487+ '' if prop .is_signed () else 'u' )
488+ elif bit_count >= 2 :
489+ prop_type = '{0}char' .format (
490+ '' if prop .is_signed () else 'u' )
491+ else :
492+ prop_type = 'bool'
493+ else :
494+ prop_type = types [prop .type ]
495+ else :
496+ prop_type = types [prop .type ]
497+
474498 # Get the instance to use to get/set the property
475- value = self .instance_attribute (types [ prop . type ] , offset )
499+ value = self .instance_attribute (prop_type , offset )
476500
477501 # Add the property to the properties dictionary
478- instance .properties [name ] = EntityProperty (
479- value , types [prop .type ], networked )
502+ instance .properties [name ] = EntityProperty (value , prop_type , networked )
480503
481504 # Is the property not a named property?
482505 if name not in contents :
@@ -494,7 +517,7 @@ def _add_property(
494517
495518 # Add the property to the instance
496519 setattr (instance , contents [name ], self .entity_property (
497- types [ prop . type ] , offset , networked ))
520+ prop_type , offset , networked ))
498521
499522 @staticmethod
500523 def keyvalue (name , type_name ):
0 commit comments