Last change
on this file since a1a3bd5 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
|
Rev | Line | |
---|
[62ee2ce] | 1 | #ifndef _WORLDMAP_H
|
---|
| 2 | #define _WORLDMAP_H
|
---|
[60b77d2] | 3 |
|
---|
[f401cac] | 4 | #include <string>
|
---|
| 5 |
|
---|
[60b77d2] | 6 | #include <vector>
|
---|
| 7 |
|
---|
| 8 | using namespace std;
|
---|
| 9 |
|
---|
[62ee2ce] | 10 | class WorldMap {
|
---|
[60b77d2] | 11 | public:
|
---|
| 12 | enum TerrainType {
|
---|
| 13 | TERRAIN_NONE,
|
---|
| 14 | TERRAIN_GRASS,
|
---|
[62ee2ce] | 15 | TERRAIN_OCEAN,
|
---|
| 16 | TERRAIN_ROCK
|
---|
[60b77d2] | 17 | };
|
---|
| 18 |
|
---|
[a1a3bd5] | 19 | enum ObjectType {
|
---|
| 20 | OBJECT_NONE,
|
---|
| 21 | OBJECT_RED_FLAG,
|
---|
| 22 | OBJECT_BLUE_FLAG
|
---|
| 23 | };
|
---|
| 24 |
|
---|
[60b77d2] | 25 | int width, height;
|
---|
| 26 | vector<vector<TerrainType>*>* vctMap;
|
---|
[a1a3bd5] | 27 | vector<vector<ObjectType>*>* vctObjects;
|
---|
[60b77d2] | 28 |
|
---|
[62ee2ce] | 29 | WorldMap(int width, int height);
|
---|
[60b77d2] | 30 |
|
---|
[62ee2ce] | 31 | ~WorldMap();
|
---|
[60b77d2] | 32 |
|
---|
[62ee2ce] | 33 | TerrainType getElement(int x, int y);
|
---|
[60b77d2] | 34 | void setElement(int x, int y, TerrainType type);
|
---|
| 35 |
|
---|
[a1a3bd5] | 36 | ObjectType getObject(int x, int y);
|
---|
| 37 | void setObject(int x, int y, ObjectType type);
|
---|
| 38 |
|
---|
[62ee2ce] | 39 | static WorldMap* createDefaultMap();
|
---|
[384b7e0] | 40 | static WorldMap* loadMapFromFile(string filename);
|
---|
[60b77d2] | 41 | };
|
---|
| 42 |
|
---|
[f401cac] | 43 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.