ajout des jardins au maisons.

.
This commit is contained in:
Yoann 2011-12-13 15:32:00 +01:00
parent 0c4ea5639c
commit 73f265654e
4 changed files with 66 additions and 5 deletions

View File

@ -29,6 +29,7 @@ class Chose;
#include "rules/batiment/batimentquad.hh"
#include "rules/batiment/batimentquadmaison.hh"
#include "rules/batiment/batimentquadjardin.hh"
#include "rules/quartier/quartierquad.hh"
#include "rules/quartier/quartierquadangle.hh"

View File

@ -15,7 +15,7 @@ bool BatimentQuad::subdivide() {
}
Chose* BatimentQuad::factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, Vertex nw) {
//return false;
int th = 20; // Terrain height.
Quad q = Quad(ne,se,sw,nw);
seed = seed;
n = n;
@ -24,11 +24,24 @@ Chose* BatimentQuad::factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, V
q.offset(S,-140);
q.offset(W,-140);
addChild(new TrottoirQuadNormal(ne,se,q.corner[1],q.corner[0],th,E));
addChild(new TrottoirQuadNormal(se,sw,q.corner[2],q.corner[1],th,E));
addChild(new TrottoirQuadNormal(sw,nw,q.corner[3],q.corner[2],th,E));
addChild(new TrottoirQuadNormal(nw,ne,q.corner[0],q.corner[3],th,E));
q.corner[0] = q.corner[0] + Vertex(0,0,th);
q.corner[1] = q.corner[1] + Vertex(0,0,th);
q.corner[2] = q.corner[2] + Vertex(0,0,th);
q.corner[3] = q.corner[3] + Vertex(0,0,th);
addChild(new BatimentQuadJardin(q.corner[0],q.corner[1],q.corner[2],q.corner[3]));
q.offset(N,-100);
q.offset(E,-100);
q.offset(S,-400);
q.offset(W,-100);
addChild(new BatimentQuadMaison(q.corner[0],q.corner[1],q.corner[2],q.corner[3]));
addChild(new TrottoirQuadNormal(ne,se,q.corner[1],q.corner[0],20,E));
addChild(new TrottoirQuadNormal(se,sw,q.corner[2],q.corner[1],20,E));
addChild(new TrottoirQuadNormal(sw,nw,q.corner[3],q.corner[2],20,E));
addChild(new TrottoirQuadNormal(nw,ne,q.corner[0],q.corner[3],20,E));
return NULL; // pour compilation, à virer.
}

View File

@ -0,0 +1,22 @@
#include "all_includes.hh"
BatimentQuadJardin::BatimentQuadJardin(Vertex ne, Vertex se, Vertex sw, Vertex nw) : Chose(), ne(ne), se(se), sw(sw), nw(nw) {
addEntropy(ne, se, sw, nw);
triangulation();
}
int BatimentQuadJardin::width() { return this->ne.x - this->sw.x; }
int BatimentQuadJardin::height() { return this->ne.y - this->sw.y; }
bool BatimentQuadJardin::subdivide() {
return true;
}
void BatimentQuadJardin::triangulation() {
triangles.reserve(2);
addTriangle(new Triangle(ne,nw,sw,0x12,0x64,0x12));
addTriangle(new Triangle(sw,se,ne,0x10,0x60,0x10));
}

View File

@ -0,0 +1,25 @@
#ifndef _RULES_BATIMENTJARDIN_HH
#define _RULES_BATIMENTJARDIN_HH
#include "all_includes.hh"
// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°.
class BatimentQuadJardin : public Chose {
public:
Vertex ne;
Vertex se;
Vertex sw;
Vertex nw;
public:
static const int minHeight = 400;
static const int maxHeight = 800;
public:
BatimentQuadJardin(Vertex ne, Vertex se, Vertex sw, Vertex nw);
int width();
int height();
virtual bool subdivide();
virtual void triangulation();
Chose* factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, Vertex nw);
};
#endif