[CF-Devel] PATCH: allow building a director beneath the player

crossfire-devel-admin at archives.real-time.com crossfire-devel-admin at archives.real-time.com
Wed Mar 5 23:59:34 CST 2003


Jochen Suckfuell wrote:
>
     
      Hi!
     
     >
     
     
     >
     
      For quite some time, it wasn't possible any more to build a director right
     
     >
     
      beneath the player. But this is a very important thing, because you often use
     
     >
     
      directors to shoot around corners where the room is only one space wide.
     
     
  One could argue that is a design limitation of the spell.

>
     
     
     >
     
      Until now, you got the message "Something is in the way." when trying to cast
     
     >
     
      a director with "." (stay fire). This was presumably done to prevent build *
     
     >
     
      walls to build a wall beneath the player (all build * spells are handled in
     
     >
     
      the same function).
     
     >
     
      I moved the check whether the destination field is blocked into the cases
     
     >
     
      where we know which object is created. For directors, we then apply the
     
     >
     
      "blocked" check only if the destination is different from the player's
     
     >
     
      position.
     
     
  I think this is fine.  I'd actually replace your code with something a bit 
less redundant:

***************
*** 2668,2674 ****

       m = op->map;

!     if(get_map_flags(m, &m, x, y, &x, &y) & (P_BLOCKED | P_OUT_OF_MAP)) {
         new_draw_info(NDI_UNIQUE, 0,op,"Something is in the way.");
         return 0;
       }
--- 2667,2681 ----

       m = op->map;

!     /* Basically, if player is casting build directory, they can cast it on
!      * the space they are standing, so don't check for blocked in that
!      * case (we'll also presume that the fact that the player is on a space
!      * means he's withing the map).  Always check the map if we're not
!      * doing a directory, or if the target space for the feature does not
!      * match the space the player (op) is on.
!      */
!     if ((spell_effect != SP_BUILD_DIRECTOR || x != op->x || y != op->y) &&
!         (get_map_flags(m, &m, x, y, &x, &y) & (P_BLOCKED | P_OUT_OF_MAP))) {
         new_draw_info(NDI_UNIQUE, 0,op,"Something is in the way.");
         return 0;
       }

  Arguable, there is some other code in that function that could be reduced, 
like the setting of the food/hp/maxhp values, which all the functions set in the 
exact same code.




_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list