forked from stephenswat/new-eden-route-derivation
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheve_nerd.i
86 lines (68 loc) · 1.7 KB
/
eve_nerd.i
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
%module eve_nerd
%feature("autodoc", "1");
%{
#include "universe.hpp"
#include "parameters.hpp"
namespace swig {
template <typename T> swig_type_info *type_info();
template <> swig_type_info *type_info<Celestial>() {
return SWIGTYPE_p_Celestial;
};
}
%}
%include <std_string.i>
%include <std_vector.i>
%include <std_map.i>
%template(WaypointList) std::vector<waypoint>;
%template(DistanceMap) std::map<Celestial *, float>;
%template(CelestialVector) std::vector<Celestial *>;
%template(IntVector) std::vector<int>;
%include "universe.hpp"
%include "parameters.hpp"
%extend Route {
%pythoncode {
@property
def start(self):
return self.points[0].entity
@property
def end(self):
return self.points[-1].entity
def __repr__(self):
return "<Route '%s' to '%s'>" % (self.start.name, self.end.name)
}
}
%extend Universe {
%pythoncode {
def get_systems(self):
for i in range(self.system_count):
yield self.get_system_by_seq_id(i)
def get_entities(self):
for i in range(self.entity_count):
yield self.get_entity_by_seq_id(i)
}
}
%extend System {
%pythoncode {
def get_entities(self):
for i in range(self.entity_count):
yield self.get_entity_by_internal_id(i)
def __str__(self):
return self.name
def __repr__(self):
return "<System %d : '%s'>" % (self.id, self.name)
}
}
%extend Celestial {
%pythoncode {
def __str__(self):
return self.name
def __repr__(self):
return "<Celestial %d : '%s'>" % (self.id, self.name)
}
}
%extend waypoint {
%pythoncode {
def __repr__(self):
return "<Waypoint type %d to %s>" % (self.type, str(self.entity))
}
}