Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » Stars! Nova - Development » Item.Mass - should this be an abstract property?
Re: Item.Mass - should this be an abstract property? Tue, 13 March 2012 18:39 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
Indeed, on better examination it looks like not even ShipDesign might need mass/cost, as it can derive them from the sum of it's hull/components.

I'll implement a "buildableobject" (name pending, I suck at naming classes) and remove component from the current inheritance altogether.


EDIT-

Ok. I moved Mass and Cost to Component instead of introducing a middle object. They are now responsible for keeping that data. Other classes like Fleet or ShipDesign still have properties to access Mass and Cost information, but they are just calculated properties;

i.e. ShipDesign.Cost just returns the sum of it's component's costs, Fleet.Mass returns the sum of it's token's masses, etc.

Since Fleet/ShipDesign/Whatever don't need to share an interface or be polymorphic with Components, I think this is the cleanest way to improve the design.

Component doesn't need a Key, but it needs the Name that Item provides. I'd leave it as it is, as I think it would be nice to change the components to actually USE the Key field in the future (not critical though)... not really a fan of indexing by string name.


[Updated on: Wed, 14 March 2012 01:04]

Report message to a moderator

 
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: Production classes - IProductionUnit and derivates
Next Topic: Spam posts
Goto Forum:
  


Current Time: Sun Apr 28 22:18:27 EDT 2024