23 int cloakVal(
int cloak,
int cloakmin,
int cloakrate,
bool cloakglass )
26 if (cloak < 0 && cloakrate < 0)
27 cloak = -2147483647-1;
28 if (cloak < cloakmin && cloakrate > 0)
30 if ( (cloak&0x1) && !cloakglass )
32 if ( (cloak&0x1) == 0 && cloakglass )
39 const char *name = upgradeName.c_str();
46 if (partUnit->
name ==
"LOAD_FAILED") {
60 for (
unsigned int i = 0;
i < dp->size(); ++
i)
61 if (!(*dp)[
i].IsOccupied()) {
63 float wdist = ( rez-parent->
Position() ).MagnitudeSquared();
112 int killerCp = killedCp;
113 if (killedCp != -1) {
138 killlist->push_back( (
float) 0.0 );
139 if ( (
int) killlist->size() >
faction )
145 if (whichrecv != NULL) {
163 unsigned int cpnum = 0;
182 static float friendly_autodist =
184 static float neutral_autodist =
186 static float hostile_autodist =
191 static float minasteroiddistance =
193 return minasteroiddistance;
197 return orig->
rSize();
198 if (un->
faction == upgradefaction)
199 return ignore_friend ? -FLT_MAX : ( -orig->
rSize()-un->
rSize() );
201 if ( orig == un->
Target() )
204 return neutral_autodist;
206 return ignore_friend ? -FLT_MAX : friendly_autodist;
208 return hostile_autodist;
210 return ignore_friend ? -FLT_MAX : neutral_autodist;
221 Vector dir = (targpos-pos).Cast();
223 if (dir.Dot(
R ) >= cone) {
226 ScaledCrossProduct( Q, dir, P );
227 ScaledCrossProduct( dir, P, Q );
241 for (i = 0; i < 383 && str[i] !=
'\0'; i++)
242 tmp[i] = (
char) toupper( str[i] );
244 if (strcmp(
"LIGHT", tmp ) == 0)
246 if (strcmp(
"MEDIUM", tmp ) == 0)
248 if (strcmp(
"HEAVY", tmp ) == 0)
250 if (strcmp(
"CAPSHIP-LIGHT", tmp ) == 0)
252 if (strcmp(
"CAPSHIP-HEAVY", tmp ) == 0)
254 if (strcmp(
"SPECIAL", tmp ) == 0)
256 if (strcmp(
"LIGHT-MISSILE", tmp ) == 0)
258 if (strcmp(
"MEDIUM-MISSILE", tmp ) == 0)
260 if (strcmp(
"HEAVY-MISSILE", tmp ) == 0)
262 if (strcmp(
"LIGHT-CAPSHIP-MISSILE", tmp ) == 0)
264 if (strcmp(
"HEAVY-CAPSHIP-MISSILE", tmp ) == 0)
266 if (strcmp(
"SPECIAL-MISSILE", tmp ) == 0)
268 if (strcmp(
"AUTOTRACKING", tmp ) == 0)
277 int num = sscanf( str,
278 "%s %s %s %s %s %s %s %s %s %s %s %s %s",
292 for (
int i = 0;
i < num;
i++)
303 float dam = speed*(damage*muld);
304 if (dam > maxd) dam = maxd;
310 GFXColor( ( (
float) (rand()%100) )/100,
311 ( (
float) (rand()%100) )/100,
312 ( (
float) (rand()%100) )/100 ), NULL );
313 un->SetCurPosition( un->LocalPosition()+( ( (
float) rand() )/RAND_MAX )*dam*un->GetVelocity().Cast() );
320 vector< Cargo >ToBeChanged;
321 unsigned int numcargo = parent->
numCargo();
322 for (i = numcargo-1; i >= 0; --i) {
325 if (carg->
GetCategory().find(
"Passengers" ) != string::npos && carg->
content !=
"Hitchhiker") {
326 ToBeChanged.push_back( *carg );
329 }
else if (carg->
content ==
"Slaves" || carg->
content ==
"Pilot") {
330 ToBeChanged.push_back( *carg );
337 Cargo slave = *newCarg;
338 for (i = 0; i < ToBeChanged.size(); ++i) {
339 slave.
quantity = ToBeChanged[i].quantity;