Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
briefing_wrapper.cpp
Go to the documentation of this file.
1 #ifndef PYTHON_STUB
2 #include <math.h>
3 #include "python_class.h"
4 #include "cmd/briefing.h"
5 #include "cmd/script/mission.h"
6 #include "faction_generic.h"
7 
8 namespace BriefingUtil
9 {
10 int addShip( string name, string faction, Vector vec )
11 {
12  return mission->briefing->AddStarship( name.c_str(),
14  vec );
15 }
16 void removeShip( int whichship )
17 {
18  mission->briefing->RemoveStarship( whichship );
19 }
20 void enqueueOrder( int whichship, Vector vec, float time )
21 {
22  mission->briefing->EnqueueOrder( whichship, vec, time );
23 }
24 void replaceOrder( int whichship, Vector vec, float time )
25 {
26  mission->briefing->OverrideOrder( whichship, vec, time );
27 }
28 Vector getShipPosition( int whichship )
29 {
30  return mission->briefing->GetPosition( whichship );
31 }
32 void setShipPosition( int whichship, Vector vec )
33 {
34  mission->briefing->SetPosition( whichship, vec );
35 }
36 void terminate()
37 {
39 }
41 {
42  mission->briefing->cam.SetPosition( p, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
43 }
45 {
46  mission->briefing->cam.SetOrientation( p, q, r );
47 }
48 void setCloak( int whichship, float cloak )
49 {
50  mission->briefing->SetCloak( whichship, cloak );
51 }
52 }
54 PYTHON_DEFINE_GLOBAL( Briefing, &BriefingUtil::addShip, "addShip" );
55 PYTHON_DEFINE_GLOBAL( Briefing, &BriefingUtil::removeShip, "removeShip" );
56 PYTHON_DEFINE_GLOBAL( Briefing, &BriefingUtil::enqueueOrder, "enqueueOrder" );
57 PYTHON_DEFINE_GLOBAL( Briefing, &BriefingUtil::replaceOrder, "replaceOrder" );
58 PYTHON_DEFINE_GLOBAL( Briefing, &BriefingUtil::getShipPosition, "getShipPosition" );
59 PYTHON_DEFINE_GLOBAL( Briefing, &BriefingUtil::setShipPosition, "setShipPosition" );
60 PYTHON_DEFINE_GLOBAL( Briefing, &BriefingUtil::terminate, "terminate" );
61 PYTHON_DEFINE_GLOBAL( Briefing, &BriefingUtil::setCamPosition, "setCamPosition" );
62 PYTHON_DEFINE_GLOBAL( Briefing, &BriefingUtil::setCamOrientation, "setCamOrientation" );
63 PYTHON_DEFINE_GLOBAL( Briefing, &BriefingUtil::setCloak, "setCloak" );
64 PYTHON_END_MODULE( Briefing )
65 
67 {
68  Python::reseterrors();
69  PYTHON_INIT_MODULE( Briefing );
70  Python::reseterrors();
71 }
72 
74 //END C++
76 //below replace ~ with enter
77 #else
78 #define MYPRINT( nam ) print #nam
79 #define WRAPPED0( type, name, aff ) def name( self ) : ~MYPRINT( name ) ~return aff
80 #define WRAPPED1( type, name, atype, a, aff ) def name( self, a ) : ~MYPRINT( name ) ~return aff
81 #define WRAPPED2( type, name, atype, a, btype, b, aff ) def name( self, a, b ) : ~MYPRINT( name ) ~return aff
82 #define WRAPPED3( type, name, atype, a, btype, b, ctype, c, aff ) def name( self, a, b, c ) : ~MYPRINT( name ) ~return aff
83 #define voidWRAPPED0( name ) def name( self ) : ~MYPRINT( name )
84 #define voidWRAPPED1( name, atype, a ) def name( self, a ) : ~MYPRINT( name )
85 #define voidWRAPPED2( name, atype, a, btype, b ) def name( self, a, b ) : ~MYPRINT( name )
86 #define voidWRAPPED3( name, atype, a, btype, b, ctype, c ) def name( self, a, b, c ) : ~MYPRINT( name )
87 
88 WRAPPED3( int
89  , addShip
90  , string
91  , name
92  , string
93  , faction
94  , Vector
95  , vec
96  , 0 )
97 voidWRAPPED1( removeShip
98  , int
99  , ship )
100 voidWRAPPED3( enqueueOrder
101  , int
102  , ship
103  , Vector
104  , dest
105  , float
106  , time )
107 voidWRAPPED3( replaceOrder
108  , int
109  , ship
110  , Vector
111  , dest
112  , float
113  , time )
114 WRAPPED1( Vector
116  , int
117  , ship
118  , (50, 75, 100) )
119 voidWRAPPED2( setShipPosition
120  , int
121  , ship
122  , Vector
123  , vec )
124 voidWRAPPED0( terminate )
125 voidWRAPPED1( setCamPosition
126  , Vector
127  , pos )
128 voidWRAPPED3( setCamOrientation
129  , Vector
130  , p
131  , Vector
132  , q
133  , Vector
134  , r )
135 voidWRAPPED2( setCloak
136  , int
137  , ship
138  , float
139  , amount )
140 
141 #endif
142