Changeset 62ee2ce in network-game for common/WorldMap.cpp
- Timestamp:
- Feb 5, 2013, 7:02:32 PM (12 years ago)
- Branches:
- master
- Children:
- 384b7e0, 60017fc
- Parents:
- 60b77d2
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
common/WorldMap.cpp
r60b77d2 r62ee2ce 1 #include " Map.h"1 #include "WorldMap.h" 2 2 3 3 using namespace std; 4 4 5 Map::Map(int width, int height)5 WorldMap::WorldMap(int width, int height) 6 6 { 7 7 this->width = width; … … 20 20 } 21 21 22 Map::~Map()22 WorldMap::~WorldMap() 23 23 { 24 24 for (int x=0; x<width; x++) … … 28 28 } 29 29 30 void Map::setElement(int x, int y, TerrainType t) 30 WorldMap::TerrainType WorldMap::getElement(int x, int y) 31 { 32 return (*(*vctMap)[x])[y]; 33 } 34 35 void WorldMap::setElement(int x, int y, TerrainType t) 31 36 { 32 37 (*(*vctMap)[x])[y] = t; 33 38 } 34 39 35 Map*Map::createDefaultMap()40 WorldMap* WorldMap::createDefaultMap() 36 41 { 37 Map* m = new Map(20l, 20);42 WorldMap* m = new WorldMap(12l, 12); 38 43 39 for(int x=0; x< 20; x++)44 for(int x=0; x<12; x++) 40 45 { 41 for(int y=0; y< 20; y++)46 for(int y=0; y<12; y++) 42 47 { 43 if (x ==0 || y == 0 || x == 1 9 || y == 19)48 if (x ==0 || y == 0 || x == 11 || y == 11) 44 49 m->setElement(x, y, TERRAIN_OCEAN); 45 50 else … … 48 53 } 49 54 55 m->setElement(5, 5, TERRAIN_ROCK); 56 50 57 return m; 51 58 }
Note:
See TracChangeset
for help on using the changeset viewer.