More SWR Planets

Posted by Miked on Mon 04 Jul 2005 09:38 PM — 8 posts, 28,576 views.

USA #0
How do I add more than three planets to a starsystem in SWR 1.0?
Canada #1
You have to do one of two things: add a fourth(or fifth, sixth, etc) variable to the SYSTEM_DATA structure, or you can change the structure to use linked lists instead of predefined sections. I did this last option myself so that I can infinite amount of celestial bodies in a system.
USA #2
How do I do the latter?
Canada #3
I actually made a new structure for celestial bodies with coordinates, type, name, etc, and made a linked list of them in SYSTEM_DATA. in do_radar for example, just cycle through the list printing the ones you want out. How familiar are you with c? It's probably a little much for a beginner, but it could be done.
USA #4
It seems like the first one would be alot more difficult that you make it sound. Wouldn't I have to add all kinds of stuff to space.c to handle all the new planets?
Canada #5
The second is the more difficult of the 2 options, as you are redoing a good portion of the code, where the first options, adding planet4, planet5, etc, is adding more variables to use the current system. This method is basically search for the existing one and add on to it. if you make it so planets use linked lists, you have to make new loading functions, new commands to set all the variables, to create the planets, and modify where planets are used to access "for( planet = system->first_planet; planet; planet = planet->next)" instead of "planet1; planet2; etc". The advantage to the second method of redoing how its done is that it allows massive expansion by builders rather than having a coder at a 6th, 7th, 8th, 9th, etc.
USA #6
I guess I am going to use the first method as I only need nine, because I am not going to use hyperspace and need my planets in one system. Thanks for the help. I now have some serious coding to due.I assume I have increase the "doc"s and locations in space.c to match up with the new planets, right?
Canada #7
Yes, if your going to go that method you would need to have additional docs for all the planets as well.

As a side note, I'm assuming your making it our solar system, and therefore the names and such would not change? If thats the case, you could even hard code that information to improve the speed of the program. If your ever planning on expanding it past that though, keep with your current plans.