map.h
Go to the documentation of this file.
1 /*
2  * This file is part of Laustracker.
3  *
4  * Copyright (C) 2013 Christian Jann <christian.jann@ymail.com>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef HEADER_LAUSTRACKER_MAP_H_INCLUDED
21 #define HEADER_LAUSTRACKER_MAP_H_INCLUDED
22 
29 #include <iostream>
30 using namespace std;
31 
36 typedef enum PosEnum { P_TOP, P_BOTTOM, P_LEFT, P_RIGHT, P_CENTER, P_OTHER } PosType;
37 extern const char* pos_to_str[];
38 
43 enum { red, green, neutral, none };
44 
51 typedef struct field_t
52 {
53  bool wall_top, wall_bottom, wall_left, wall_right;
54  bool buoy_top, buoy_bottom, buoy_left, buoy_right;
55 
56 } field_t;
57 
58 
65 {
66 
67 private:
68 
69  void set_single_wall(int x, int y, PosType pos, bool state);
70  int debuglevel;
71  bool test;
72  void init_map();
73 
74 public:
75 
77  field_t fields[8][8];
78 
80  string map_path;
81 
88  LabyrinthMap();
89 
96  ~LabyrinthMap();
97 
107  void setWall(int x, int y, PosType pos, bool state);
108 
119  bool getWall(int x, int y, PosType pos);
120 
121  void setDebug(int level);
122 
128  string toString();
129 
138  bool fromString(string map_str);
139 
146  bool save();
147 
154  bool load();
155 
156 };
157 
158 #endif
Data structure for a single labyrinth field.
Definition: map.h:51
enum PosEnum PosType
Possible positions within a field.
Class contains complete information about the labyrinth structure.
Definition: map.h:64
struct field_t field_t
Data structure for a single labyrinth field.
PosEnum
Possible positions within a field.
Definition: map.h:36
string map_path
File to save or load the map.
Definition: map.h:80