1
0
forked from 0ad/0ad
0ad/source/tools/rmgen/map.h
Matei 60befbd1cf # Updates to random map generator.
- Added a direct addToClass/removeFromClass API for use in noise-based
maps.
- Raised the sea level in the game world so water can be deeper, and set
it to 0 in script coordinates.
- Moved some class-related utility functions to rmlibrary.js.
- Modified sample maps in light of these changes.
- Committed noise class which I forgot last time.

This was SVN commit r4659.
2006-11-27 00:20:58 +00:00

58 lines
1.6 KiB
C++

#ifndef __MAP_H__
#define __MAP_H__
#include "area.h"
#include "areapainter.h"
#include "areaplacer.h"
#include "constraint.h"
#include "object.h"
#include "terrain.h"
#include "objectgroupplacer.h"
#include "tileclass.h"
class Map {
public:
int size;
int** texture;
std::vector<Object*>** terrainObjects;
float** height;
Area*** area;
std::map<std::string, int> nameToId;
std::map<int, std::string> idToName;
std::vector<Object*> objects;
std::vector<Area*> areas;
std::vector<TileClass*> tileClasses;
Map(int size, Terrain* baseTerrain, float baseHeight);
Map(std::string fileName, int loadLevel);
~Map();
int getId(std::string texture);
bool validT(int x, int y) { return x>=0 && y>=0 && x<size && y<size; }
bool validH(int x, int y) { return x>=0 && y>=0 && x<=size && y<=size; }
bool validClass(int c) { return c>=0 && c<(int)tileClasses.size(); }
std::string getTexture(int x, int y);
void setTexture(int x, int y, const std::string& texture);
float getHeight(int x, int y);
void setHeight(int x, int y, float height);
std::vector<Object*> getTerrainObjects(int x, int y);
void setTerrainObjects(int x, int y, std::vector<Object*> &objects);
void placeTerrain(int x, int y, Terrain* t);
void addObject(class Object* ent);
Area* createArea(AreaPlacer* placer, AreaPainter* painter, Constraint* constr);
bool createObjectGroup(ObjectGroupPlacer* placer, int player, Constraint* constr);
int createTileClass(); // returns ID of the new class
float getExactHeight(float x, float y); // get height taking into account terrain curvature
};
#endif