77{
78 char* param = nullptr;
79 for (int i = 1; i < argc; ++i)
80 {
81 if (strcmp(argv[i], "--maxAngle") == 0)
82 {
83 param = argv[++i];
84 if (!param)
85 return false;
86
87 float maxangle = atof(param);
88 if (maxangle <= 90.f && maxangle >= 45.f)
89 maxAngle = maxangle;
90 else
91 printf("invalid option for '--maxAngle', using default\n");
92 }
93 else if (strcmp(argv[i], "--threads") == 0)
94 {
95 param = argv[++i];
96 if (!param)
97 return false;
98 threads = static_cast<unsigned int>(std::max(0, atoi(param)));
99 }
100 else if (strcmp(argv[i], "--file") == 0)
101 {
102 param = argv[++i];
103 if (!param)
104 return false;
105 file = param;
106 }
107 else if (strcmp(argv[i], "--tile") == 0)
108 {
109 param = argv[++i];
110 if (!param)
111 return false;
112
113 char* stileX = strtok(param, ",");
114 char* stileY = strtok(nullptr, ",");
115 int tilex = atoi(stileX);
116 int tiley = atoi(stileY);
117
118 if ((tilex > 0 && tilex < 64) || (tilex == 0 && strcmp(stileX, "0") == 0))
119 tileX = tilex;
120 if ((tiley > 0 && tiley < 64) || (tiley == 0 && strcmp(stileY, "0") == 0))
121 tileY = tiley;
122
123 if (tileX < 0 || tileY < 0)
124 {
125 printf("invalid tile coords.\n");
126 return false;
127 }
128 }
129 else if (strcmp(argv[i], "--skipLiquid") == 0)
130 {
131 param = argv[++i];
132 if (!param)
133 return false;
134
135 if (strcmp(param, "true") == 0)
136 skipLiquid = true;
137 else if (strcmp(param, "false") == 0)
138 skipLiquid = false;
139 else
140 printf("invalid option for '--skipLiquid', using default\n");
141 }
142 else if (strcmp(argv[i], "--skipContinents") == 0)
143 {
144 param = argv[++i];
145 if (!param)
146 return false;
147
148 if (strcmp(param, "true") == 0)
149 skipContinents = true;
150 else if (strcmp(param, "false") == 0)
151 skipContinents = false;
152 else
153 printf("invalid option for '--skipContinents', using default\n");
154 }
155 else if (strcmp(argv[i], "--skipJunkMaps") == 0)
156 {
157 param = argv[++i];
158 if (!param)
159 return false;
160
161 if (strcmp(param, "true") == 0)
162 skipJunkMaps = true;
163 else if (strcmp(param, "false") == 0)
164 skipJunkMaps = false;
165 else
166 printf("invalid option for '--skipJunkMaps', using default\n");
167 }
168 else if (strcmp(argv[i], "--skipBattlegrounds") == 0)
169 {
170 param = argv[++i];
171 if (!param)
172 return false;
173
174 if (strcmp(param, "true") == 0)
175 skipBattlegrounds = true;
176 else if (strcmp(param, "false") == 0)
177 skipBattlegrounds = false;
178 else
179 printf("invalid option for '--skipBattlegrounds', using default\n");
180 }
181 else if (strcmp(argv[i], "--debugOutput") == 0)
182 {
183 param = argv[++i];
184 if (!param)
185 return false;
186
187 if (strcmp(param, "true") == 0)
188 debugOutput = true;
189 else if (strcmp(param, "false") == 0)
190 debugOutput = false;
191 else
192 printf("invalid option for '--debugOutput', using default true\n");
193 }
194 else if (strcmp(argv[i], "--silent") == 0)
195 {
196 silent = true;
197 }
198 else if (strcmp(argv[i], "--bigBaseUnit") == 0)
199 {
200 param = argv[++i];
201 if (!param)
202 return false;
203
204 if (strcmp(param, "true") == 0)
205 bigBaseUnit = true;
206 else if (strcmp(param, "false") == 0)
207 bigBaseUnit = false;
208 else
209 printf("invalid option for '--bigBaseUnit', using default false\n");
210 }
211 else if (strcmp(argv[i], "--offMeshInput") == 0)
212 {
213 param = argv[++i];
214 if (!param)
215 return false;
216
217 offMeshInputPath = param;
218 }
219 else
220 {
221 int map = atoi(argv[i]);
222 if (map > 0 || (map == 0 && (strcmp(argv[i], "0") == 0)))
223 mapnum = map;
224 else
225 {
226 printf("invalid map id\n");
227 return false;
228 }
229 }
230 }
231
232 return true;
233}