Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Ah, more asteroids.
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Nick Cash
USA (626 posts) Bio
|
| Date
| Fri 07 May 2004 (UTC) |
| Message
| Ok, well, first off I'm having some linking issues. I'll not ask you all to fix these for me (yet :P). But I am having trouble. It appears that the following code is hanging the entire mud up, making me have to restart:
for ( asteroid = ship->starsystem->first_asteroid; asteroid; asteroid = asteroid->next_in_system)
{
if (abs(ship->vx - asteroid->x) < 1 &&
abs(ship->vy - asteroid->y) < 1 &&
abs(ship->vz - asteroid->z) < 1 )
{
ship->collision = asteroid->maxhp;
asteroid->collision = ship->maxhull;
}
}
The only conclusions I've come by is that the asteroid doesnt have an x/y/z. Anyways, I'd ask that you look over http://ew.xidus.net/code/3.0a.c and http://ew.xidus.net/code/asteroids.h for the actual asteroid code. Perhaps you could find any errors in the linking I've got. |
~Nick Cash
http://www.nick-cash.com | | Top |
|
| Posted by
| Nick Cash
USA (626 posts) Bio
|
| Date
| Reply #1 on Fri 07 May 2004 12:02 AM (UTC) |
| Message
| | By the way, this only happens after an asteroid has been destroy and put back in the system. The linking errors are within starsystems because if I go to my Terra star system EVERY asteroid is in the list and display on look and radar. However, you cannot target or fire at them. |
~Nick Cash
http://www.nick-cash.com | | Top |
|
| Posted by
| Nick Cash
USA (626 posts) Bio
|
| Date
| Reply #2 on Fri 07 May 2004 12:54 AM (UTC) |
| Message
| | Something tells me its extract_asteroid. I don't think the unlink is needed. |
~Nick Cash
http://www.nick-cash.com | | Top |
|
| Posted by
| Nick Cash
USA (626 posts) Bio
|
| Date
| Reply #3 on Thu 13 May 2004 04:14 AM (UTC) |
| Message
| Hmm, perhaps you all can spot something wrong with this function.
/*
* Extract the asteroid from a starsystem
*/
bool extract_asteroid( ASTEROID_DATA *asteroid )
{
SPACE_DATA *starsystem;
starsystem = asteroid->starsystem;
if ( asteroid == NULL || starsystem == NULL )
return FALSE;
if ( starsystem != NULL )
{
if ( starsystem->last_asteroid == asteroid )
starsystem->last_asteroid = asteroid->prev_in_system;
if ( starsystem->first_asteroid == asteroid )
starsystem->first_asteroid = asteroid->next_in_system;
if ( asteroid->prev_in_system )
asteroid->prev_in_system->next_in_system = asteroid->next_in_system;
if ( asteroid->next_in_system)
asteroid->next_in_system->prev_in_system = asteroid->prev_in_system;
}
UNLINK( asteroid, starsystem->first_asteroid, starsystem->last_asteroid, next_in_system, prev_in_system );
asteroid->starsystem = NULL;
return TRUE;
}
Thanks, hopefully we'll find something. I think it has to do with the UNLINK. Perhaps some of what it does is already taken care of above? |
~Nick Cash
http://www.nick-cash.com | | Top |
|
| Posted by
| Nick Cash
USA (626 posts) Bio
|
| Date
| Reply #4 on Thu 13 May 2004 04:42 AM (UTC) |
| Message
| | ::sigh:: Posting before I mess with it myself sure makes me look stupid. It appears I had my loop wrong, and was referencing to the master asteroid list (asteroid->next) rather than the individual list of each starystem (asteroid->next_in_system) and I am actually having no linking issues. However, I would still like to know about extract_asteroid. I'll go conjure some other problem for oyu all to solve. |
~Nick Cash
http://www.nick-cash.com | | 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.
11,576 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top