[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 13:56:54 CST 2003


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.

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.

Bye
Jochen

----------------  patch  -------------------


Index: server/spell_effect.c
===================================================================
RCS file: /cvsroot/crossfire/crossfire/server/spell_effect.c,v
retrieving revision 1.101
diff -c -r1.101 spell_effect.c
*** server/spell_effect.c	3 Mar 2003 05:13:08 -0000	1.101
--- server/spell_effect.c	5 Mar 2003 19:47:01 -0000
***************
*** 2668,2680 ****
  
      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;
-     }
- 
      switch(spell_effect) {
  	case SP_BUILD_DIRECTOR:
  	    sprintf(buf1,"director_%d",dir);
  	    tmp=get_archetype(buf1);
  	    SET_FLAG(tmp, FLAG_IS_USED_UP);
--- 2668,2680 ----
  
      m = op->map;
  
      switch(spell_effect) {
  	case SP_BUILD_DIRECTOR:
+ 	    if((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;
+ 	    }
+ 
  	    sprintf(buf1,"director_%d",dir);
  	    tmp=get_archetype(buf1);
  	    SET_FLAG(tmp, FLAG_IS_USED_UP);
***************
*** 2684,2689 ****
--- 2684,2694 ----
  	    break;
  
  	case SP_BUILD_LWALL:
+ 	    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;
+ 	    }
+ 
  	    sprintf(buf1,"lightningwall_%d",dir);
  	    tmp=get_archetype(buf1);
  	    SET_FLAG(tmp, FLAG_IS_USED_UP);
***************
*** 2695,2700 ****
--- 2700,2710 ----
  	    break;
  
  	case SP_BUILD_BWALL:
+ 	    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;
+ 	    }
+ 
  	    sprintf(buf1,"lbulletwall_%d",dir);
  	    tmp=get_archetype(buf1);
  	    SET_FLAG(tmp, FLAG_IS_USED_UP);
***************
*** 2706,2711 ****
--- 2716,2726 ----
  	    break;
  
  	case SP_BUILD_FWALL:
+ 	    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;
+ 	    }
+ 
  	    sprintf(buf1,"firewall_%d",dir);
  	    tmp=get_archetype(buf1);
  	    SET_FLAG(tmp, FLAG_IS_USED_UP);



-- 
Jochen Suckfuell  ---  
     
     http://www.suckfuell.net/jochen/
     
       ---

_______________________________________________
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