Skip to content

Commit

Permalink
fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jupahe64 committed Nov 8, 2023
2 parents c4f5807 + f2a291d commit b3524dd
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
22 changes: 20 additions & 2 deletions Fushigi/course/CourseLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public BymlHashTable BuildNode()

public ulong GetSrcHash()
{
if (mSource == null)
{
return 0;
}

return mSource.GetHash();
}

Expand Down Expand Up @@ -77,6 +82,16 @@ public bool IsDestValid(CourseActorHolder actorHolder)
return actorHolder.HasHash(mDest.GetHash());
}

public bool IsSourceActorExist()
{
return mSource != null;
}

public bool IsDestActorExist()
{
return mDest != null;
}

CourseActor? mSource;
CourseActor? mDest;
string mLinkName;
Expand Down Expand Up @@ -193,11 +208,14 @@ public bool IsAnyLinkInvalid(CourseActorHolder holder)

public BymlArrayNode SerializeToArray()
{
BymlArrayNode node = new((uint)mLinks.Count);
BymlArrayNode node = new();

foreach(CourseLink link in mLinks)
{
node.AddNodeToArray(link.BuildNode());
if (link.IsSourceActorExist() && link.IsDestActorExist())
{
node.AddNodeToArray(link.BuildNode());
}
}

return node;
Expand Down
18 changes: 18 additions & 0 deletions Fushigi/course/CourseRail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,24 @@ public CourseActorToRailLinks()

}

public void RemoveLinkFromSrc(ulong hash)
{
int idx = -1;
foreach (Link link in mLinks)
{
if (link.Source.GetHash() == hash)
{
idx = mLinks.IndexOf(link);
break;
}
}

if (idx != -1)
{
mLinks.RemoveAt(idx);
}
}

public BymlArrayNode SerializeToArray()
{
BymlArrayNode node = new((uint)mLinks.Count);
Expand Down
7 changes: 7 additions & 0 deletions Fushigi/ui/CourseAreaEditContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public void DeleteActor(CourseActor actor)
DeleteActorFromAllGroups(actor.GetHash());
DeleteLinksWithSrcHash(actor.GetHash());
DeleteLinksWithDestHash(actor.GetHash());
DeleteRail(actor.GetHash());
mUndoHandler.AddToUndo(area.mActorHolder.GetActors()
.RevertableRemove(actor));

Expand Down Expand Up @@ -215,5 +216,11 @@ public CourseActorHolder GetActorHolder()
{
return area.mActorHolder;
}

public void DeleteRail(ulong hash)
{
Console.WriteLine($"Removing Rail attached to {hash}");
area.mRailLinks.RemoveLinkFromSrc(hash);
}
}
}
12 changes: 11 additions & 1 deletion Fushigi/ui/widgets/CourseScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,20 @@ private void SelectionParameterPanel()
ImGui.NextColumn();

CourseActor? destActor = selectedArea.mActorHolder[hashArray[i]];

if (destActor != null)
{
if (ImGui.Button(destActor.mName, new Vector2(ImGui.GetContentRegionAvail().X, 0)))
{

if (ImGui.Button(destActor.mName, new Vector2(ImGui.GetContentRegionAvail().X, 0)))
}
}
else
{
if (ImGui.Button("Actor Not Found"))
{

}
}

ImGui.NextColumn();
Expand Down

0 comments on commit b3524dd

Please sign in to comment.