Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
AFKMud 2.2.2
Mar 3, 2019 5:35 pm
By Samson
Development
Nov 28, 2018 12:10 pm
By Keirath
First Immortal
Oct 12, 2018 2:02 pm
By GatewaySysop
Bug in do_climb( )
Jun 5, 2018 7:31 pm
By joeyfogas
question on overland code
May 31, 2018 12:03 pm
By joeyfogas
SmaugFUSS 1.9.3
Author: Various
Submitted by: Samson
AFKMud 2.2.2
Author: AFKMud Team
Submitted by: Samson
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Google

Members: 0
Guests: 17
Stats
Files
Topics
Posts
Members
Newest Member
483
3,743
19,401
655
RodrickMci
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds » Codebases » SmaugFUSS » Bug: mobile_update -fleeing d...
Forum Rules | Mark all | Recent Posts

Bug: mobile_update -fleeing does not check stay_area flag
< Newer Topic :: Older Topic > Inconsistency w/wander behavior

Pages:<< prev 1 next >>
Post is unread #1 Feb 22, 2012 8:41 pm
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts396
JoinedMar 7, 2005

Another of these things you come upon that makes you scratch your head. I'm not surprised this was never noticed, but it should probably be fixed. :facepalm:

In update.c, mobile_update, you'll find this piece in the /* Flee */ section ...
      if( ch->hit < ch->max_hit / 2
          && ( door = number_bits( 4 ) ) <= 9
          && ( pexit = get_exit( ch->in_room, door ) ) != NULL
          && pexit->to_room
          && !IS_SET( pexit->exit_info, EX_WINDOW )
          && !IS_SET( pexit->exit_info, EX_CLOSED )
          && !xIS_SET( pexit->to_room->room_flags, ROOM_NO_MOB ) && !xIS_SET( pexit->to_room->room_flags, ROOM_DEATH ) )


Unlike the /* Wander */ section just above, the /* Flee */ section does not check before potentially moving the mobile into an adjacent area. If the mobile is flagged as stay_area, that restriction will not work. Indeed, not only will they flee into another area, they will never return because they can't wander into another area.

The fix is to simply follow suit with the check in /* Wander */, i.e.

      if( ch->hit < ch->max_hit / 2
          && ( door = number_bits( 4 ) ) <= 9
          && ( pexit = get_exit( ch->in_room, door ) ) != NULL
          && pexit->to_room
          && !IS_SET( pexit->exit_info, EX_WINDOW )
          && !IS_SET( pexit->exit_info, EX_CLOSED )
          && !xIS_SET( pexit->to_room->room_flags, ROOM_NO_MOB ) && !xIS_SET( pexit->to_room->room_flags, ROOM_DEATH ) 
          && ( !xIS_SET( ch->act, ACT_STAY_AREA ) || pexit->to_room->area == ch->in_room->area ) )


And then you're good to go. :cool:
       
Pages:<< prev 1 next >>