From b1c08a56778308897b2a46d6111084044583de0e Mon Sep 17 00:00:00 2001 From: Steve Cotton Date: Mon, 9 Mar 2009 22:11:06 +0000 Subject: Make tmxcopy pair up layers by name --- tools/tmxcopy/main.cpp | 68 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 15 deletions(-) (limited to 'tools/tmxcopy/main.cpp') diff --git a/tools/tmxcopy/main.cpp b/tools/tmxcopy/main.cpp index ac18ce04..4926d69f 100644 --- a/tools/tmxcopy/main.cpp +++ b/tools/tmxcopy/main.cpp @@ -1,6 +1,7 @@ /* * TMXCopy * Copyright (C) 2007 Philipp Sehmisch + * Copyright (C) 2009 Steve Cotton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,34 +20,70 @@ #include #include +#include #include "map.hpp" +void printUsage() +{ + std::cerr<<"Usage: tmxcopy [-c] [-n] srcFile x y width height tgtFile x y [outfile]"< 10) + ConfigurationOptions config = {0}; + int opt; + while ((opt = getopt(argc, argv, "cn")) != -1) + { + switch (opt) + { + case 'c': + config.createMissingLayers = true; + break; + case 'n': + config.copyLayersByOrdinal = true; + break; + case '?': + std::cerr<<"Unrecognized option"< 9) { - std::cerr<<"Usage: srcFile x y width height tgtFile x y [outfile]\n"; + std::cerr<<"Too many args"<overwrite(srcMap, srcX, srcY, width, height, destX, destY)) + if (tgtMap->overwrite(srcMap, srcX, srcY, width, height, destX, destY, config)) { tgtMap->save(outFile); } else { return -1; } + delete srcMap; + delete tgtMap; } catch (int) { return -1; } - } -- cgit v1.2.3-70-g09d2