diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2008-03-08 08:21:42 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2008-03-08 08:21:42 +0000 |
commit | 61dd0478b9c5c5c083631c28caf8199bf66bf617 (patch) | |
tree | c721d3f00655f40cae97c6d31e567808b6d3d1c5 /tools/tmxcopy/main.cpp | |
parent | d5ef604e3043fb3a6395d10cae59abf5dd6b4e32 (diff) | |
download | mana-61dd0478b9c5c5c083631c28caf8199bf66bf617.tar.gz mana-61dd0478b9c5c5c083631c28caf8199bf66bf617.tar.bz2 mana-61dd0478b9c5c5c083631c28caf8199bf66bf617.tar.xz mana-61dd0478b9c5c5c083631c28caf8199bf66bf617.zip |
Fixed some width/height mixups in TMXCopy.
Diffstat (limited to 'tools/tmxcopy/main.cpp')
-rw-r--r-- | tools/tmxcopy/main.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/tmxcopy/main.cpp b/tools/tmxcopy/main.cpp index 3d460961..92a69c54 100644 --- a/tools/tmxcopy/main.cpp +++ b/tools/tmxcopy/main.cpp @@ -28,15 +28,15 @@ int main(int argc, char * argv[] ) // parsing command line options if (argc < 9 || argc > 10) { - std::cerr<<"Usage: srcFile x y height width tgtFile x y [outfile]"; + std::cerr<<"Usage: srcFile x y width height tgtFile x y [outfile]"; return -1; } std::string srcFile = argv[1]; int srcX= atoi(argv[2]); int srcY= atoi(argv[3]); - int height= atoi(argv[4]); - int width=atoi(argv[5]); + int width= atoi(argv[4]); + int height=atoi(argv[5]); std::string tgtFile = argv[6]; int destX=atoi(argv[7]); int destY=atoi(argv[8]); @@ -44,7 +44,7 @@ int main(int argc, char * argv[] ) if (argc == 10) outFile = argv[9]; // plausibility check of command line options - if (height < 1 || width < 1 || srcX < 1 || srcY < 1 || destX < 1 || destY < 1) + if (height < 1 || width < 1 || srcX < 0 || srcY < 0 || destX < 0 || destY < 0) { std::cerr<<"Illegal coordinates!"<<std::endl; std::cerr<<"Usage: sourceFile x y height width targetFile x y [outputFile]"<<std::endl; @@ -55,8 +55,12 @@ int main(int argc, char * argv[] ) { Map* srcMap = new Map(srcFile); Map* tgtMap = new Map(tgtFile); - tgtMap->overwrite(srcMap, srcX, srcY, height, width, destX, destY); - tgtMap->save(outFile); + if (tgtMap->overwrite(srcMap, srcX, srcY, width, height, destX, destY)) + { + tgtMap->save(outFile); + } else { + return -1; + } } catch (int) { |