-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.cpp
More file actions
72 lines (58 loc) · 1.73 KB
/
Copy pathmain.cpp
File metadata and controls
72 lines (58 loc) · 1.73 KB
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
/***************************************************************
* Name: wxTestMain.cpp
* Purpose: Code for Application Frame
* Author: Ryan Cornwall ()
* Created: 2010-07-15
* Copyright: Ryan Cornwall ()
* License:
**************************************************************/
#include <string>
#include "list.h" //Makes my life so much easier
#include "mash.h"
#include "adtAdder.h"
#include <filesystem>
std::string usage = "Usage: adtcreator input_adt output_directory output_name min_x min_y max_x max_y\n";
int main(int argc, char** argv)
{
if (argc < 8)
{
std::cout << "Invalid argument count: " << argc << "\n";
std::cout << usage;
exit(1);
}
std::string input_adt = std::string(argv[1]);
if(!std::filesystem::exists(input_adt))
{
std::cout << "Missing input adt: " << input_adt << "\n";
exit(1);
}
std::string output_dir = std::string(argv[2]);
std::string output_name = std::string(argv[3]);
int min_x;
int min_y;
int max_x;
int max_y;
try {
min_x = std::stoi(argv[4]);
min_y = std::stoi(argv[5]);
max_x = std::stoi(argv[6]);
max_y = std::stoi(argv[7]);
}
catch (std::exception e)
{
std::cout << "Invalid number format\n";
std::cout << usage;
exit(1);
}
ZoneGroup group;
writeAdt(input_adt, output_dir, output_name, min_x, min_y, max_x, max_y);
for (auto const& dir_entry : std::filesystem::directory_iterator{ std::filesystem::path(output_dir) })
{
group.appendNoCalc(dir_entry.path().filename().string(), dir_entry.path().string());
}
group.calcBounds();
std::filesystem::current_path(output_dir);
list<ZoneGroup> zoneGroupList;
zoneGroupList.pushBack(group);
mash(zoneGroupList, output_name, true, true, 0, 0, 0, 0);
}