@Override
    public void mouseReleased(MouseEvent e) {

        if (_up != null) {
            int[] pos = setUpNearest(e);

			if (_up.getType() == BoardObject.type.SETTLEMENT)

				gameLogic.writeBuildSettlement(pos[0],pos[1]);

			else if (_up.getType() == BoardObject.type.CITY)

				gameLogic.writeBuildCity(pos[0],pos[1]);

			else if ((_up.getType() == BoardObject.type.ROAD) && (((Road)_up).oneDown == true)) {

				gameLogic.writeBuildRoad(((Road)_up).mycoord[0],((Road)_up).mycoord[1],pos[0],pos[1]);
			}

			if (_up.getType() == BoardObject.type.ROAD) {
				if (((Road)_up).oneDown == false) {

					_up.setX(hexleft+((pos[0]-(pos[0]%2))/2*intervalSide[0]+(pos[0]-(pos[0]%2))/2*intervalSide[1]+(pos[0]%2)*intervalSide[0])+_display_offset[0]);
					_up.setY(hextop+pos[1]*intervalUp+_display_offset[1]);

					((Road)_up).oneDown = true;
					((Road)_up).mycoord = pos;

					_mousedown = null;
					e.consume();
				}
				else {
					((Road)_up).setX2(hexleft+((pos[0]-(pos[0]%2))/2*intervalSide[0]+(pos[0]-(pos[0]%2))/2*intervalSide[1]+(pos[0]%2)*intervalSide[0]));
					((Road)_up).setY2(hextop+pos[1]*intervalUp);
					((Road)_up).oneDown = true;
					_up = null;
					_mousedown = null;
				}
			}
			else {
				_up.setX(hexleft+((pos[0]-(pos[0]%2))/2*intervalSide[0]+(pos[0]-(pos[0]%2))/2*intervalSide[1]+(pos[0]%2)*intervalSide[0])-_up.getW()/2);
				_up.setY(hextop+pos[1]*intervalUp-_up.getH()/2);
            	_up = null;
				_mousedown = null;
			}


            
        }
        repaint();
    }