summaryrefslogtreecommitdiff
path: root/tools/tmxcopy/map.cpp
diff options
context:
space:
mode:
authorSteve Cotton <steve@s.cotton.clara.co.uk>2009-07-20 23:21:09 +0100
committerSteve Cotton <steve@s.cotton.clara.co.uk>2009-07-22 11:36:20 +0100
commit8f5b3e7b0af9de35453bd8ff32a5bb287b13bc96 (patch)
treed943f5dea31797de6ca628fadb54338f909bbb79 /tools/tmxcopy/map.cpp
parent03fd663b2bfbd61f032c47d9aaf6661fe9a18bbe (diff)
downloadmana-client-8f5b3e7b0af9de35453bd8ff32a5bb287b13bc96.tar.gz
mana-client-8f5b3e7b0af9de35453bd8ff32a5bb287b13bc96.tar.bz2
mana-client-8f5b3e7b0af9de35453bd8ff32a5bb287b13bc96.tar.xz
mana-client-8f5b3e7b0af9de35453bd8ff32a5bb287b13bc96.zip
TMX Tools: minor tidyup
Diffstat (limited to 'tools/tmxcopy/map.cpp')
-rw-r--r--tools/tmxcopy/map.cpp17
1 files changed, 13 insertions, 4 deletions
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 "<<p<<" to "<<x<<", "<<y<<std::endl;
Layer* srcLayer = templateMap->getLayer(p);
for (int loop_y=0; loop_y<templateMap->getHeight(); loop_y++)
@@ -436,11 +445,11 @@ bool Map::randomFill(Map* templateMap, const std::string& destLayerName,
else
{
occupiedAreas++;
- std::cout <<"Area occupied "<<x<<", "<<y<<std::endl;
}
}
std::clog<<"Generated " << patternsGenerated << " new objects" <<std::endl;
+ (void) occupiedAreas; // Unused at the moment, but keep it without a compiler warning about unused variables
return true;
}
@@ -461,7 +470,7 @@ bool Map::translateAllLayers(Map* templateMap, const std::string& destLayerName,
}
if (!checkPassed) return false;
- //FIXME - as is, this will add tilesets that are in the template but
+ //TODO This will unnecessarily add tilesets that are in the template but
//not used in the main map
std::map<int, int> tilesetTranslation = addAndTranslateTilesets(templateMap);