0ad/source/tools/rmgen/simpleconstraints.cpp
Matei bd53b14f58 More work on RMS:
- 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.
2005-06-06 07:46:28 +00:00

45 lines
832 B
C++

#include "stdafx.h"
#include "simpleconstraints.h"
using namespace std;
// NullConstraint
bool NullConstraint::allows(Map* m, int x, int y)
{
return true;
}
// AvoidAreaConstraint
AvoidAreaConstraint::AvoidAreaConstraint(Area* area) {
this->area = area;
}
bool AvoidAreaConstraint::allows(Map* m, int x, int y)
{
return m->area[x][y] != area;
}
// AvoidTerrainConstraint
AvoidTerrainConstraint::AvoidTerrainConstraint(int textureId) {
this->textureId = textureId;
}
bool AvoidTerrainConstraint::allows(Map* m, int x, int y)
{
return m->texture[x][y] != textureId;
}
// AndConstraint
AndConstraint::AndConstraint(Constraint* a, Constraint*b) {
this->a = a;
this->b = b;
}
bool AndConstraint::allows(Map* m, int x, int y)
{
return a->allows(m,x,y) && b->allows(m,x,y);
}