1 /***********************************************************************
2  *
3  * Copyright (C) 2007-2008 Graeme Gott <graeme@gottcode.org>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  ***********************************************************************/
19 
20 #include "cell.h"
21 
22 #include <QDataStream>
23 
24 // ============================================================================
25 
Cell()26 Cell::Cell()
27 :	m_left_wall(true),
28 	m_right_wall(true),
29 	m_top_wall(true),
30 	m_bottom_wall(true),
31 	m_flag(false),
32 	m_path_marker(0)
33 {
34 }
35 
36 // ============================================================================
37 
setPathMarker(int angle)38 void Cell::setPathMarker(int angle)
39 {
40 	Q_ASSERT(angle == 90 || angle == 180 || angle == 270 || angle == 360);
41 	m_path_marker = angle / 90;
42 }
43 
44 // ============================================================================
45 
operator <<(QDataStream & stream,const Cell & cell)46 QDataStream& operator<<(QDataStream& stream, const Cell& cell)
47 {
48 	return stream << cell.m_path_marker << cell.m_flag;
49 }
50 
operator >>(QDataStream & stream,Cell & cell)51 QDataStream& operator>>(QDataStream& stream, Cell& cell)
52 {
53 	return stream >> cell.m_path_marker >> cell.m_flag;
54 }
55 
56 // ============================================================================
57