diff --git a/source/tools/rmgen/clumpplacer.cpp b/source/tools/rmgen/clumpplacer.cpp index 912fefdffc..4e26e75c76 100644 --- a/source/tools/rmgen/clumpplacer.cpp +++ b/source/tools/rmgen/clumpplacer.cpp @@ -4,13 +4,14 @@ using namespace std; -ClumpPlacer::ClumpPlacer(float size, float coherence, float smoothness, int x, int y) +ClumpPlacer::ClumpPlacer(float size, float coherence, float smoothness, float failFraction, int x, int y) { this->size = size; this->coherence = coherence; this->smoothness = smoothness; this->x = x; this->y = y; + this->failFraction = failFraction; } ClumpPlacer::~ClumpPlacer() @@ -80,7 +81,7 @@ bool ClumpPlacer::place(class Map* m, Constraint* constr, std::vector& re } } - return failed > 0 ? false : true; + return failed > size * failFraction ? false : true; /*if(m->validT(x,y)) { ret.push_back(Point(x,y)); diff --git a/source/tools/rmgen/clumpplacer.h b/source/tools/rmgen/clumpplacer.h index 7e9018f6d1..4b0fe9285b 100644 --- a/source/tools/rmgen/clumpplacer.h +++ b/source/tools/rmgen/clumpplacer.h @@ -10,11 +10,12 @@ private: float size; float coherence; float smoothness; + float failFraction; int x, y; public: virtual bool place(Map* m, Constraint* constr, std::vector& ret); - ClumpPlacer(float size, float coherence, float smoothness, int x, int y); + ClumpPlacer(float size, float coherence, float smoothness, float failFraction, int x, int y); virtual ~ClumpPlacer(); }; diff --git a/source/tools/rmgen/convert.cpp b/source/tools/rmgen/convert.cpp index b059dbc2d2..53a849fc87 100644 --- a/source/tools/rmgen/convert.cpp +++ b/source/tools/rmgen/convert.cpp @@ -160,7 +160,7 @@ AreaPainter* ParseAreaPainter(JSContext* cx, jsval val) { AreaPlacer* ParseAreaPlacer(JSContext* cx, jsval val) { int x, y, x1, y1, x2, y2, num, maxFail; - float size, coherence, smoothness; + float size, coherence, smoothness, failFraction; switch(GetType(cx, val)) { case TYPE_RECT_PLACER: @@ -174,9 +174,10 @@ AreaPlacer* ParseAreaPlacer(JSContext* cx, jsval val) { if(!GetFloatField(cx, val, "size", size)) return 0; if(!GetFloatField(cx, val, "coherence", coherence)) return 0; if(!GetFloatField(cx, val, "smoothness", smoothness)) return 0; + if(!GetFloatField(cx, val, "failFraction", failFraction)) return 0; if(!GetIntField(cx, val, "x", x)) return 0; if(!GetIntField(cx, val, "y", y)) return 0; - return new ClumpPlacer(size, coherence, smoothness, x, y); + return new ClumpPlacer(size, coherence, smoothness, failFraction, x, y); default: return 0; diff --git a/source/tools/rmgen/rmgen.vcproj b/source/tools/rmgen/rmgen.vcproj index 2889bd7aeb..cf0356db54 100644 --- a/source/tools/rmgen/rmgen.vcproj +++ b/source/tools/rmgen/rmgen.vcproj @@ -284,6 +284,12 @@ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + + + +