Register forum user name Search FAQ

Gammon Forum

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 ➜ Heartbeat/tick Function and adding new loadable data

Heartbeat/tick Function and adding new loadable data

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


Posted by Celestine   (29 posts)  Bio
Date Fri 01 Aug 2003 02:44 PM (UTC)
Message
After quite a while of searching, I was still unable to find the function which has the heartbeat/tick counter in it. I don't know if that's what it's called in SMAUG, but it's basically the function which holds info for the time between rounds and the time between the healing of movement/health/mana?
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 01 Aug 2003 11:58 PM (UTC)
Message
update_handler in update.c?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Celestine   (29 posts)  Bio
Date Reply #2 on Sat 02 Aug 2003 03:24 AM (UTC)
Message
Another question I have is adding data. I'm using swr, and I took a look at the shiploading functions. I'm trying to modify it so that each ship can have any weapons instead of just the lasers and missiles that come with stock swr. Basically what I'm doing is:
a) adding a new data structure for the weapon
b) adding all the file i/o required to store a list of weapons.
c) creating all the functions to make this new weapon loadable for ships

Basically, I'm stuck on step b right now. I'm looking at the load_weapon_file code which is based off of the load_ship_file function. On the line which reads "CREATE( weapon, WEAPON_DATA, 1);", I'm getting an error from cygwin which reads, "Assignment from incompatible data type". I'm wondering where this CREATE function is, and if possible, what is the problem with it right now?

bool load_weapon_file( char *weaponfile )
{
char filename[256];
SHIP_DATA *weapon;
FILE *fp;
bool found;

CREATE( weapon, WEAPON_DATA, 1 );

found = FALSE;
sprintf( filename, "%s%s", WEAPON_DIR, weaponfile );

if ( ( fp = fopen( filename, "r" ) ) != NULL )
{

found = TRUE;
for ( ; ; )
{
char letter;
char *word;

letter = fread_letter( fp );
if ( letter == '*' )
{
fread_to_eol( fp );
continue;
}

if ( letter != '#' )
{
bug( "Load_weapon_file: # not found.", 0 );
break;
}
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 02 Aug 2003 04:27 AM (UTC)
Message
This looks wrong for a start ...

Quote:

SHIP_DATA *weapon;
FILE *fp;
bool found;

CREATE( weapon, WEAPON_DATA, 1 );


Don't you mean:


WEAPON_DATA *weapon;
FILE *fp;
bool found;

CREATE( weapon, WEAPON_DATA, 1 );

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Celestine   (29 posts)  Bio
Date Reply #4 on Sat 02 Aug 2003 05:43 AM (UTC)
Message
thanks. Making me feel stupid as usual. Wish I caught those mistakes by myself. Anyways, I have yet another question. Seeing as these weapons are implemented into the swr database, what would be the best way of storing the weapons of a ship on the server while running? A list perhaps?
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.


14,200 views.

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

Go to topic:           Search the forum


[Go to top] top

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