'g'o should not miss items in corners anymore
[k8-i-v-a-n.git] / src / game / area.h
blobe13a4208aeb58203527ddae22170e512d4f1d231
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);
52 void ClearEntryPoints ();
54 protected:
55 square ***Map;
56 uChar **FlagMap;
57 int XSize, YSize;
58 feuLong XSizeTimesYSize;
59 rect Border;
60 std::map<int, v2> EntryMap;
64 #endif