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?
Heartbeat/tick Function and adding new loadable data
Posted by Celestine on Fri 01 Aug 2003 02:44 PM — 5 posts, 18,596 views.
update_handler in update.c?
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;
}
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;
}
This looks wrong for a start ...
Don't you mean:
Quote:
SHIP_DATA *weapon;
FILE *fp;
bool found;
CREATE( weapon, WEAPON_DATA, 1 );
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 );
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?