Skip to content

Commit

Permalink
Finally fixed segments not updating in multiplayer (no idea why it on…
Browse files Browse the repository at this point in the history
…ly affects multiplayer)
  • Loading branch information
Mars committed Feb 5, 2023
1 parent 9379fc6 commit 3d2ea5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/me/mars/Bridges.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,12 @@ static void bridgeBuilt(ItemBridgeBuild bridge) {
// queue2.add(() -> lastConfigs.put(bridge.pos(), bridge.link));
queue.add(() -> {
// Form for incoming
Seq<Segment> intersected = new Seq<>();
for (int i = 0; i < bridge.incoming.size; i++) {
intersected.clear();
int pos = bridge.incoming.items[i];
both(tree -> tree.intersect(Point2.x(pos), Point2.y(pos), 1, 1, Bridges::updateEnd));
both(tree -> tree.intersect(Point2.x(pos), Point2.y(pos), 1, 1, intersected));
intersected.each(Bridges::updateEnd);
formSegment(pos);
}
// Form for link
Expand Down
2 changes: 0 additions & 2 deletions src/me/mars/Segment.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ static void setRect(int x, int y, int x2, int y2, Rect out) { // Non inclusive
public static ItemBridgeBuild getEnd(ItemBridgeBuild start, IntSeq bridges) {
ItemBridgeBuild next = start;
byte startDir = linkDir(start);
// bridges.add(next.pos());

while (Vars.world.build(next.link) instanceof ItemBridgeBuild nextLink && next != nextLink && linkDir(next) == startDir) {
bridges.add(next.pos());
next = nextLink;
Expand Down

0 comments on commit 3d2ea5c

Please sign in to comment.