Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: apply fog fix



Hi,

Applying a fog and similar objects (type ENCOUNTER) didn't work as
expected, i.e. it didn't do anything but it didn't tell the caller that
it didn't do anything.  For example, if a fog was over an exit, you
couldn't press 'a' to use the exit.

There is now a difference between applying an ENCOUNTER object that is
a floor (FLAG_IS_FLOOR; a player applying it may create a random
encounter map) and applying other encounter objects.

Furthermore, I have changed apply_below() and monster_apply_below() to
not apply objects below a floor object.  Maybe this is wrong, but I did
not see any reason for it.  This change might break a map, but are
there any maps using such obscure features?

And because the only occurence of 'apply' in disease.c was in the rcsid
variable name, I've fixed all rcsid_xxx_c variables in the server
subdirectory.  This is only a cosmetic fix.

-- 
Jan
diff -ru orig/crossfire-0.95.5-patch3/server/apply.c crossfire-0.95.5/server/apply.c
--- orig/crossfire-0.95.5-patch3/server/apply.c	Mon Apr 10 15:54:21 2000
+++ crossfire-0.95.5/server/apply.c	Mon Apr 10 15:22:37 2000
@@ -1036,6 +1036,11 @@
 /* apply returns 0 if it wasn't possible to apply that object, 1
  * if the object was applied, 2 if the object is now a different
  * object.
+ *
+ * crossfire-0.95.5: Return value of apply() is currently used by
+ * apply_below() in apply.c, apply_inventory() in c_object.c and
+ * check_good_weapon()/check_good_armour() in monster.c
+ *
  */
 /* op is the object that is causing object to be applied, tmp is the object
  * being applied.
@@ -1247,9 +1252,13 @@
     break;
   case ENCOUNTER:
 #ifdef RANDOM_ENCOUNTERS
-    random_encounter(op, tmp);
+    if (op->type == PLAYER && QUERY_FLAG (op, FLAG_IS_FLOOR))
+    {
+        random_encounter(op, tmp);
+        return 1;
+    }
 #endif
-    break;
+    return 0;
   case SHOP_MAT:
     {
       SET_FLAG(op,FLAG_NO_APPLY);
@@ -1911,6 +1920,8 @@
     for ( ; tmp!=NULL; tmp=next) {
 	next = tmp->below;
 	if (apply(op, tmp, 0)) return;
+        if (QUERY_FLAG (tmp, FLAG_IS_FLOOR))
+            return;   /* don't look below a floor */
     }
 }
 
diff -ru orig/crossfire-0.95.5-patch3/server/c_party.c crossfire-0.95.5/server/c_party.c
--- orig/crossfire-0.95.5-patch3/server/c_party.c	Wed Mar 22 08:56:48 2000
+++ crossfire-0.95.5/server/c_party.c	Mon Apr 10 14:25:44 2000
@@ -1,5 +1,5 @@
 /*
- * static char *rcsid_input_c =
+ * static char *rcsid_c_party_c =
  *   "$Id: c_party.c,v 1.2 1999/07/13 06:03:04 cvs Exp $";
  */
 /*
diff -ru orig/crossfire-0.95.5-patch3/server/commands.c crossfire-0.95.5/server/commands.c
--- orig/crossfire-0.95.5-patch3/server/commands.c	Wed Mar 22 08:56:48 2000
+++ crossfire-0.95.5/server/commands.c	Mon Apr 10 14:25:33 2000
@@ -1,5 +1,5 @@
 /*
- * static char *rcsid_ban_c =
+ * static char *rcsid_commands_c =
  *   "$Id: commands.c,v 1.36 1999/07/13 05:21:22 master Exp $";
  */
 
diff -ru orig/crossfire-0.95.5-patch3/server/daemon.c crossfire-0.95.5/server/daemon.c
--- orig/crossfire-0.95.5-patch3/server/daemon.c	Wed Mar 22 08:56:48 2000
+++ crossfire-0.95.5/server/daemon.c	Mon Apr 10 14:25:20 2000
@@ -1,5 +1,5 @@
 /*
- * static char *rcsid_deamon_c =
+ * static char *rcsid_daemon_c =
  *   "$Id: daemon.c,v 1.2 1999/07/13 06:03:04 cvs Exp $";
  */
 
diff -ru orig/crossfire-0.95.5-patch3/server/disease.c crossfire-0.95.5/server/disease.c
--- orig/crossfire-0.95.5-patch3/server/disease.c	Wed Mar 22 08:56:48 2000
+++ crossfire-0.95.5/server/disease.c	Mon Apr 10 14:24:40 2000
@@ -1,5 +1,5 @@
 /*
- * static char *rcsid_apply_c =
+ * static char *rcsid_disease_c =
  *   "$Id: disease.c,v 1.3 1999/03/25 10:41:33 master Exp $";
  */
 /*
diff -ru orig/crossfire-0.95.5-patch3/server/gods.c crossfire-0.95.5/server/gods.c
--- orig/crossfire-0.95.5-patch3/server/gods.c	Fri Apr  7 16:45:50 2000
+++ crossfire-0.95.5/server/gods.c	Mon Apr 10 14:25:07 2000
@@ -1,5 +1,5 @@
 /*
- * static char *rcsid_apply_c =
+ * static char *rcsid_gods_c =
  *   "$Id: gods.c,v 1.14 2000/03/16 07:38:51 master Exp $";
  */
 /*
diff -ru orig/crossfire-0.95.5-patch3/server/monster.c crossfire-0.95.5/server/monster.c
--- orig/crossfire-0.95.5-patch3/server/monster.c	Wed Mar 22 08:56:48 2000
+++ crossfire-0.95.5/server/monster.c	Mon Apr 10 17:54:05 2000
@@ -864,6 +864,8 @@
         apply(monster,tmp,0); 
       break;
     }
+    if (QUERY_FLAG (tmp, FLAG_IS_FLOOR))
+        break;
   }
 }
 
diff -ru orig/crossfire-0.95.5-patch3/server/spell_effect.c crossfire-0.95.5/server/spell_effect.c
--- orig/crossfire-0.95.5-patch3/server/spell_effect.c	Fri Apr  7 16:45:50 2000
+++ crossfire-0.95.5/server/spell_effect.c	Mon Apr 10 14:26:16 2000
@@ -1,5 +1,5 @@
 /*
- * static char *rcsid_newspells_c =
+ * static char *rcsid_spell_effect_c =
  *   "$Id: spell_effect.c,v 1.33 2000/03/16 07:44:17 master Exp $";
  */
 
diff -ru orig/crossfire-0.95.5-patch3/server/spell_util.c crossfire-0.95.5/server/spell_util.c
--- orig/crossfire-0.95.5-patch3/server/spell_util.c	Fri Apr  7 14:32:54 2000
+++ crossfire-0.95.5/server/spell_util.c	Mon Apr 10 14:26:25 2000
@@ -1,5 +1,5 @@
 /*
- * static char *rcsid_spells_c =
+ * static char *rcsid_spell_util_c =
  *   "$Id: spell_util.c,v 1.36 2000/03/16 07:50:15 master Exp master $";
  */