Changed synchronization method for getAi.

This commit is contained in:
MobiusDevelopment 2019-11-04 18:12:29 +00:00
parent 90c4c92ec9
commit eaa8f64803
18 changed files with 144 additions and 36 deletions

View File

@ -1742,13 +1742,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1742,13 +1742,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1742,13 +1742,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1742,13 +1742,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1742,13 +1742,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1742,13 +1742,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1742,13 +1742,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1742,13 +1742,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -2243,13 +2243,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = new CreatureAI(new AIAccessor()); _ai = ai = new CreatureAI(new AIAccessor());
} }
}
}
return ai; return ai;
} }

View File

@ -2498,13 +2498,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -2500,13 +2500,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1741,13 +1741,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1741,13 +1741,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1741,13 +1741,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1742,13 +1742,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1742,13 +1742,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1742,13 +1742,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }

View File

@ -1741,13 +1741,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI. * Gets this creature's AI.
* @return the AI * @return the AI
*/ */
public synchronized CreatureAI getAI() public CreatureAI getAI()
{ {
CreatureAI ai = _ai; CreatureAI ai = _ai;
if (ai == null) if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{ {
_ai = ai = initAI(); _ai = ai = initAI();
} }
}
}
return ai; return ai;
} }