Re: [CODE] Scan snippet

From: George (greerga@CIRCLEMUD.ORG)
Date: 04/28/98


On Tue, 28 Apr 1998, Mark Gerritsen wrote:

>At 06:33 PM 4/27/98 -0400, George wrote:
>>>  maxdis = (1 + ((GET_SKILL(ch, SKILL_SCAN) * 5) / 100));
>>>  if (GET_LEVEL(ch) >= LVL_IMMORT)
>>>    maxdis = 7;
>>
>>Might as well not calculate it if you're just going to assign it again
>>later for immortals.
>
>Mortals use the calculation. On our MUD, everyone can scan into the
>adjecent rooms, but only thieves have the scan skill, and, depending on how
>well they've practiced it, get from (1 + ((0 * 5) / 100)) = 1 to (1 + ((100
>* 5) / 100)) = 6 rooms distance. Imm+ can scan 7 rooms in each direction,
>regardless of class.

I meant:

if (GET_LEVEL(ch) >= LVL_IMMORT)
  maxdis = 7;
else
  maxdis = (1 + ((GET_SKILL(ch, SKILL_SCAN) * 5) / 100));

It does add a jump, but removes a lot of variable work.

>>>  is_in = ch->in_room;
>>>  for (dir = 0; dir < NUM_OF_DIRS; dir++) {
>>>    ch->in_room = is_in;
>>
>>I don't see a real use for the 'is_in' variable in there.
>>
>If that is_in wasn't there to reset ch->room to the actual room the char is
>in after every direction, you'd scan around corners, or even in circles.
>For instance, if your skill would grant you a distance of 2, your
>"scan-path" would be this:

I didn't see 'is_in' or 'ch->in_room' ever change in that code.  I just
reviewed it and saw the assignment in there, so disregard that. :)

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST