25 string::size_type newline = pickled.find(
"\n" );
26 if (newline != string::npos)
27 return pickled.substr( newline+1, pickled.length()-(newline+1) );
33 string::size_type newline = pickled.find(
"\n" );
34 return pickled.substr( 0, newline );
41 while ( i < (
int) str.length() ) {
51 str = str.substr( i, str.length()-i );
103 std::string lpd = last_pickled_data;
105 if ( !lpd.empty() ) {
107 for (
unsigned int i = 0;
i < nummis;
i++) {
109 std::string pickled = lpd.substr( 0, len );
110 lpd = lpd.substr( len, lpd.length()-len );
123 if ( pickled.length() ) {
131 int len = tp.length();
141 if (tmp.length() ||
i == 0) {
171 if ( (c[0] = *buf) ) {
188 for (
unsigned int i = 0;
i < nummissions;
i++) {
191 char *temp = (
char*) malloc(
sizeof (
char)*(1+picklelength) );
193 temp[picklelength] = 0;
209 for (
unsigned int i = 0;
i < nummissions;
i++) {
212 char *temp = (
char*) malloc(
sizeof (
char)*(1+picklelength) );
214 temp[picklelength] = 0;
215 memcpy( temp, buf, picklelength );
231 void LoadMission(
const char *nission_name,
const std::string &script,
bool loadFirstUnit )
233 using namespace VSFileSystem;
235 const char *friendly_mission_name = nission_name;
236 if (nission_name[0] ==
'#') {
238 mission_name = string();
239 friendly_mission_name++;
241 if ( mission_name.empty() )
243 printf(
"%s", script.c_str() );
258 char fightername[1024];
259 vector< Flightgroup* >::const_iterator siter;
263 for (siter = fg.begin(); siter != fg.end(); siter++) {
265 string fg_name = fg->
name;
266 string fullname = fg->
type;
267 strncpy( fightername, fullname.c_str(), 1023 );
268 fightername[1023] =
'\0';
271 string ainame = fg->
ainame;
272 float fg_radius = 0.0;
273 for (
int s = 0; s < fg->
nr_ships; s++) {
276 pox.i = fg->
pos.i+s*fg_radius*3;
277 pox.j = fg->
pos.i+s*fg_radius*3;
278 pox.k = fg->
pos.i+s*fg_radius*3;
279 if (pox.i == pox.j && pox.j == pox.k && pox.k == 0) {
280 pox.i = rand()*10000./RAND_MAX-5000;
281 pox.j = rand()*10000./RAND_MAX-5000;
282 pox.k = rand()*10000./RAND_MAX-5000;
289 string modifications(
"" );
290 if (a != 0 || loadFirstUnit)
314 friendly_mission_name, num-1 );