From 8f5b3e7b0af9de35453bd8ff32a5bb287b13bc96 Mon Sep 17 00:00:00 2001 From: Steve Cotton Date: Mon, 20 Jul 2009 23:21:09 +0100 Subject: TMX Tools: minor tidyup --- tools/tmxcopy/map.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'tools/tmxcopy/map.cpp') diff --git a/tools/tmxcopy/map.cpp b/tools/tmxcopy/map.cpp index 0fd764b4..75bd9a45 100644 --- a/tools/tmxcopy/map.cpp +++ b/tools/tmxcopy/map.cpp @@ -390,7 +390,17 @@ bool Map::randomFill(Map* templateMap, const std::string& destLayerName, } /* Now generate extra tiles. - * TODO Need to configure this for desired density. For 2x1 trees, dW*dH/10 is very sparse, dW*dH/2 is dense */ + * + * After considering ways to specify the number of objects to add, I think + * the best user interface (without integrating it with Tiled) is to place + * a small number of objects each time, and have the user run the utility + * several times, reloading the map in Tiled each time until it looks + * right. Simpler than typing magic numbers in at a command prompt. + * + * This algorithm completes after a fixed number of attempts at placing an + * object; regardless of how many attempts are successful. + * For 2x1 trees, destWidth*destHeight/10 is very sparse, dW*dH/2 is dense. + */ srand(time(NULL)); int patternsGenerated = 0; int occupiedAreas = 0; @@ -418,7 +428,6 @@ bool Map::randomFill(Map* templateMap, const std::string& destLayerName, if (areaIsClear) { int p = rand() % templateMap->getNumberOfLayers(); - std::cout <<"Copying pattern "<getLayer(p); for (int loop_y=0; loop_ygetHeight(); loop_y++) @@ -436,11 +445,11 @@ bool Map::randomFill(Map* templateMap, const std::string& destLayerName, else { occupiedAreas++; - std::cout <<"Area occupied "< tilesetTranslation = addAndTranslateTilesets(templateMap); -- cgit v1.2.3-70-g09d2