-
Notifications
You must be signed in to change notification settings - Fork 51
/
main.cpp
125 lines (116 loc) · 3.37 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/** Copyright (c) 2013, Sean Kasun */
#include <QtWidgets/QApplication>
#include <QTranslator>
#include <QLocale>
#include "minutor.h"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QString locale = QLocale::system().name();
QTranslator translator;
translator.load(QString("minutor_")+locale);
app.installTranslator(&translator);
app.setApplicationName("Minutor");
app.setApplicationVersion("2.21.0");
app.setOrganizationName("seancode");
Minutor minutor;
// Process the cmdline arguments:
QStringList args = app.arguments();
int numArgs = args.size();
int ex_Xmin = 0;
int ex_Xmax = 0;
int ex_Zmin = 0;
int ex_Zmax = 0;
bool regionChecker = false;
bool chunkChecker = false;
for (int i = 0; i < numArgs; i++) {
if (args[i].length() > 2) {
// convert long variants to lower case
args[i] = args[i].toLower();
}
if ((args[i] == "-w" || args[i] == "--world") && i + 1 < numArgs) {
minutor.loadWorld(args[i + 1]);
i += 1;
continue;
}
if (args[i] == "--regionchecker") {
regionChecker = true;
continue;
}
if (args[i] == "--chunkchecker") {
chunkChecker = true;
continue;
}
if ((args[i] == "-r" || args[i] == "--exportrange") && i + 4 < numArgs) {
ex_Xmin = args[i + 1].toInt();
ex_Xmax = args[i + 2].toInt();
ex_Zmin = args[i + 3].toInt();
ex_Zmax = args[i + 4].toInt();
i += 4;
continue;
}
if ((args[i] == "-s" || args[i] == "--savepng") && i + 1 < numArgs) {
minutor.savePNG(args[i + 1], true, regionChecker, chunkChecker,
ex_Zmin, ex_Xmin, ex_Zmax, ex_Xmax);
i += 1;
continue;
}
if ((args[i] == "-j" || args[i] == "--jump") && i + 2 < numArgs) {
minutor.jumpToXZ(args[i + 1].toInt(), args[i + 2].toInt());
i += 2;
continue;
}
if ((args[i] == "-y" || args[i] == "--depth") && i + 1 < numArgs) {
minutor.setDepth(args[i + 1].toInt());
i += 1;
continue;
}
if ((args[i] == "-dim" || args[i] == "--dimension") && i + 1 < numArgs) {
minutor.viewDimension(args[i + 1]);
i += 1;
continue;
}
// menu View->
if (args[i] == "-L" || args[i] == "--lighting") {
minutor.setViewLighting(true);
continue;
}
if (args[i] == "-M" || args[i] == "--mobspawning") {
minutor.setViewMobspawning(true);
continue;
}
if (args[i] == "-C" || args[i] == "--cavemode") {
minutor.setViewCavemode(true);
continue;
}
if (args[i] == "-D" || args[i] == "--depthshading") {
minutor.setViewDepthshading(true);
continue;
}
if (args[i] == "-B" || args[i] == "--biomecolors") {
minutor.setViewBiomeColors(true);
continue;
}
if (args[i] == "-G" || args[i] == "--seaground") {
minutor.setViewSeaGroundMode(true);
continue;
}
if (args[i] == "-sl" || args[i] == "--singlelayer") {
minutor.setViewSingleLayer(true);
continue;
}
if (args[i] == "-sc" || args[i] == "--slimechunks") {
minutor.setViewSlimeChunks(true);
continue;
}
if (args[i] == "-it" || args[i] == "--inhabitedtime") {
minutor.setViewInhabitedTime(true);
continue;
}
if (args[i] == "-chl" || args[i] == "--chunklock") {
minutor.setViewChunkLock(true);
continue;
}
}
minutor.show();
return app.exec();
}