浏览代码

DEV: Comment rework

tags/v1.0b1
父节点
当前提交
b1c59453c1
共有 2 个文件被更改,包括 11 次插入10 次删除
  1. +10
    -9
      src/net/hoo2/auth/labyrinth/Board.java
  2. +1
    -1
      src/net/hoo2/auth/labyrinth/Game.java

+ 10
- 9
src/net/hoo2/auth/labyrinth/Board.java 查看文件

@@ -270,14 +270,15 @@ class Board {
* Predicate to check if a wall creates a closed room.
*
* This algorithm has a complexity of O(N^2) where N represents the total
* number of tiles it should be used with care.
* number of tiles.
* It should be used with care.
*
* @param tileId The tileId of the wall where the wall is.
* @param direction The wall's relative direction from the tile.
* @return True if the wall creates a closed room, false otherwise.
*/
private boolean createsClosedRoom (int tileId, int direction) {
// Get a snapshot of the current walls
private boolean makesClosedRoom (int tileId, int direction) {
// Get a snapshot list of all the walls (all the walls on the board)
ArrayList<Edge> w = new ArrayList<Edge>();
for (Edge it : walls)
w.add(new Edge(it));
@@ -286,13 +287,13 @@ class Board {
Graph g = new Graph(new Edge(tileId, direction));
int size;
do {
size = w.size();
size = w.size(); // mark the size (before the pass)
for (int i =0, S=w.size() ; i<S ; ++i)
if (g.attach(w.get(i))) {
w.remove(i);
--i; --S;
if (g.attach(w.get(i))) { // Can we attach the edge(wall) to the graph ?
w.remove(i); // If yes remove it from the wall list
--i; --S; // decrease iterator and size to match ArrayList's new values
}
} while (size != w.size());
} while (size != w.size()); // If the size hasn't change(no new graph leafs) exit

// Search if a vertex is attached more than once.
// This means that there is at least 2 links to the same node
@@ -342,7 +343,7 @@ class Board {
if (tiles[rightTileId.apply(tileId)].hasWalls() >= Const.maxTileWalls) return false;
break;
}
if (Session.loopGuard && createsClosedRoom(tileId, direction))
if (Session.loopGuard && makesClosedRoom(tileId, direction))
return false;
return true;
}


+ 1
- 1
src/net/hoo2/auth/labyrinth/Game.java 查看文件

@@ -83,7 +83,7 @@ public class Game {
case "--norooms":
Session.loopGuard = true;
break;
case "-i":
case "--interactive":
Session.interactive = true;


正在加载...
取消
保存