Last change
on this file since 7efed11 was a1a3bd5, checked in by dportnoy <dmp1488@…>, 12 years ago |
Made client changes for smooth player movement, changed the player move method to check the map for obstacles and return a bool indicating success or failure.
|
-
Property mode
set to
100644
|
File size:
780 bytes
|
Line | |
---|
1 | #ifndef _WORLDMAP_H
|
---|
2 | #define _WORLDMAP_H
|
---|
3 |
|
---|
4 | #include <string>
|
---|
5 |
|
---|
6 | #include <vector>
|
---|
7 |
|
---|
8 | using namespace std;
|
---|
9 |
|
---|
10 | class WorldMap {
|
---|
11 | public:
|
---|
12 | enum TerrainType {
|
---|
13 | TERRAIN_NONE,
|
---|
14 | TERRAIN_GRASS,
|
---|
15 | TERRAIN_OCEAN,
|
---|
16 | TERRAIN_ROCK
|
---|
17 | };
|
---|
18 |
|
---|
19 | enum ObjectType {
|
---|
20 | OBJECT_NONE,
|
---|
21 | OBJECT_RED_FLAG,
|
---|
22 | OBJECT_BLUE_FLAG
|
---|
23 | };
|
---|
24 |
|
---|
25 | int width, height;
|
---|
26 | vector<vector<TerrainType>*>* vctMap;
|
---|
27 | vector<vector<ObjectType>*>* vctObjects;
|
---|
28 |
|
---|
29 | WorldMap(int width, int height);
|
---|
30 |
|
---|
31 | ~WorldMap();
|
---|
32 |
|
---|
33 | TerrainType getElement(int x, int y);
|
---|
34 | void setElement(int x, int y, TerrainType type);
|
---|
35 |
|
---|
36 | ObjectType getObject(int x, int y);
|
---|
37 | void setObject(int x, int y, ObjectType type);
|
---|
38 |
|
---|
39 | static WorldMap* createDefaultMap();
|
---|
40 | static WorldMap* loadMapFromFile(string filename);
|
---|
41 | };
|
---|
42 |
|
---|
43 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.