Last change
on this file since 05051c7 was 05051c7, checked in by dportnoy <dmp1488@…>, 12 years ago |
Added support for objects that can be at any pixel on the map, not just one per grid cell. What used to be called objects are now caled structures
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[62ee2ce] | 1 | #ifndef _WORLDMAP_H
|
---|
| 2 | #define _WORLDMAP_H
|
---|
[60b77d2] | 3 |
|
---|
[f401cac] | 4 | #include <string>
|
---|
| 5 |
|
---|
[60b77d2] | 6 | #include <vector>
|
---|
| 7 |
|
---|
[05051c7] | 8 | #include "Common.h"
|
---|
| 9 |
|
---|
[60b77d2] | 10 | using namespace std;
|
---|
| 11 |
|
---|
[62ee2ce] | 12 | class WorldMap {
|
---|
[60b77d2] | 13 | public:
|
---|
| 14 | enum TerrainType {
|
---|
| 15 | TERRAIN_NONE,
|
---|
| 16 | TERRAIN_GRASS,
|
---|
[62ee2ce] | 17 | TERRAIN_OCEAN,
|
---|
| 18 | TERRAIN_ROCK
|
---|
[60b77d2] | 19 | };
|
---|
| 20 |
|
---|
[05051c7] | 21 | enum StructureType {
|
---|
| 22 | STRUCTURE_NONE,
|
---|
| 23 | STRUCTURE_BLUE_FLAG,
|
---|
| 24 | STRUCTURE_RED_FLAG
|
---|
| 25 | };
|
---|
| 26 |
|
---|
[a1a3bd5] | 27 | enum ObjectType {
|
---|
| 28 | OBJECT_NONE,
|
---|
[e76055f] | 29 | OBJECT_BLUE_FLAG,
|
---|
| 30 | OBJECT_RED_FLAG
|
---|
[a1a3bd5] | 31 | };
|
---|
| 32 |
|
---|
[05051c7] | 33 | class Object {
|
---|
| 34 | public:
|
---|
| 35 | ObjectType type;
|
---|
| 36 | POSITION pos;
|
---|
| 37 |
|
---|
| 38 | Object(ObjectType type, int x, int y);
|
---|
| 39 | Object(ObjectType type, POSITION pos);
|
---|
| 40 |
|
---|
| 41 | ~Object();
|
---|
| 42 | };
|
---|
| 43 |
|
---|
[60b77d2] | 44 | int width, height;
|
---|
| 45 | vector<vector<TerrainType>*>* vctMap;
|
---|
[05051c7] | 46 | vector<vector<StructureType>*>* vctStructures;
|
---|
| 47 | vector<Object>* vctObjects;
|
---|
[60b77d2] | 48 |
|
---|
[62ee2ce] | 49 | WorldMap(int width, int height);
|
---|
[60b77d2] | 50 |
|
---|
[62ee2ce] | 51 | ~WorldMap();
|
---|
[60b77d2] | 52 |
|
---|
[62ee2ce] | 53 | TerrainType getElement(int x, int y);
|
---|
[60b77d2] | 54 | void setElement(int x, int y, TerrainType type);
|
---|
| 55 |
|
---|
[05051c7] | 56 | StructureType getStructure(int x, int y);
|
---|
| 57 | void setStructure(int x, int y, StructureType type);
|
---|
| 58 |
|
---|
| 59 | vector<Object> getObjects(int x, int y);
|
---|
| 60 | void addObject(int x, int y, ObjectType type);
|
---|
[a1a3bd5] | 61 |
|
---|
[62ee2ce] | 62 | static WorldMap* createDefaultMap();
|
---|
[384b7e0] | 63 | static WorldMap* loadMapFromFile(string filename);
|
---|
[60b77d2] | 64 | };
|
---|
| 65 |
|
---|
[f401cac] | 66 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.