Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » Stars! Nova - Development » Need to move away from using names as IDs
Re: Need to move away from using names as IDs Sat, 09 July 2011 04:37 Go to previous messageGo to previous message
Daniel is currently offline Daniel

 
Chief Warrant Officer 3
Stars! Nova developer
Stars! Nova developer

Messages: 179
Registered: April 2006
Location: Nowra, Australia
Aeglos wrote on Sat, 09 July 2011 18:06

Sounds good to me; it's like the finishing touches that consolidate the system.

I assume the 2-24 reserved bits are futureproofing for flags?



They are so the Id could be a full uint and I could add a seperate value for owner, as this allowed me to use different types for Id and owner to catch some of the casting bugs.

Aeglos wrote on Sat, 09 July 2011 18:06


One thing though; last time I tried to use unsigned values (for Resources), I had a heck of an ugly time and needed a tremendous amount of casts to make it work. I asume this wouldn't be the case as Ids/Keys are fairly isolated from the rest of the code as far as setting and getting goes.


It is all handled inside Item. If you are casting with owner or Id (except to/from strings) you are probably doing something wrong.

Aeglos wrote on Sat, 09 July 2011 18:06


Also and just for the record, unisnged types seem to be non conformant with the CLS spec. We shouldn't have any issue though as we are not interoperating across languages.


Possibly an issue for third party tools. I tried to create a type definition for Id and owner so it would be easier to change the type in the future if required, like:

typedef owner_t ushort;


However this is not supported in C#. I would love to have the sort of type control available in ADA for this as it would save me hunting down a lot of runtime issues caused by implicit casts that should be errors, usually where an Id is used instead of a Key.



Have fun.

Report message to a moderator

 
Read Message icon4.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon14.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Turn year
Next Topic: Orders overwriting Star Data
Goto Forum:
  


Current Time: Thu May 02 10:42:40 EDT 2024