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

Re: [CF:1363] FIX: glow radius doesnīt work anymore



> I have noticed that glowing objects donīt glow anymore
> in cf-version 0.95.6. Before, one could light up small
> areas of dark maps by inserting objects with the "glow_radius"-
> variable set (e.g. glow_radius 4).
> Still working are only glowing objects that are created during play.
> That is: Torches lit up by players, fire and spells of light.

> I donīt know weither that is intentional or not. Perhaps
> someone wanted players to use torches in dungeons?
> Nice idea if so, but I donīt like it. Players will keep using
> x-ray-helmets on dark maps - torches are neat, but nobody is gonna
> start using them that way.

> And so many nice effects could be done with the glow_radius-
> feature: glowing lava, illuminated dungeon entrances, ...

This is indeed a bug.  I sent in a patch to fix this a while back, but 
apparently it got lost in the shuffle.  The map loading code is now 
using insert_ob_in_map_simple() which does not add lights to the 
linked list for the map.  I copied the relevant snippet of code from 
insert_ob_in_map() into insert_ob_in_map_simple() and the problem 
vanished.

Attached is another copy of my patch to fix this irritation.  Mark, 
would you mind incorporating it? :-)


Index: common/object.c
===================================================================
RCS file: /home/jhantin/Repository/crossfire/common/object.c,v
retrieving revision 1.3
diff -b -c -5 -r1.3 object.c
*** common/object.c	2000/06/07 01:08:40	1.3
--- common/object.c	2000/06/09 02:51:26
***************
*** 1309,1318 ****
--- 1309,1331 ----
        }
      }
    }
    else
      set_map_ob(op->map,op->x,op->y,op);   /* Tell the map that we're here */
+ 
+   /* build up linked list of light sources in each map. We do
+    * this even for non-dark maps, as down the line we might make
+    * a spell/effect which effects the global light of any map.
+    * -b.t.
+    */
+ #ifdef USE_LIGHTING
+         if(op->glow_radius>0&&light_not_listed(op)) {
+ 		add_light_to_map(op,m);
+ 		update_all_los(m);
+ 	} else if(m->darkness&&(op->glow_radius>0||op->lights)) /* a light moved, check los */
+ 		update_all_los(m);
+ #endif 
    
    if(op->type==PLAYER)
      op->contr->do_los=1;
    for(tmp=get_map_ob(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above)
      switch(tmp->type) {