forked from 0ad/0ad
Matei
bd53b14f58
- Created binaries/data/mods/official/maps/random folder to store maps and also moved rmlibrary.js to maps (though perhaps it should be somewhere in system?). - RM generator now uses "logical terrains" that can have units attached to them in addition to textures, for things like forests. - Added basic clump placer, avoid constraints, layered painter, and random terrains (each tile is chosen between several options). - Misc. infrastructure changes. This was SVN commit r2378.
44 lines
888 B
C++
44 lines
888 B
C++
#ifndef __TERRAIN_H__
|
|
#define __TERRAIN_H__
|
|
|
|
class Terrain
|
|
{
|
|
public:
|
|
Terrain();
|
|
void place(class Map* m, int x, int y);
|
|
virtual void placeNew(class Map* m, int x, int y) = 0; // template method
|
|
virtual ~Terrain(void);
|
|
};
|
|
|
|
class SimpleTerrain: public Terrain
|
|
{
|
|
private:
|
|
std::string texture;
|
|
std::string treeType;
|
|
|
|
public:
|
|
SimpleTerrain(const std::string& texture);
|
|
SimpleTerrain(const std::string& texture, const std::string& treeType);
|
|
|
|
static Terrain* parse(const std::string& name);
|
|
|
|
void placeNew(class Map* m, int x, int y);
|
|
~SimpleTerrain(void);
|
|
};
|
|
|
|
class RandomTerrain: public Terrain
|
|
{
|
|
private:
|
|
std::vector<Terrain*> terrains;
|
|
|
|
public:
|
|
RandomTerrain(const std::vector<Terrain*>& terrains);
|
|
|
|
void placeNew(class Map* m, int x, int y);
|
|
~RandomTerrain(void);
|
|
};
|
|
|
|
|
|
extern std::map<std::string, Terrain*> parsedTerrains;
|
|
|
|
#endif |