[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  More SWR Planets

More SWR Planets

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Miked   USA  (30 posts)  [Biography] bio
Date Mon 04 Jul 2005 09:38 PM (UTC)
Message
How do I add more than three planets to a starsystem in SWR 1.0?
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #1 on Tue 05 Jul 2005 12:06 AM (UTC)
Message
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.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by Miked   USA  (30 posts)  [Biography] bio
Date Reply #2 on Tue 05 Jul 2005 12:12 AM (UTC)
Message
How do I do the latter?
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #3 on Tue 05 Jul 2005 01:06 AM (UTC)
Message
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.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by Miked   USA  (30 posts)  [Biography] bio
Date Reply #4 on Wed 06 Jul 2005 11:52 PM (UTC)
Message
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?
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #5 on Thu 07 Jul 2005 02:22 AM (UTC)
Message
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.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by Miked   USA  (30 posts)  [Biography] bio
Date Reply #6 on Thu 07 Jul 2005 02:29 AM (UTC)
Message
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?
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #7 on Thu 07 Jul 2005 02:36 AM (UTC)
Message
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.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,106 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]