diff options
author | Alexander Harkness <bearbin@gmail.com> | 2013-07-29 13:13:03 +0200 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2013-07-29 13:13:03 +0200 |
commit | 53e22b11857fed62e2313d6d84d90f88ed412ffb (patch) | |
tree | c61e56725da7dff0154d566722651e2c39c9d6c6 /Tools/BlockZapper/BlockZapper.cpp | |
parent | WebAdmin: Removed the duplicate memory usage querying (diff) | |
download | cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.gz cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.bz2 cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.lz cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.xz cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.zst cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.zip |
Diffstat (limited to '')
-rw-r--r-- | Tools/BlockZapper/BlockZapper.cpp | 194 |
1 files changed, 97 insertions, 97 deletions
diff --git a/Tools/BlockZapper/BlockZapper.cpp b/Tools/BlockZapper/BlockZapper.cpp index fb2050d56..c2a0a4fac 100644 --- a/Tools/BlockZapper/BlockZapper.cpp +++ b/Tools/BlockZapper/BlockZapper.cpp @@ -1,97 +1,97 @@ -
-// BlockZapper.cpp
-
-// Implements the main app entrypoint
-
-#include "Globals.h"
-
-#include <fstream>
-
-#include "Regions.h"
-#include "Zapper.h"
-
-
-
-
-
-#ifdef _MSC_VER
- // Under MSVC, link to WinSock2 (needed by FastNBT's byteswapping)
- #pragma comment(lib, "ws2_32.lib")
-#endif
-
-
-
-
-
-void ShowHelp(const char * a_ProgramFullName)
-{
- AString ProgramName(a_ProgramFullName);
- size_t idx = ProgramName.rfind(cFile::PathSeparator);
- if (idx != AString::npos)
- {
- ProgramName.erase(0, idx + 1);
- }
- printf("Tool written by _Xoft(o), code is public domain.\n");
- printf("Usage:\n");
- printf("%s [-w <MCAFolder>]\n", ProgramName.c_str());
- printf("Zaps blocks and / or entities in specified regions.\n");
- printf("Regions are read from stdin, the format is:\n");
- printf(" x1 x2 y1 y2 z1 z2 [B|E|BE]\n");
- printf("B or no specifier zaps blocks only\n");
- printf("E zaps entities only\n");
- printf("BE zaps blocks and entities\n");
- printf("MCA files are searched in the <MCAFolder>; if not specified, in the current folder.\n");
-}
-
-
-
-
-
-int main(int argc, char * argv[])
-{
- new cMCLogger; // Create a new logger, it will assign itself as the main logger instance
-
- AString MCAFolder = ".";
- for (int i = 1; i < argc; i++)
- {
- if (strcmp(argv[i], "-w") == 0)
- {
- if (i < argc - 1)
- {
- MCAFolder = argv[i + 1];
- }
- i++;
- }
- else if (
- (strcmp(argv[i], "help") == 0) ||
- (strcmp(argv[i], "-?") == 0) ||
- (strcmp(argv[i], "/?") == 0) ||
- (strcmp(argv[i], "-h") == 0) ||
- (strcmp(argv[i], "--help") == 0)
- )
- {
- ShowHelp(argv[0]);
- return 0;
- }
- }
-
- cRegions Regions;
-
- /*
- // DEBUG: Read input from a file instead of stdin:
- std::fstream fs("test_in.txt");
- Regions.Read(fs);
- //*/
-
- Regions.Read(std::cin);
-
- cZapper Zapper(MCAFolder);
- Zapper.ZapRegions(Regions.GetAll());
-
- LOGINFO("Done");
- return 0;
-} ;
-
-
-
-
+ +// BlockZapper.cpp + +// Implements the main app entrypoint + +#include "Globals.h" + +#include <fstream> + +#include "Regions.h" +#include "Zapper.h" + + + + + +#ifdef _MSC_VER + // Under MSVC, link to WinSock2 (needed by FastNBT's byteswapping) + #pragma comment(lib, "ws2_32.lib") +#endif + + + + + +void ShowHelp(const char * a_ProgramFullName) +{ + AString ProgramName(a_ProgramFullName); + size_t idx = ProgramName.rfind(cFile::PathSeparator); + if (idx != AString::npos) + { + ProgramName.erase(0, idx + 1); + } + printf("Tool written by _Xoft(o), code is public domain.\n"); + printf("Usage:\n"); + printf("%s [-w <MCAFolder>]\n", ProgramName.c_str()); + printf("Zaps blocks and / or entities in specified regions.\n"); + printf("Regions are read from stdin, the format is:\n"); + printf(" x1 x2 y1 y2 z1 z2 [B|E|BE]\n"); + printf("B or no specifier zaps blocks only\n"); + printf("E zaps entities only\n"); + printf("BE zaps blocks and entities\n"); + printf("MCA files are searched in the <MCAFolder>; if not specified, in the current folder.\n"); +} + + + + + +int main(int argc, char * argv[]) +{ + new cMCLogger; // Create a new logger, it will assign itself as the main logger instance + + AString MCAFolder = "."; + for (int i = 1; i < argc; i++) + { + if (strcmp(argv[i], "-w") == 0) + { + if (i < argc - 1) + { + MCAFolder = argv[i + 1]; + } + i++; + } + else if ( + (strcmp(argv[i], "help") == 0) || + (strcmp(argv[i], "-?") == 0) || + (strcmp(argv[i], "/?") == 0) || + (strcmp(argv[i], "-h") == 0) || + (strcmp(argv[i], "--help") == 0) + ) + { + ShowHelp(argv[0]); + return 0; + } + } + + cRegions Regions; + + /* + // DEBUG: Read input from a file instead of stdin: + std::fstream fs("test_in.txt"); + Regions.Read(fs); + //*/ + + Regions.Read(std::cin); + + cZapper Zapper(MCAFolder); + Zapper.ZapRegions(Regions.GetAll()); + + LOGINFO("Done"); + return 0; +} ; + + + + |