L2WorldRegion activate/deactivate

This is not a Support area! Discuss about the Server here. Non-Server related discussion goes in Off-Topic Discussion.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Phantom2005
Posts: 72
Joined: Wed Jul 06, 2005 4:27 pm
Location: Netherlands

L2WorldRegion activate/deactivate

Post 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));	}} 
"If 64 bits isn't enough, the next logical step is 128 bits. That's enough to survive Moore's Law until I'm dead, and after that, it's not my problem."
©Jeff Bonwick
User avatar
Stake
Posts: 383
Joined: Sun Mar 23, 2008 9:33 pm
Location: Hungary
Contact:

Re: L2WorldRegion activate/deactivate

Post 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.
Image
Image
Post Reply