Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » Stars! Nova - Development » Item.Type now an Enum
Item.Type now an Enum Sun, 10 July 2011 18:53 Go to previous message
Aeglos is currently offline Aeglos

 
Chief Warrant Officer 1
Stars! Nova developer
Stars! Nova developer

Messages: 142
Registered: May 2011
Location: Chile
I've changed this to an Enum <ItemType> instead of a string to further reduce typo errors and have stronger defined types.

I also added a small reflection extension method ToDescription() to ItemType so that types like 'PlanetaryInstallations' can be converted to 'Planetary Installations' for use in the GUI when needed or in some specific component matching schemes already there. The serializations still need to use ToString() though as deserializing enums with whitespaces would be an overkill implementation.
(You can use this with a simple Component.Type.ToDescription(), for example).

I also edited the components.xml file so that Item types match the Enum's ToString (PlanetaryInstallations, BeamWeapons, etc). I don't know how this affects the component editor, since It seems it is not accesible anymore from within the game or as an external app.

As always, please let me know of any bugs I may have missed with this.

Report message to a moderator

 
Read Message
Read Message
Read Message
Previous Topic: Priorities
Next Topic: Merge/Split fleet dialog
Goto Forum:
  


Current Time: Fri Sep 17 09:52:51 EDT 2021