1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-23 05:07:47 +00:00

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.positionZ = spawnZ;
player.rotation = spawnRotation; player.rotation = spawnRotation;
//Delete any GL directors
GuildleveDirector glDirector = player.GetGuildleveDirector();
if (glDirector != null)
player.RemoveDirector(glDirector);
//Delete content if have //Delete content if have
if (player.currentContentGroup != null) if (player.currentContentGroup != null)
{ {

View file

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

View file

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

View file

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

View file

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

View file

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