[CF-Devel] Minor fix to a major bug.

crossfire-devel-admin at archives.real-time.com crossfire-devel-admin at archives.real-time.com
Sat Oct 18 01:20:52 CDT 2003


Hi again!

Today Drashian, a metalforge's player told me about a bug he found. He
accidentally noticed that the 'fire command can take as a parameter mostly any
integer. After a few tries he realized that the outcome of using some specific
skills (like jumping) was the player beeing teleported to the related position
to the given integer, or in order to attack skills (any old phisique-like
skill)the result was attacking the monster that is standing on the suposed place
without the player moving from it's place... even when the square isn't
adjacent to the player position. So it's is a very safe way to kill monsters
on the whole map without the monsters noticing you or even taking treasures from
not allowed places, even on non magic maps.

Here is the diff with the changes i made. I hope they are good enough and i'll
be looking forward just in case there are some other functions that do something
like that.

The idea was just limitting the player to use the 'fire or the 'run command only
in the 9 basic directions that is from 0 to 8.

I couldn't try it on a local server but i think the changes are pretty simple.
Anyway I will do it as soon as i get it to compile (what seems to be taking too
long, couldnt say why)

Greetings,
Katia.
-- 
+-----------------------------+
|
     
      Karla  Mª  Stenger  Sábat   |
     
     |
     
      Pando . Canelones . Uruguay |
     
     |
     
     
      kstenger at montevideo.com.uy
      
        |
     
     +-----------------------------+
-------------- next part --------------
Index: c_new.c
===================================================================
RCS file: /cvsroot/crossfire/crossfire/server/c_new.c,v
retrieving revision 1.6
diff -u -r1.6 c_new.c
--- c_new.c	20 Mar 2002 06:27:46 -0000	1.6
+++ c_new.c	18 Oct 2003 05:53:28 -0000
@@ -114,8 +114,15 @@
 
 int command_run(object *op, char *params)
 {
+    int dir;
     op->contr->run_on=1;
-    return (move_player(op, params?atoi(params):0));
+    dir = params?atoi(params):0;
+    if ( params<0 || params>=9 ){
+        new_draw_info(NDI_UNIQUE, 0,op,"Can't run into a non adjacent square.");
+        return 0;
+    }
+    else
+        return move_player(op, dir);
 }
 
 int command_run_stop(object *op, char *params)
@@ -126,8 +133,15 @@
 
 int command_fire(object *op, char *params)
 {
+    int dir;
     op->contr->fire_on=1;
-    return move_player(op, params?atoi(params):0);
+    dir = params?atoi(params):0;
+    if ( params<0 || params>=9 ){
+        new_draw_info(NDI_UNIQUE, 0,op,"Can't fire to a non adjacent square.");
+        return 0;
+    }
+    else
+        return move_player(op, dir);
 }
 
 int command_fire_stop(object *op, char *params)
    
    


More information about the crossfire mailing list