List <Position> _generateSubPath_sub_3(List <Position> temp_vector, List <Position> to_vector) { List <Position> result = new List <Position>(); foreach (Position pos in temp_vector) { if (_generateSubPath_sub_2(pos)) { maze_room_internal room = getRoom(pos); bool vect = true; for (int i = 0; i < 4; i++) { if (room.directions[i] == 2) { vect = false; to_vector.Add(pos); break; } } if (vect) { result.Add(pos); } } } return(result); }
public void markReservedPosition(Position pos) { maze_room_internal room = rooms[pos.X][pos.Y]; if (room.isVisited == 0) // I'm not really clear on this, since it's basically used as a boolean, but, is an integer.. for whatever reason. So, again, guesswork. { room.isReserved = true; } }
void _undo_move(int count = 1) { for (int i = 0; i < count; i++) { maze_move move = CriticalPath[CriticalPath.Count - 1]; CriticalPath.Remove(CriticalPath[CriticalPath.Count - 1]); maze_room_internal current_room = getRoom(move.pos_from); maze_room_internal next_room = getRoom(move.pos_to); int opposite_direction = Direction.GetOppositeDirection(move.direction); if (next_room.isVisited != 0) // Utter guesswork, but really the only thing that could make sense. { current_room.directions[move.direction] = 0; next_room.directions[opposite_direction] = 0; next_room.isVisited = 0; next_room.isOnCriticalPath = false; counter -= 1; } current_pos = current_pos.GetBiasedPosition(opposite_direction); } }
bool _make_move(int direction) { if (isRoomInDirectionFree(current_pos, direction)) { Position next_pos = current_pos.GetBiasedPosition(direction); maze_room_internal current_room = getRoom(current_pos); maze_room_internal next_room = getRoom(next_pos); maze_move move = new maze_move(current_pos, next_pos, direction); CriticalPath.Add(move); counter++; next_room.Visited(counter); next_room.isOnCriticalPath = true; current_room.directions[direction] = 1; next_room.directions[Direction.GetOppositeDirection(direction)] = 2; current_pos = next_pos; return(true); } return(false); }
bool _generateSubPath_sub_2(Position pos) { maze_room_internal room = getRoom(pos); if (room != null) { for (int i = 0; i < 4; i++) { if (room.GetPassageType(i) == 0) { if (this.isRoomInDirectionFree(pos, i)) { return(true); } } } } return(false); }
bool _create_sub_path_recursive(Position pos) { RoomTrait room = getRoom(pos); maze_room_internal maze_room = maze_generator.getRoom(pos); room.roomType = 1; for (int direction = 0; direction < 4; direction++) { if (maze_room.GetPassageType(direction) == 2) { Position biased_pos = pos.GetBiasedPosition(direction); if (room != null) { room.Link(direction, 2); } return(_create_sub_path_recursive(biased_pos)); } } return(true); }
int _sub(Position pos) { if (getRoom(pos) != null) { int cnt = 1; for (int i_dir = 0; i_dir < 4; i_dir++) { maze_room_internal room = getRoom(pos.GetBiasedPosition(i_dir)); if (room != null) { if (!room.isOccupied()) { cnt += 1; } } } return(cnt); } return(0); }