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
➜ Camouflage Skill issue (issue with can_see func)
|
Camouflage Skill issue (issue with can_see func)
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
| Posted by
| Dralnu
USA (277 posts) Bio
|
| Date
| Reply #15 on Tue 06 Sep 2005 05:23 PM (UTC) |
| Message
| Looking through the code, it looks like if the target isn't ch, then...
But anyways, would it be better to add the ifcheck before if( !ch )? | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #16 on Tue 06 Sep 2005 05:31 PM (UTC) |
| Message
| Oh, ok... you don't know what null pointers are, then.
So pointers point to memory addresses, right? Well, sometimes a pointer can point 'nowhere' - this is what is called a null pointer.
Characters have pointers to their group leaders. However, if a character has no leader, that pointer will be null. That is a way of indicating that although there is this pointer, it currently is "empty" - in other words, don't try to follow it and find what character lies at the other end.
Dereferencing a null pointer is a Very Bad Thing (tm). This will crash your program:CHAR_DATA * ch = NULL;
ch->age = 123;
So, when one writes "if ( !ch )" it has nothing to do with whether or not ch is the target or things like that. What it actually means is: "if ( ch == NULL )".
Don't ask me why this function would be called with a NULL ch. It's really kind of strange, but apparently they had a good reason to do it. It could just be a security, again because having a null pointer can mean blowing up your program.
So there you go - putting your ifcheck before the "if ( !ch )" line would be a Very Bad Thing (tm). :-) |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #17 on Tue 06 Sep 2005 05:42 PM (UTC) |
| Message
| | The reason is for the web server. Smaug has one, and of course viewing the online who list on a web has no ch. When I added cloak, I forgot to add the check in that !ch ifcheck, and someone viewed the online who list. Bam, crash. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #18 on Tue 06 Sep 2005 05:49 PM (UTC) |
| Message
| | Ah, ok... thanks for clearing that up. :) (This is a place where comments would have been useful...) |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Dralnu
USA (277 posts) Bio
|
| Date
| Reply #19 on Tue 06 Sep 2005 10:40 PM (UTC) |
| Message
| | I think I see what I had missed, but back to the original issue: How COULD I get this done the way I want it to get done, or where could I alter true sight itself? I looked for it and didn't see it... | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #20 on Tue 06 Sep 2005 10:58 PM (UTC) |
| Message
| | Err, haven't we already determined that? The if victim-is-camouflaged and if-ch-is-not-a-ranger? |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Dralnu
USA (277 posts) Bio
|
| Date
| Reply #21 on Thu 08 Sep 2005 06:01 AM (UTC) |
| Message
| | Nvm. I'll figure it out some other time. I did it the way I thought it would, and honestly I'm still not sure wtf I'm doing, so until it finally clicks, I'm leaving it as is. This isn't me giving up, this is me retreating to relaod -.- | | Top |
|
| Posted by
| Gohan_TheDragonball
USA (183 posts) Bio
|
| Date
| Reply #22 on Thu 08 Sep 2005 09:18 AM (UTC) |
| Message
| | Maybe I missed something but, you do realize you are editing a codebase that uses telnet right? unless you removed the IAC negotiations and did something completely different, which for all I know is completely possible, how do you expect to connect to your mud. | | Top |
|
| Posted by
| Dralnu
USA (277 posts) Bio
|
| Date
| Reply #23 on Thu 08 Sep 2005 07:14 PM (UTC) |
| Message
| | I ment client, as in using something like zmud instead of telnet for connection... | | 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.
75,405 views.
This is page 2, subject is 2 pages long:
1
2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top