Fixed redundant looping when removing/finishing a director. Fixed issue where packets to delete content group wouldn't send. Fixed issue where ContentGroups/Directors weren't clearing after deletion causing a growing amount of zombie groups/directors.

This commit is contained in:
Filip Maj 2017-06-25 14:52:32 -04:00
parent 875b76634a
commit 019e305525
6 changed files with 15 additions and 8 deletions

View File

@ -596,6 +596,11 @@ namespace FFXIVClassic_Map_Server
player.positionZ = spawnZ;
player.rotation = spawnRotation;
//Delete any GL directors
GuildleveDirector glDirector = player.GetGuildleveDirector();
if (glDirector != null)
player.RemoveDirector(glDirector);
//Delete content if have
if (player.currentContentGroup != null)
{

View File

@ -501,7 +501,7 @@ namespace FFXIVClassic_Map_Server.Actors
lock (directorLock)
{
Director director = new Director(directorIdCount, this, path, args);
currentDirectors.Add(directorIdCount, director);
currentDirectors.Add(director.actorId, director);
directorIdCount++;
return director;
}
@ -549,7 +549,7 @@ namespace FFXIVClassic_Map_Server.Actors
lock (directorLock)
{
GuildleveDirector director = new GuildleveDirector(directorIdCount, this, directorScriptPath, glid, difficulty, owner, args);
currentDirectors.Add(directorIdCount, director);
currentDirectors.Add(director.actorId, director);
directorIdCount++;
return director;
}

View File

@ -1441,12 +1441,12 @@ namespace FFXIVClassic_Map_Server.Actors
}
}
public Director GetGuildleveDirector()
public GuildleveDirector GetGuildleveDirector()
{
foreach (Director d in ownedDirectors)
{
if (d is GuildleveDirector)
return d;
return (GuildleveDirector)d;
}
return null;

View File

@ -18,6 +18,7 @@ namespace FFXIVClassic_Map_Server.actors.director
private List<Actor> members = new List<Actor>();
private bool isCreated = false;
private bool isDeleted = false;
private bool isDeleting = false;
private Script directorScript;
private Coroutine currentCoroutine;
@ -121,6 +122,7 @@ namespace FFXIVClassic_Map_Server.actors.director
public void EndDirector()
{
isDeleting = true;
if (this is GuildleveDirector)
((GuildleveDirector)this).EndGuildleveDirector();
@ -142,6 +144,8 @@ namespace FFXIVClassic_Map_Server.actors.director
{
if (members.Contains(actor))
members.Remove(actor);
if (GetPlayerMembers().Count == 0 && !isDeleting)
EndDirector();
}
public List<Actor> GetMembers()

View File

@ -46,8 +46,6 @@ namespace FFXIVClassic_Map_Server.actors.director
guildleveWork.uiState[3] = 1;
guildleveWork.aimNumNow[0] = guildleveWork.aimNumNow[1] = guildleveWork.aimNumNow[2] = guildleveWork.aimNumNow[3] = 0;
LoadGuildleve();
}
public void LoadGuildleve()

View File

@ -128,7 +128,7 @@ namespace FFXIVClassic_Map_Server.actors.group
public void DeleteGroup()
{
SendDeletePackets();
SendDeletePackets(members);
for (int i = 0; i < members.Count; i++)
{
Session s = Server.GetServer().GetSession(members[i]);