Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
VMapAssembler.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifdef _WIN32
7 #include "direct.h"
8#else
9 #include <sys/stat.h>
10#endif
11
12#include <string>
13#include <iostream>
14
15#include "TileAssembler.h"
16
17void CreateDir(std::string const& path)
18{
19 if (chdir(path.c_str()) == 0)
20 {
21 chdir("../");
22 return;
23 }
24
25#ifdef _WIN32
26 _mkdir(path.c_str());
27#else
28 mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IRWXO); // 0777
29#endif
30}
31
32int main(int argc, char* argv[])
33{
34 std::string src = "Buildings";
35 std::string dest = "vmaps";
36
37 std::string path = "./" + dest + "/";
38
39 CreateDir(path);
40
41 if(argc > 3)
42 {
43 //printf("\nusage: %s <raw data dir> <vmap dest dir> [config file name]\n", argv[0]);
44 std::cout << "usage: " << argv[0] << " <raw data dir> <vmap dest dir>" << std::endl;
45 return 1;
46 }
47 else
48 {
49 if (argc > 1)
50 src = argv[1];
51 if (argc > 2)
52 dest = argv[2];
53 }
54
55 std::cout << "using " << src << " as source directory and writing output to " << dest << std::endl;
56
57 VMAP::TileAssembler* ta = new VMAP::TileAssembler(src, dest);
58
59 if(!ta->convertWorld2())
60 {
61 std::cout << "exit with errors" << std::endl;
62 delete ta;
63 return 1;
64 }
65
66 delete ta;
67 std::cout << "Ok, all done" << std::endl;
68 return 0;
69}
int main(int argc, char *argv[])
void CreateDir(std::string const &path)