wyvern.kernel.maps
Class MapDirtyRegions

java.lang.Object
  extended bywyvern.kernel.maps.MapDirtyRegions

public final class MapDirtyRegions
extends java.lang.Object

A class that encapsulates the set of squares in a map that have visually invalidated since the last time the CameraManager refreshed the cameras for that map.

Version:
1.0, Jun 26, 2003
Author:
Steve Yegge

Constructor Summary
MapDirtyRegions(BitMatrix changeList)
           
 
Method Summary
 void clear()
           
 boolean didLightTurnOff()
          Returns true if setLightTurnedOff() was called since the last call to clear().
 BitMatrix getBitMatrix()
          Returns the BitMatrix containing the squares that have become visually invalid.
 boolean isEmpty()
           
 void setLightTurnedOff()
          Works around a problem with the design of the camera system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapDirtyRegions

public MapDirtyRegions(BitMatrix changeList)
Method Detail

isEmpty

public boolean isEmpty()

clear

public void clear()

getBitMatrix

public BitMatrix getBitMatrix()
Returns the BitMatrix containing the squares that have become visually invalid.


setLightTurnedOff

public void setLightTurnedOff()
Works around a problem with the design of the camera system.

The current camera-system design has a problem: the DisplayPolicy optimizes for areas you can't see, so if you turn off a light, you can't see it turn off (because the map is dark). The workaround, until I can think of something more elegant, is to keep track of the fact that the lights are off, so the Frame won't do its can-see optimization on this refresh. If we wanted to use double the memory (per map, and per Frame), we could keep *another* BitMatrix in each map and Frame that indicates areas where a light turned off. It would work, but could potentially be expensive. Maybe not as expensive as the extra network bandwidth used by this approach, though. This bit (lightTurnedOff) is cleared when you call clear().


didLightTurnOff

public boolean didLightTurnOff()
Returns true if setLightTurnedOff() was called since the last call to clear().