fixed some bugs in new 'g'o system
[k8-i-v-a-n.git] / src / game / area.h
blobadbb3f46cfcdd3fd2f514ed16168d01e6fd15b8c
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
12 #ifndef __AREA_H__
13 #define __AREA_H__
15 #include "ivancommon.h"
17 #include <map>
19 #include "rect.h"
22 class character;
23 class square;
24 class bitmap;
25 class outputfile;
26 class inputfile;
29 class area {
30 public:
31 area ();
32 area (int, int);
33 virtual ~area ();
35 public:
36 virtual void Draw (truth) const = 0;
37 void Save (outputfile &) const;
38 void Load (inputfile &);
39 int GetFlag (v2 Pos) const { return FlagMap[Pos.X][Pos.Y]; }
40 void AddFlag (v2 Pos, int What) { FlagMap[Pos.X][Pos.Y] |= What; }
41 square *GetSquare (v2 Pos) const { return Map[Pos.X][Pos.Y]; }
42 square *GetSquare (int x, int y) const { return Map[x][y]; }
43 int GetXSize () const { return XSize; }
44 int GetYSize () const { return YSize; }
45 void SendNewDrawRequest ();
46 void Initialize (int, int);
47 square *GetNeighbourSquare (v2, int) const;
48 truth IsValidPos (v2 Pos) const { return Pos.X >= 0 && Pos.Y >= 0 && Pos.X < XSize && Pos.Y < YSize; }
49 truth IsValidPos (int X, int Y) const { return X >= 0 && Y >= 0 && X < XSize && Y < YSize; }
50 const rect &GetBorder () const { return Border; }
51 void SetEntryPos (int, v2);
53 protected:
54 square ***Map;
55 uChar **FlagMap;
56 int XSize, YSize;
57 feuLong XSizeTimesYSize;
58 rect Border;
59 std::map<int, v2> EntryMap;
63 #endif