source: network-game/common/WorldMap.h@ 6319311

Last change on this file since 6319311 was 6319311, checked in by Dmitry Portnoy <dportnoy@…>, 11 years ago

Some redfinition issues related to winsock2 are fixed and a few allegro rendering functions are now in GameRender

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[62ee2ce]1#ifndef _WORLDMAP_H
2#define _WORLDMAP_H
[60b77d2]3
[f401cac]4#include <string>
[60b77d2]5#include <vector>
6
[05051c7]7#include "Common.h"
8
[60b77d2]9using namespace std;
10
[62ee2ce]11class WorldMap {
[60b77d2]12public:
13 enum TerrainType {
14 TERRAIN_NONE,
15 TERRAIN_GRASS,
[62ee2ce]16 TERRAIN_OCEAN,
17 TERRAIN_ROCK
[60b77d2]18 };
19
[05051c7]20 enum StructureType {
21 STRUCTURE_NONE,
22 STRUCTURE_BLUE_FLAG,
23 STRUCTURE_RED_FLAG
24 };
25
[a1a3bd5]26 enum ObjectType {
27 OBJECT_NONE,
[e76055f]28 OBJECT_BLUE_FLAG,
29 OBJECT_RED_FLAG
[a1a3bd5]30 };
31
[05051c7]32 class Object {
33 public:
[6e66ffd]34 int id;
[05051c7]35 ObjectType type;
36 POSITION pos;
37
[5f868c0]38 Object(int id, ObjectType type, int x, int y);
39 Object(int id, ObjectType type, POSITION pos);
[05051c7]40
41 ~Object();
[5f868c0]42
43 void serialize(char* buffer);
44 void deserialize(char* buffer);
[05051c7]45 };
46
[60b77d2]47 int width, height;
48 vector<vector<TerrainType>*>* vctMap;
[05051c7]49 vector<vector<StructureType>*>* vctStructures;
50 vector<Object>* vctObjects;
[60b77d2]51
[62ee2ce]52 WorldMap(int width, int height);
[60b77d2]53
[62ee2ce]54 ~WorldMap();
[60b77d2]55
[62ee2ce]56 TerrainType getElement(int x, int y);
[60b77d2]57 void setElement(int x, int y, TerrainType type);
58
[05051c7]59 StructureType getStructure(int x, int y);
60 void setStructure(int x, int y, StructureType type);
[e4c60ba]61 POSITION getStructureLocation(StructureType type);
[05051c7]62
[e487381]63 vector<Object>* getObjects();
[05051c7]64 vector<Object> getObjects(int x, int y);
[5f868c0]65
[6e66ffd]66 void addObject(ObjectType type, int x, int y);
67 void updateObject(int id, WorldMap::ObjectType t, int x, int y);
[5f868c0]68 bool removeObject(int id);
[a1a3bd5]69
[62ee2ce]70 static WorldMap* createDefaultMap();
[384b7e0]71 static WorldMap* loadMapFromFile(string filename);
[60b77d2]72};
73
[f401cac]74#endif
Note: See TracBrowser for help on using the repository browser.