Proposal: Automatic <property> type discovery based on value


  • Admin

    Proposal:

    (1) Ignore nodes:<boolean/>, <number/> and <string/>, instead always infer them from the value attribute of a property node.
    (2) Add optional attributes to <property> :

    • min | number | default null
    • max | number | default null

    Background

    The game engine today already tries to infer the value of a property based on the value type when the value type tag is not specified. But, the engine will not infer 'boolean' types, only 'string' and 'number' types. In this proposal we would change the code to always do type inference in addition to automatically inferring 'boolean' types.

    Example, Before:

    <propertyList>
      <property name="Projection of Power" value="false">
        <boolean/>
      </property>
    
      <property name="neutralCharge" value="0">
        <number min="1" max="10000"/>
      </property>
      
      <property name="mapName" value="world_at_war">
        <string/>
      </property>
    </propertyList>
    

    Example, after:

    <propertyList>
      <property name="Projection of Power" value="false"/>
      <property name="neutralCharge" value="0" min="1" max="10000"/>  
      <property name="mapName" value="world_at_war" />
    </propertyList>
    

  • Admin


Log in to reply