Fixed infinite loop in fixed gates.

Fixed gate destination will not open when dialed into.
This commit is contained in:
Drakia 2011-02-18 22:24:46 -08:00
parent 0d6d680fcc
commit 94d5a3b0a3
3 changed files with 16 additions and 23 deletions

3
README
View File

@ -79,6 +79,9 @@ gate-folder - The folder containing your .gate files
============= =============
Changes Changes
============= =============
[Version 0.14]
- Fixed infinite loop in fixed gates.
- Fixed gate destination will not open when dialed into.
[Version 0.13] [Version 0.13]
- Fixed gates no longer show in destination list. - Fixed gates no longer show in destination list.
[Version 0.12] [Version 0.12]

View File

@ -50,7 +50,6 @@ public class Portal {
private Blox[] entrances; private Blox[] entrances;
private boolean verified; private boolean verified;
private boolean fixed; private boolean fixed;
private boolean gracePeriod;
private ArrayList<String> destinations = new ArrayList<String>(); private ArrayList<String> destinations = new ArrayList<String>();
private String network; private String network;
private Gate gate; private Gate gate;
@ -80,7 +79,6 @@ public class Portal {
this.button = button; this.button = button;
this.verified = verified; this.verified = verified;
this.fixed = dest.length() > 0; this.fixed = dest.length() > 0;
this.gracePeriod = false;
this.network = network; this.network = network;
this.name = name; this.name = name;
this.gate = gate; this.gate = gate;
@ -101,14 +99,6 @@ public class Portal {
} }
} }
public synchronized boolean manipGrace(boolean set, boolean var) {
if (!set) {
return gracePeriod;
}
gracePeriod = var;
return false;
}
public boolean isOpen() { public boolean isOpen() {
return isOpen || isAlwaysOn(); return isOpen || isAlwaysOn();
} }
@ -149,10 +139,9 @@ public class Portal {
// Open remote gate // Open remote gate
if (!isAlwaysOn()) { if (!isAlwaysOn()) {
player = openFor; player = openFor;
manipGrace(true, true);
Portal end = getDestination(); Portal end = getDestination();
if (end != null && !end.isOpen()) { if (end != null && !end.isFixed() && !end.isOpen()) {
end.open(openFor, false); end.open(openFor, false);
end.setDestination(this); end.setDestination(this);
if (end.isVerified()) end.drawSign(); if (end.isVerified()) end.drawSign();
@ -164,15 +153,8 @@ public class Portal {
public void close(boolean force) { public void close(boolean force) {
if (isAlwaysOn() && !force) return; // Never close an always open gate if (isAlwaysOn() && !force) return; // Never close an always open gate
if (!isAlwaysOn()) {
Portal end = getDestination();
if (end != null && end.isOpen()) {
end.deactivate(); // Clear it's destination first.
end.close(false);
}
}
// Close this gate, then the dest gate.
for (Blox inside : getEntrances()) { for (Blox inside : getEntrances()) {
inside.setType(gate.getPortalBlockClosed()); inside.setType(gate.getPortalBlockClosed());
} }
@ -182,6 +164,15 @@ public class Portal {
Stargate.openList.remove(this); Stargate.openList.remove(this);
Stargate.activeList.remove(this); Stargate.activeList.remove(this);
if (!isAlwaysOn()) {
Portal end = getDestination();
if (end != null && end.isOpen()) {
end.deactivate(); // Clear it's destination first.
end.close(false);
}
}
deactivate(); deactivate();
} }
@ -435,7 +426,6 @@ public class Portal {
id.setText(++done, "To: " + destination); id.setText(++done, "To: " + destination);
id.setText(++done, " (" + network + ") "); id.setText(++done, " (" + network + ") ");
} else { } else {
manipGrace(true, true);
int index = destinations.indexOf(destination); int index = destinations.indexOf(destination);
if ((index == max) && (max > 1) && (++done <= 3)) { if ((index == max) && (max > 1) && (++done <= 3)) {

View File

@ -1,6 +1,6 @@
name: Stargate name: Stargate
main: net.TheDgtl.Stargate.Stargate main: net.TheDgtl.Stargate.Stargate
version: 0.13 version: 0.14
description: Stargate mod for Bukkit description: Stargate mod for Bukkit
author: Drakia author: Drakia
website: http://www.thedgtl.net website: http://www.thedgtl.net