Page 1 of 1

L2WorldRegion activate/deactivate

Posted: Wed Aug 18, 2010 10:52 pm
by Phantom2005
Hello while I was checking L2WorldRegion I was wondering why "activation" DOES have setActive(true) and "deactivation" doesn't have setActive(false);

"deactivation" says "// start a timer to "suggest" a deactivate to self and neighbors."

Why does activation setActive then? It's basically the same method but only a different Config.
So basically setActive can be removed from "startActivation()" method.

Because else it's just a duplication? (not optimized)

EDIT:
Why don't you replace both methods with just one?
Remove startActivation() && startDeactivation()

Code: Select all

  /** * This method will switch activation of a region * @param activation */private void switchActive(){	boolean _activation = isActive() ? false : true;	synchronized (this)	{		if(_neighborsTask != null)		{			_neighborsTask.cancel(true);			_neighborsTask = null;		}		_neighborsTask = ThreadPoolManager.getInstance().scheduleGeneral(new NeighborsTask(_activation), 1000 * (_activation ? Config.GRID_NEIGHBOR_TURNON_TIME : Config.GRID_NEIGHBOR_TURNOFF_TIME));	}} 

Re: L2WorldRegion activate/deactivate

Posted: Thu Aug 19, 2010 1:03 pm
by Stake
getSurroundingRegions() method includes L2WorldRegion's self region too, since it adds itself into the list by addSurroundingRegion() in initRegions(), so self check would also be unnecessary in any L2WorldRegion method. It needs a little rework to be optimized.