[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?
(New message)
Subject: Camouflage Skill issue (issue with can_see func)
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  

Posted by Dralnu   USA  (277 posts)  [Biography] bio
Date 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

Posted by Gohan_TheDragonball   USA  (183 posts)  [Biography] bio
Date 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 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 David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date 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 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 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 Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date 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 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 Dralnu   USA  (277 posts)  [Biography] bio
Date 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 Tue 06 Sep 2005 06:58 AM (UTC)  quote  ]
Message
I'm not sure I understand your question. Just put your camo ifcheck outside the truesight and after the "if ( !ch )" checks.

Is the problem that you don't know why "if ( !ch )" is there, i.e. what it does and why it's important?

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 Tue 06 Sep 2005 01:32 AM (UTC)  quote  ]

Amended on Tue 06 Sep 2005 01:53 AM (UTC) by Dralnu

Message
Then give me an idea what to do? I'm stumped now -.-

I did add a check into the TRUE_SIGHT bit to get part of it fixed, but in any case, and I think I'm going to leave it there for the time being. Got other things to do, and I'll fix things up later and build around it until I can think of something better
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Mon 05 Sep 2005 07:38 AM (UTC)  quote  ]
Message
What's wrong with telnet? :-)

Anyhow your code won't work, because you put all that stuff under the ifcheck "if (!ch)" but then you check ch->class... basically what you're doing is saying "if ch is null, then do the following..." But that's not at all what you want to do; in fact you want to make sure that ch is NOT null before continuing.

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 Mon 05 Sep 2005 07:01 AM (UTC)  quote  ]
Message

/*
 * True if char can see victim.
 */
bool can_see( CHAR_DATA * ch, CHAR_DATA * victim )
{
   if( !victim )  /* Gorog - panicked attempt to stop crashes */
      return FALSE;
   if( !ch )
   {
      if( ch->Class != CLASS_RANGER && IS_AFFECTED( victim, AFF_CAMO) )
         return FALSE;
else if( IS_AFFECTED( victim, AFF_INVISIBLE ) || IS_AFFECTED( victim, AFF_HIDE ) || IS_AFFECTED( victim, AFF_CAMO || xIS_SET( victim->act, PLR_WIZINVIS ) ) )
         return FALSE;
      else
         return TRUE;
   }

   if( ch == victim )
      return TRUE;

   if( !IS_NPC( victim ) && xIS_SET( victim->act, PLR_WIZINVIS ) && get_trust( ch ) < victim->pcdata->wizinvis )
      return FALSE;

   /*
    * SB 
*/
   if( IS_NPC( victim ) && xIS_SET( victim->act, ACT_MOBINVIS ) && get_trust( ch ) < victim->mobinvis )
      return FALSE;

   /*
    * Deadlies link-dead over 2 ticks aren't seen by mortals -- Blodkai
    */
   if( !IS_IMMORTAL( ch ) && !IS_NPC( ch ) && !IS_NPC( victim ) && IS_PKILL( victim ) && victim->timer > 1 && !victim->desc )
      return FALSE;

   if( !IS_NPC( ch ) && xIS_SET( ch->act, PLR_HOLYLIGHT ) )
      return TRUE;

   /*
    * The miracle cure for blindness? -- Altrag 
    */
   if( !IS_AFFECTED( ch, AFF_TRUESIGHT ) )
   {
      if( IS_AFFECTED( ch, AFF_BLIND ) )
         return FALSE;

      if( room_is_dark( ch->in_room ) && !IS_AFFECTED( ch, AFF_INFRARED ) )
         return FALSE;

      if( IS_AFFECTED( victim, AFF_INVISIBLE ) && !IS_AFFECTED( ch, AFF_DETECT_INVIS ) )
         return FALSE;

      if( IS_AFFECTED( victim, AFF_HIDE )
          && !IS_AFFECTED( ch, AFF_DETECT_HIDDEN )
          && !victim->fighting && ( IS_NPC( ch ) ? !IS_NPC( victim ) : IS_NPC( victim ) ) )
         return FALSE;
   }

   /*
    * Redone by Narn to let newbie council members see pre-auths. 
    */
   if( NOT_AUTHED( victim ) )
   {
      if( NOT_AUTHED( ch ) || IS_IMMORTAL( ch ) || IS_NPC( ch ) )
         return TRUE;

      if( ch->pcdata->council && !str_cmp( ch->pcdata->council->name, "Newbie Council" ) )
         return TRUE;

      return FALSE;
   }

 /* Commented out for who list purposes 
    if (!NOT_AUTHED(victim) && NOT_AUTHED(ch) && !IS_IMMORTAL(victim) 
    && !IS_NPC(victim))
   	return FALSE;*/
   return TRUE;
}


That is the code as-is after changes. Right now I cann't test it since I'm lacking a client to connect with, If you see any problems or whatever, please let me know, and let me know if you know of a good client for Linux :)
[Go to top] top

Posted by Dralnu   USA  (277 posts)  [Biography] bio
Date Mon 05 Sep 2005 01:53 AM (UTC)  quote  ]
Message
Plus this is a class-specific skill, and the class might come out peaceful only, so it won't be a problem pk-wise if that were to happen
[Go to top] top

Posted by Dralnu   USA  (277 posts)  [Biography] bio
Date Mon 05 Sep 2005 01:52 AM (UTC)  quote  ]
Message
I'm planning on making additions to the skill/spell system laterm but the way I see it, true sight is something more magical then anything. Bad-ass camouflage it may be called, but way I see it, someone who is invis will have a magical aura around them, and someone who is just hiding can be found easily enough. This will, maybe later, be outdoors/forest only (I plan on making most of the world forest anyways, at least half). I'll post the changes I made later. It has compiled cleanly enough, but as is I have no way to test it since I don't have a Linux MUD client (and I won't use telnet since I have no clue how to).
[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,637 views.

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

[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]