15 #include <boost/version.hpp>
16 #if BOOST_VERSION != 102800
17 #include <boost/python/class.hpp>
19 #include <boost/python/detail/extension_class.hpp>
34 float getSaveData(
int whichcp,
const string &key,
unsigned int num )
39 if ( num >= ans->size() )
44 const vector< float > &
getSaveData(
int whichcp,
const string &key )
46 static vector< float > empty;
52 string getSaveString(
int whichcp,
const string &key,
unsigned int num )
57 if ( num >= ans->size() )
73 unsigned int pushSaveData(
int whichcp,
const string &key,
float val )
80 ans->size(), &key, NULL, NULL, &val );
81 ans->push_back( val );
90 if ( index < ans->
size() ) {
93 index, &key, NULL, NULL, NULL );
94 ans->erase( ans->begin()+
index );
104 int ret = ans->size();
108 -1, &key, NULL, NULL, NULL );
113 unsigned int pushSaveString(
int whichcp,
const string &key,
const string &value )
120 ans->size(), &key, NULL, &value, NULL );
121 ans->push_back( std::string( value ) );
122 return ans->size()-1;
125 void putSaveString(
int whichcp,
const string &key,
unsigned int num,
const string &val )
130 if ( num < ans->
size() ) {
133 num, &key, NULL, &val, NULL );
138 void putSaveData(
int whichcp,
const string &key,
unsigned int num,
float val )
143 if ( num < ans->
size() ) {
146 num, &key, NULL, NULL, &val );
156 if ( index < ans->
size() ) {
159 index, &key, NULL, NULL, NULL );
160 ans->erase( ans->begin()+
index );
170 int ret = ans->size();
174 -1, &key, NULL, NULL, NULL );
182 return vector< string > ();
188 if (ans.size() > 0) {
190 rez.reserve(ans.size());
191 rez.insert(rez.end(), ans.begin(), ans.end());
197 int lengt = ans.size();
198 rez.reserve(ans.size());
201 int length = (
int)ans[0];
202 for (
int j = 0;
j < length &&
j < lengt;
j++) {
203 char myint = (char)ans[
j+1];
207 rez.push_back( curstr );
219 static const vector<string> empty;
244 for (vector<string>::const_iterator
i = names.begin();
i != names.end(); ++
i) {
247 ans.size(), &mykey, NULL, &*
i, NULL );
252 void saveDataList(
int whichcp,
const string &key,
const vector< float > &values )
260 for (vector<float>::const_iterator
i = values.begin();
i != values.end(); ++
i) {
263 ans.size(), &key, NULL, NULL, &*
i );
313 static void putSaveDataPy(
int whichcp,
string key,
unsigned int num,
float val )
363 Python::reseterrors();
365 Python::reseterrors();
372 debug( 3, node,
SCRIPT_PARSE,
"loading module "+modulename );
374 cout<<
" loading module "<<modulename<<endl;
376 string filename =
"modules/"+modulename+
".module";
378 if (import_top == NULL) {}
379 import_top->
Tag( &tagmap );
386 while (import_stack.size() > 0) {
387 string importname = import_stack.back();
388 import_stack.pop_back();
394 debug( 3, node,
SCRIPT_PARSE,
"already have module "+importname );
404 if (module_node == NULL)
407 if (script_node == NULL)
431 import_stack.push_back( modulename );
454 cout<<
"DIRECTOR START"<<endl;
456 static int st_debuglevel = atoi(
vs_config->
getVariable(
"interpreter",
"debuglevel",
"0" ).c_str() );
460 debuglevel = st_debuglevel;
461 start_game = st_start_game;
462 do_trace = st_do_trace;
468 old_olist_counter = 0;
471 old_string_counter = 0;
478 std::string doparse = node->
attr_value(
"do_parse" );
479 if ( !doparse.empty() )
482 cout<<
"parsing declarations for director"<<endl;
496 vsUMap< string, missionNode* >::iterator iter;
498 string mname = (*iter).first;
500 if (mname !=
"director") {
501 cout<<
" parsing full module "<<mname<<endl;
509 if (nextpythonmission) {
512 char *tmp = nextpythonmission;
514 if (tmp[0] ==
'\r') tmp[0] =
'\n';
519 delete[] nextpythonmission;
520 nextpythonmission = NULL;
521 if ( !this->unpickleData.empty() ) {
528 if (director == NULL)