Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, 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.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Oh looks like I broke nanny.
Oh looks like I broke nanny.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Mopop
(115 posts) Bio
|
Date
| Tue 31 Jan 2006 03:33 PM (UTC) |
Message
| In my quest to remove vampires from the game, I had to remove a few lines of code from comm.c the thing is I am not sure if I deleted TOO much or not enough. Things started getting weird on compile saying I needed to deleting things that were never wrong to begin with. None the less i deleted them to compile and get the server back up. Of course now I cant even log on, so yes I will need alittle assistance.
Here is the first thing I edited
write_to_buffer( d, "\r\nYou may choose from the following races, or type help [race] to learn more:\r\n[", 0 );
buf[0] = '\0';
for( iRace = 0; iRace < MAX_PC_RACE; iRace++ )
{
if( iRace != RACE_VAMPIRE
&& race_table[iRace]->race_name && race_table[iRace]->race_name[0] != '\0'
&& !IS_SET( race_table[iRace]->class_restriction, 1 << ch->Class )
&& str_cmp( race_table[iRace]->race_name, "unused" ) )
{
if( iRace > 0 )
{
if( strlen( buf ) + strlen( race_table[iRace]->race_name ) > 77 )
{
mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH );
write_to_buffer( d, buf, 0 );
buf[0] = '\0';
}
else
mudstrlcat( buf, " ", MAX_STRING_LENGTH );
}
mudstrlcat( buf, race_table[iRace]->race_name, MAX_STRING_LENGTH );
}
}
now It looks like this in my comm.c
write_to_buffer( d, "\r\nYou may choose from the following races, or type help [race] to learn more:\r\n[", 0 );
buf[0] = '\0';
for( iRace = 0; iRace < MAX_PC_RACE; iRace++ )
{
if( iRace > 0 )
{
if( strlen( buf ) + strlen( race_table[iRace]->race_name ) > 77 )
{
mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH );
write_to_buffer( d, buf, 0 );
buf[0] = '\0';
}
else
mudstrlcat( buf, " ", MAX_STRING_LENGTH );
}
mudstrlcat( buf, race_table[iRace]->race_name, MAX_STRING_LENGTH );
}
}
After that it said breaks and cases were in the wrong place and I deleted them which I think really messed the mud up. There is more to this but Im going to see if maybe this is the problem before posting more. | Top |
|
Posted by
| Nick Cash
USA (626 posts) Bio
|
Date
| Reply #1 on Tue 31 Jan 2006 03:53 PM (UTC) |
Message
| From the code you pasted it looks like you have one to many curly braces at the end. This will cause a very long list of errors.
You will probably want to keep that if check around, just remove the vampire clause from it, as so:
if( race_table[iRace]->race_name && race_table[iRace]->race_name[0] != '\0'
&& !IS_SET( race_table[iRace]->class_restriction, 1 << ch->Class )
&& str_cmp( race_table[iRace]->race_name, "unused" ) )
|
~Nick Cash
http://www.nick-cash.com | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #2 on Tue 31 Jan 2006 05:44 PM (UTC) |
Message
| Yup. What WK said.
Note that you removed the if check without really reading it. :) The whole thing is relevant to people that aren't vampires -- in other words, your whole set of characters. So you should be making the subsequent checks to everybody. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Mopop
(115 posts) Bio
|
Date
| Reply #3 on Tue 31 Jan 2006 07:11 PM (UTC) |
Message
| It wasnt so much I didnt read it, it was I didnt understand what it did :( I am still pretty new at this and can only read/write a little code. But as always I thank you guys for your help! | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #4 on Tue 31 Jan 2006 07:15 PM (UTC) |
Message
| What don't you understand from the statement: if( iRace != RACE_VAMPIRE
&& race_table[iRace]->race_name && race_table[iRace]->race_name[0] != '\0'
&& !IS_SET( race_table[iRace]->class_restriction, 1 << ch->Class )
&& str_cmp( race_table[iRace]->race_name, "unused" ) )
We can go through this statement step by step, if you would like. It would probably be good for you to understand more precisely what's going on -- you'll be able to better make this kind of change without breaking fundamental things accidentally. :) |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Mopop
(115 posts) Bio
|
Date
| Reply #5 on Tue 31 Jan 2006 07:17 PM (UTC) |
Message
| Step by step please ^_^ | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #6 on Tue 31 Jan 2006 07:50 PM (UTC) |
Message
| OK:
// Line 1: if the current race number isn't "vampire".
// note that we're in a for loop over all the race numbers.
if( iRace != RACE_VAMPIRE
// Line 2: AND, if the current race -- race_table[iRace] means look up the "iRace" entry in the table --
// has a non-null race_name pointer,
// AND, the first character of this pointer is not the zero character
&& race_table[iRace]->race_name && race_table[iRace]->race_name[0] != '\0'
// This one has some degree of voodoo, I'll grant...
// basically, it means make sure that the "iRace" entry
// is not forbidden to take the character's chosen class
&& !IS_SET( race_table[iRace]->class_restriction, 1 << ch->Class )
// and, make sure that the race entry's name isn't "unused".
// (str_cmp returns 0 i.e. false on equality, and non-zero i.e. true on difference. Go figure.)
&& str_cmp( race_table[iRace]->race_name, "unused" ) )
Hope this helps... |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | 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,988 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top