00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __PUZZLE_H__
00022 #define __PUZZLE_H__
00023
00028 #include "bt_assert.h"
00029
00030 #include <stdint.h>
00031 #include <vector>
00032 #include <string>
00033
00034 #include <stdint.h>
00035
00036 class voxel_c;
00037 class gridType_c;
00038 class problem_c;
00039 class xmlWriter_c;
00040 class xmlParser_c;
00041
00047 class puzzle_c {
00048
00049 private:
00050
00056 gridType_c *gt;
00057
00061 std::vector<voxel_c*> shapes;
00062
00066 std::vector<problem_c*> problems;
00067
00074 std::vector<uint32_t> colors;
00075
00080 std::string comment;
00081
00087 bool commentPopup;
00088
00089 public:
00090
00095 puzzle_c(const puzzle_c * orig);
00096
00102 puzzle_c(gridType_c * g) : gt(g) , commentPopup(false) { }
00103
00107 puzzle_c(xmlParser_c & pars);
00108
00112 void save(xmlWriter_c & xml) const;
00113
00118 ~puzzle_c(void);
00119
00122 const gridType_c * getGridType(void) const { return gt; }
00123 gridType_c * getGridType(void) { return gt; }
00125
00126
00133 unsigned int addShape(voxel_c * p);
00135 unsigned int addShape(unsigned int sx, unsigned int sy, unsigned int sz);
00137 unsigned int shapeNumber(void) const { return shapes.size(); }
00139 const voxel_c * getShape(unsigned int idx) const { bt_assert(idx < shapes.size()); return shapes[idx]; }
00141 voxel_c * getShape(unsigned int idx) { bt_assert(idx < shapes.size()); return shapes[idx]; }
00147 void removeShape(unsigned int);
00154 void exchangeShape(unsigned int s1, unsigned int s2);
00156
00157
00161 unsigned int addColor(unsigned char r, unsigned char g, unsigned char b);
00169 void removeColor(unsigned int idx);
00171 void changeColor(unsigned int idx, unsigned char r, unsigned char g, unsigned char b);
00173 void getColor(unsigned int idx, unsigned char * r, unsigned char * g, unsigned char * b) const;
00175 unsigned int colorNumber(void) const { return colors.size(); }
00177
00178
00182 unsigned int addProblem(void);
00186 unsigned int addProblem(const problem_c * prob);
00188 unsigned int problemNumber(void) const { return problems.size(); }
00190 void removeProblem(unsigned int p);
00192 void exchangeProblem(unsigned int p1, unsigned int p2);
00194 const problem_c * getProblem(unsigned int p) const { bt_assert(p < problems.size()); return problems[p]; }
00196 problem_c * getProblem(unsigned int p) { bt_assert(p < problems.size()); return problems[p]; }
00198
00199
00203 void setComment(const std::string & com) { comment = com; }
00205 const std::string & getComment(void) const { return comment; }
00207 bool getCommentPopup(void) const { return commentPopup; }
00209 void setCommentPopup(bool val) { commentPopup = val; }
00211
00212 private:
00213
00214
00215 puzzle_c(const puzzle_c&);
00216 void operator=(const puzzle_c&);
00217
00218 };
00219
00220 #endif