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
|
Line | |
---|
1 | #ifndef _WORLDMAP_H
|
---|
2 | #define _WORLDMAP_H
|
---|
3 |
|
---|
4 | #include <string>
|
---|
5 |
|
---|
6 | #include <vector>
|
---|
7 |
|
---|
8 | #include "Common.h"
|
---|
9 |
|
---|
10 | using namespace std;
|
---|
11 |
|
---|
12 | class WorldMap {
|
---|
13 | public:
|
---|
14 | enum TerrainType {
|
---|
15 | TERRAIN_NONE,
|
---|
16 | TERRAIN_GRASS,
|
---|
17 | TERRAIN_OCEAN,
|
---|
18 | TERRAIN_ROCK
|
---|
19 | };
|
---|
20 |
|
---|
21 | enum StructureType {
|
---|
22 | STRUCTURE_NONE,
|
---|
23 | STRUCTURE_BLUE_FLAG,
|
---|
24 | STRUCTURE_RED_FLAG
|
---|
25 | };
|
---|
26 |
|
---|
27 | enum ObjectType {
|
---|
28 | OBJECT_NONE,
|
---|
29 | OBJECT_BLUE_FLAG,
|
---|
30 | OBJECT_RED_FLAG
|
---|
31 | };
|
---|
32 |
|
---|
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 |
|
---|
44 | int width, height;
|
---|
45 | vector<vector<TerrainType>*>* vctMap;
|
---|
46 | vector<vector<StructureType>*>* vctStructures;
|
---|
47 | vector<Object>* vctObjects;
|
---|
48 |
|
---|
49 | WorldMap(int width, int height);
|
---|
50 |
|
---|
51 | ~WorldMap();
|
---|
52 |
|
---|
53 | TerrainType getElement(int x, int y);
|
---|
54 | void setElement(int x, int y, TerrainType type);
|
---|
55 |
|
---|
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);
|
---|
61 |
|
---|
62 | static WorldMap* createDefaultMap();
|
---|
63 | static WorldMap* loadMapFromFile(string filename);
|
---|
64 | };
|
---|
65 |
|
---|
66 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.