37 static int pkg_id = 1000;
43 : campaign(c), player_group(0), player_unit(0), mission(0), player(0),
44 strike_group(0), strike_target(0), prime_target(0),
45 ward(0), escort(0), ownside(0), enemy(-1), mission_type(0)
48 ::Print(
"ERROR - CMS campaign=0x%08x player_group=0x%08x\n",
67 ::Print(
"\n-----------------------------------------------\n");
69 ::
Print(
"CMS CreateMission() request: %s '%s'\n",
71 (
const char*) req->
Script());
74 ::Print(
"CMS CreateMission() request: %s %s\n",
93 if (iff > 0 && iff !=
ownside) {
99 static int id_key = 1;
108 ::Print(
"CMS Created %03d '%s' %s\n\n",
110 (
const char*) info->
name,
117 sprintf_s(fname,
"msn%03d.def", info->
id);
119 fopen_s(&f, fname,
"w");
121 fprintf(f,
"%s\n", script.
data());
128 ::Print(
"CMS failed to create mission.\n");
173 sprintf_s(name,
"Starship Mission %d",
id);
244 ::Print(
"WARNING: CMS - no player group in SelectRegion\n");
404 ::Print(
"CMS GenerateMissionElements() could not find player element '%s'\n",
408 ::Print(
"CMS GenerateMissionElements() could not find player element (no player group)\n");
422 for (
int i = 0; i < units.
size(); i++) {
432 if (player && player->
Rank() >= 10) {
502 if (base_loc.
length() < 1) {
507 if (unit_index < 0 || unit_index > 0 && !exact) {
511 while (fabs(loc.
y) > fabs(loc.
x))
514 loc *= 10e3 + 9e3 * unit_index;
517 loc *= 2e3 + 2e3 * unit_index;
542 for (
int i = 0; i < (int) name.
length(); i++)
587 if (!fighter || !carrier)
return;
590 int maint_count = (live_count > 4) ? live_count / 2 : 0;
644 if (!freight || freight->
CalcValue() < 1)
return;
681 if (zones[zones.
size()-1]->HasRegion(rgn2))
682 rgn2 = *zones[0]->GetRegions()[0];
684 rgn2 = *zones[zones.
size()-1]->GetRegions()[0];
747 if (!player_lead)
return;
808 default: extra = 20e3;
break;
873 Point patrol_loc = base_loc +
875 Point loc2 = patrol_loc +
882 while (ntargets > 0 && ntries > 0) {
899 Point patrol_loc = base_loc +
939 while (ntargets > 0 && ntries > 0) {
966 if (!s || !s2)
return;
1013 case 3: ttype = 0;
break;
1015 case 5: ttype = 1;
break;
1017 case 7: ttype = 2;
break;
1019 case 9: ttype = 3;
break;
1021 case 11: ttype = 4;
break;
1025 case 15: ttype = 5;
break;
1035 case 5: ttype = 0;
break;
1038 case 8: ttype = 1;
break;
1040 case 10: ttype = 4;
break;
1045 case 15: ttype = 5;
break;
1056 for (
int i = 0; i < 2; i++) {
1237 ::Print(
"CMS - Insufficient fighters in squadron '%s' - %d required, %d available\n",
1238 squadron->
Name().
data(), count, avail);
1310 if (groups.
size() > 1) {
1312 if (index >= groups.
size()) index = groups.
size() - 1;
1313 result = groups[index];
1337 objectives +=
".\n";
1341 objectives +=
"* Perform standard fleet operations in the ";
1343 objectives +=
" sector.\n";
1357 char player_info[256];