3 #include <boost/version.hpp>
4 #if BOOST_VERSION != 102800
5 #include <boost/python.hpp>
8 #include <boost/python/objects.hpp>
23 using namespace UnitUtil;
24 using namespace UniverseUtil;
29 extern void ExportUnit( boost::python::class_builder< UnitWrapper > &Class );
36 namespace UniverseUtil
52 #define EXPORT_UTIL( name, aff ) PYTHON_DEFINE_GLOBAL( VS, &UniverseUtil::name, #name );
53 #define voidEXPORT_UTIL( name ) EXPORT_UTIL( name, 0 )
56 #define EXPORT_FACTION( name, aff ) PYTHON_DEFINE_GLOBAL( VS, &FactionUtil::name, #name );
57 #define voidEXPORT_FACTION( name ) EXPORT_FACTION( name, 0 )
75 #if BOOST_VERSION != 102800
81 #undef voidEXPORT_UTIL
83 #undef voidEXPORT_FACTION
85 #if BOOST_VERSION != 102800
88 Class.def( boost::python::constructor< std::string, std::string, float, int, float, float > () );
132 PYTHON_DEFINE_METHOD( Class, &UniverseUtil::PythonUnitIter::advanceSignificant, "advanceSignificant" );
133 PYTHON_DEFINE_METHOD( Class, &UniverseUtil::PythonUnitIter::advanceNSignificant, "advanceNSignificant" );
134 PYTHON_DEFINE_METHOD( Class, &UniverseUtil::PythonUnitIter::advanceInsignificant, "advanceInsignificant" );
135 PYTHON_DEFINE_METHOD( Class, &UniverseUtil::PythonUnitIter::advanceNInsignificant, "advanceNInsignificant" );
138 PYTHON_DEFINE_METHOD( Class, &UniverseUtil::PythonUnitIter::advanceJumppoint, "advanceJumppoint" );
139 PYTHON_DEFINE_METHOD( Class, &UniverseUtil::PythonUnitIter::advanceNJumppoint, "advanceNJumppoint" );
172 Python::reseterrors();
174 Python::reseterrors();
179 static const std::pair< int, std::string >masks[] = {
195 for (
unsigned int i = 0;
i <
sizeof (masks)/
sizeof (*masks); ++
i)
197 rv += masks[
i].second;
199 return rv.substr( 1 );
202 return std::string(
"NOWEAP" );
205 #define PARSE_CASE( Class, Enum ) \
207 return std::string( #Enum )
208 #define PARSE_CASE_DEFAULT \
210 return std::string( "UNDEFINED" )
241 rv[
"speed"] = wi->
Speed;
242 rv[
"range"] = wi->
Range;
243 rv[
"damage"] = wi->
Damage;
249 rv[
"refire"] = wi->
Refire();
250 rv[
"volume"] = wi->
volume;
259 if ( (index >= 0) && ( (
unsigned) index < unit->mounts.size() ) ) {
271 rv[
"volume"] = mnt.
volume;
272 rv[
"ammo"] = mnt.
ammo;
273 rv[
"size"] = mnt.
size;
275 rv[
"bank"] = mnt.
bank;
284 rv[
"status"] = std::string(
"UNDEFINED" );