Looking at my code from just before I changed how positions work, I see that I fixed this by putting
some checks in the auto-exit handling section of the interpret() function in interp.cpp (probably .c in
most SMAUGs though):
if((pexit = find_door(ch, command, TRUE)) != NULL && IS_SET(pexit->exit_info, EX_xAUTO)){
if(IS_SET(pexit->exit_info, EX_CLOSED) && (!IS_AFFECTED(ch, AFF_PASS_DOOR) || IS_SET(pexit->exit_info, EX_NOPASSDOOR))){
if(!IS_SET(pexit->exit_info, EX_SECRET) && IS_AWAKE(ch))
act(AT_PLAIN, "The $d is closed.", ch, NULL, NULL, TO_CHAR, pexit->keyword);
else
send_to_char("Huh?\r\n", ch);//WAS "You cannot do that here." but did not want to give a hint to secret
return;
}
if(check_pos(ch, POS_STANDING))
move_char(ch, pexit, 0);
return;
}
send_to_char("Huh?\r\n", ch);
I put the position check right before the actual move as that is what is actually affected
by the position. I also added a check to see if you are awake in the closed door section.
The idea there was if the character was awake, they could see the door was closed even
if in a position that they could not move to it (note that since this code, I have added extra
support for blindness and dark rooms in this visibility check). As a note if someone tries
to use this code: I had fully hardened the act() function for any format string and function
input. I moved the string based inputs to two defaulted arguments at the end of the input
list, so to use in a more stock system, the last argument should be moved to where the
2nd NULL is now.
It would seem if you put the position check in the if that is checking for the auto-exit, you
would get the bad position message from check_pos() and then get the huh? from the fall
through. This though is still much better then putting the checks in move_char(), which
is conceptually wrong.