[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Camouflage Skill issue (issue with can_see func)

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Camouflage Skill issue (issue with can_see func)

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1  2 

Posted by Dralnu   USA  (277 posts)  [Biography] bio
Date Reply #15 on Tue 06 Sep 2005 05:23 PM (UTC)  quote  ]
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 )?
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #16 on Tue 06 Sep 2005 05:31 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Reply #17 on Tue 06 Sep 2005 05:42 PM (UTC)  quote  ]
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
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #18 on Tue 06 Sep 2005 05:49 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Dralnu   USA  (277 posts)  [Biography] bio
Date Reply #19 on Tue 06 Sep 2005 10:40 PM (UTC)  quote  ]
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...
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #20 on Tue 06 Sep 2005 10:58 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Dralnu   USA  (277 posts)  [Biography] bio
Date Reply #21 on Thu 08 Sep 2005 06:01 AM (UTC)  quote  ]
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 -.-
[Go to top] top

Posted by Gohan_TheDragonball   USA  (183 posts)  [Biography] bio
Date Reply #22 on Thu 08 Sep 2005 09:18 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by Dralnu   USA  (277 posts)  [Biography] bio
Date Reply #23 on Thu 08 Sep 2005 07:14 PM (UTC)  quote  ]
Message
I ment client, as in using something like zmud instead of telnet for connection...
[Go to top] 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.


5,642 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]