-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
69 lines (61 loc) · 1.27 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
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
#include <iostream>
#include <time.h>
#include <cstdlib>
#include <ctime>
#include "level/level.h"
using namespace std;
string int_to_str(int x) {
if (x == 0) {
return " 0";
}
string result = "";
int zb;
while (x) {
zb = x % 10;
x = ( x-zb ) / 10;
result.insert(result.begin(), '0' + zb);
}
return result;
}
int str_to_int(string s) {
int result = 0;
while (s.length()) {
result *= 10;
result += s[0] - '0';
s.erase(s.begin(),s.begin()+1);
}
return result;
}
int main(int argc, char** arg) {
srandom(time(0));
int lvlc = 1;
if (argc > 1) {
lvlc = str_to_int(arg[1]);
}
if (lvlc == 1) {
FILE *f = fopen("out.stl","w");
Level kolo;
kolo.autor = "Hume2";
kolo.jmeno = "Humeho sranda kolo";
kolo.poradi = 1;
kolo.vysav(f);
fclose(f);
} else {
for (int i = 1; i <= lvlc; i++) {
string filename = "tt_reborn/level" + int_to_str(i) + ".stl";
FILE *f = fopen(filename.c_str(),"w");
Level kolo;
kolo.autor = "Hume2";
//kolo.jmeno = "Very level, such long, wow";
kolo.poradi = i;
kolo.vysav(f);
fclose(f);
cout << "Vygenerována úroveň č." << i << endl;
}
}
return 0;
}