Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » Stars! Nova - Development » FleetIntel question
Re: FleetIntel question Mon, 11 July 2011 03:15 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 Mon, 11 July 2011 06:53

I'm working on this, but I want to be clear on something.

Daniel wrote on Sat, 09 July 2011 20:22

So StarReport for your homeworld is actually the same object as the Star for your homeworld, using polymorphism.


Does this mean that effectively OwnedStars<X> should be exactly the same as StarReports<X>? Or it was meant in a more liberal sense where OwnedStars<X> is the extended object of StarReports<X>?

Because in the first case I do not see much sense in having the OwnedStars collection if they are all duplicates of things already found in StarReports. (Same for with fleets).




No. OwnedStars is a subset of StarReports with a different type definition. ie
Dictionary<string,Star] OwnedStars;
Dictionary<string,StarReport] StarReports;

thus:
StarReports[x] as Star

would be equivellent to
OwnedStars[x]


There are no "duplicates" because they are all reference objects. If you change the fields of OwnedStars[x], you are also changing StarReports[x]. However you would generally be looking at different fields anyway so that is not the point.

The point is that you can itterate through EmpireData.StarReports when you only care about data you might get from stars you do not own (e.g. map drawing); and you would itterate through EmpireData.OwnedStars when you want to be garunteed that all the Stars considered are owned by the current empire, such as when selecting next/prev planet in the production view (not sure if you can even do this yet).



Have fun.

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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bugs/Other Trackers
Next Topic: Anyone still around?
Goto Forum:
  


Current Time: Sat May 04 10:15:13 EDT 2024