-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.h
64 lines (56 loc) · 1.67 KB
/
map.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef _MAP_H_
#define _MAP_H_
#include "unit.h"
#include "tile.h"
#include <queue>
#include <vector>
class Tiles;
class Map
{
private:
int maxX;
int maxY;
int tileW;
int tileH;
int tileD;
Ogre::Real animTime;
Tiles *currTile;
Tiles **tiles; //array of tiles,our grid //access tiles using tiles[i][j]
std::vector<Tiles*> visitable;
std::queue<Ogre::Vector2> *currPath;
Unit *currUnit;
Ogre::AnimationState* currAnim;
Ogre::Vector2 cursor;
std::vector< std::vector<Ogre::Material*> > normal;
std::vector< std::vector<Ogre::Material*> > highlight;
friend class SearchNode;
public:
Map(Ogre::SceneManager *s,std::string mesh,std::string mat,int maxX,int maxY,int tileW,int tileH,int tileD);
~Map();
Ogre::Vector2 worldToMap(const Ogre::Vector3 &v);
Ogre::Vector3 mapToWorld(int x, int y);
std::vector<Tiles*> unitMoveBFS(Unit *u);
int manhattan(int srcx,int srcy,int dstx, int dsty);
bool BFSIsIn(std::vector<Tiles*> &v,Tiles *t);
bool moveUnit(Unit *u,int x,int y);
bool addUnit(Unit *u,int x,int y);
std::string selectTile(int x,int y);
bool selectUnit(Unit *u);
bool selectUnit(int x, int y);
std::string attackUnit(int x, int y);
bool moveTile();
Tiles * getSelectedTile();
Unit * getSelectedUnit();
std::queue<Ogre::Vector2> *findPath(int srcx,int srcy,int dstx, int dsty); //Vector2 corresponds to x,y index in tiles array
void update(Ogre::SceneManager *sm,Ogre::Real time);
int getMaxX();
int getMaxY();
int getCursorX();
int getCursorY();
void deColor();
void setCursorX(int x);
void setCursorY(int y);
int getHeight(int x, int y);
std::string castSpell(int x, int y, const Ability & a);
};
#endif