79 bool scripted_event =
false;
88 switch (action->
Type()) {
105 event->SetFilename(action->
Filename());
108 event->SetImageFile(action->
ImageFile());
111 event->SetSceneFile(action->
SceneFile());
119 scripted_event =
true;
147 scripted_event =
true;
155 scripted_event =
true;
163 scripted_event =
true;
178 ::Print(
"WARNING: Action %d (intel level) Could not find group (IFF:%d, type:%d, id:%d)\n",
187 scripted_event =
true;
222 event->SetTitle(title);
225 eta -= fmod(eta, 1800);
230 Text info =
"ORDERS:\n\nEffective immediately, ";
232 info +=
" and all associated units shall proceed to ";
234 info +=
" sector and commence spaceborne operations in that area. ETA rendevous point ";
236 info +=
".\n\nFleet Admiral A. Evars FORCOM\nCommanding";
238 event->SetInformation(info);
241 event->SetImageFile(action->
ImageFile());
244 event->SetSceneFile(action->
SceneFile());
253 ::Print(
"WARNING: Action %d Could not find assigned zone '%s' for '%s'\n",
264 ::Print(
"WARNING: Action %d (zone assignment) Could not find group (IFF:%d, type:%d, id:%d)\n",
273 scripted_event =
true;
307 event->SetTitle(title);
310 eta -= fmod(eta, 1800);
315 Text info =
"ORDERS:\n\nEffective immediately, ";
317 info +=
" and all associated units shall proceed to the ";
319 info +=
" star system and commence spaceborne operations in that area. ETA rendevous point ";
321 info +=
".\n\nFleet Admiral A. Evars FORCOM\nCommanding";
323 event->SetInformation(info);
326 event->SetImageFile(action->
ImageFile());
329 event->SetSceneFile(action->
SceneFile());
338 ::Print(
"WARNING: Action %d Could not find assigned system '%s' for '%s'\n",
349 ::Print(
"WARNING: Action %d (system assignment) Could not find group (IFF:%d, type:%d, id:%d)\n",
358 scripted_event =
true;
364 scripted_event =
true;
374 return scripted_event;
394 int value_killed = asset->
Kill(1);
424 int value_killed = target->
Kill(1);
452 while (++iter && !result) {
461 if (objective && player &&
552 FindAssignments(iter.
value(), alist);
559 FindAssignments(g, alist);
563 if (alist.
size() > 0) {
564 while (tries-- > 0) {
567 if (index >= alist.
size())
577 if (!resource || !objective)
617 Text title =
Text(group->
Name()) +
" in Defensive Engagement";
635 if (tgt->
Kill(1) > 0)
642 if (unit->
Kill(1) > 0)
651 int us_count = unit_count;
652 int them_count = tgt_count;
655 info =
Text(
"EVENT: ") + rgn +
" Sector\n\n";
659 info =
Text(
"MISSION: Escort ") + obj->
Name() +
", " + rgn +
" Sector\n\n";
666 info +=
" successfully defended ";
668 info +=
" was unable to defend ";
675 event->SetTitle(title);
676 event->SetInformation(info);
709 title +=
Text(
" Assault ") + obj->
Name();
716 int killed = tgt->
Kill(1 + tgt->
Count()/2);
724 if (unit->
Kill(1) > 0)
731 for (
int i = 0; i < 2; i++) {
733 if (unit->
Kill(1) > 0)
743 int us_count = unit_count;
744 int them_count = tgt_count;
749 info =
Text(
"MISSION: Strike, ") + rgn +
" Sector\n\n";
753 info =
Text(
"EVENT: ") + rgn +
" Sector\n\n";
757 us_count = tgt_count;
758 them_count = unit_count;
765 info +=
" successfully assault ";
767 info +=
" assault averted against ";
769 info +=
" attempted assault on ";
779 sprintf_s(text,
"ENEMY KILLED:\t %d %s destroyed\n", them_count, tgt->
Name().
data());
781 sprintf_s(text,
"ENEMY KILLED:\t %s destroyed\n", tgt->
Name().
data());
783 sprintf_s(text,
"ENEMY KILLED:\t %d %s destroyed\n", them_count, them->
Name().
data());
788 info +=
"ENEMY KILLED:\t 0\n";
793 sprintf_s(text,
"ALLIED LOSSES:\t %s destroyed\n", tgt->
Name().
data());
795 sprintf_s(text,
"ALLIED LOSSES:\t %d %s destroyed", us_count, us->
Name().
data());
800 info +=
"ALLIED LOSSES:\t 0";
804 event->SetTitle(title);
805 event->SetInformation(info);
842 title +=
" Successfully Strike " + obj->
Name();
845 title +=
" Attempt Strike on " + obj->
Name();
853 int killed = tgt->
Kill(1 + tgt->
Count()/2);
861 if (unit->
Kill(1) > 0)
868 for (
int i = 0; i < 2; i++) {
870 if (unit->
Kill(1) > 0)
880 int us_count = unit_count;
881 int them_count = tgt_count;
886 info =
Text(
"MISSION: Strike, ") + rgn +
" Sector\n\n";
890 info =
Text(
"EVENT: ") + rgn +
" Sector\n\n";
894 us_count = tgt_count;
895 them_count = unit_count;
902 info +=
" successfully strike ";
904 info +=
" strike against ";
906 info +=
" attempted strike on ";
911 if (!success && !friendly)
912 info +=
" averted.\n\n";
921 sprintf_s(text,
"ENEMY KILLED:\t %d %s destroyed\n", them_count, tgt->
Name().
data());
923 sprintf_s(text,
"ENEMY KILLED:\t %s destroyed\n", tgt->
Name().
data());
925 sprintf_s(text,
"ENEMY KILLED:\t %d %s destroyed\n", them_count, them->
Name().
data());
930 info +=
"ENEMY KILLED:\t 0\n";
935 sprintf_s(text,
"ALLIED LOSSES:\t %s destroyed\n", tgt->
Name().
data());
937 sprintf_s(text,
"ALLIED LOSSES:\t %d %s destroyed", us_count, us->
Name().
data());
941 info +=
"ALLIED LOSSES:\t 0";
944 event->SetTitle(title);
945 event->SetInformation(info);
981 title +=
" Fighters";
986 else title +=
" Encounter ";
988 title += obj->
Name();
994 for (
int i = 0; i < 2; i++) {
996 if (tgt->
Kill(1) > 0)
1003 if (tgt_count > 1) {
1005 if (tgt->
Kill(1) > 0)
1014 if (unit->
Kill(1) > 0)
1022 for (
int i = 0; i < 2; i++) {
1024 if (unit->
Kill(1) > 0)
1032 if (tgt->
Kill(1) > 0)
1041 int us_count = unit_count;
1042 int them_count = tgt_count;
1049 us_count = tgt_count;
1050 them_count = unit_count;
1055 info =
Text(
"MISSION: OCA Sweep, ") + rgn +
" Sector\n\n";
1057 info =
Text(
"MISSION: FORCAP, ") + rgn +
" Sector\n\n";
1065 info =
Text(
"MISSION: Patrol, ") + rgn +
" Sector\n\n";
1076 sprintf_s(text,
"ENEMY KILLED:\t %d %s destroyed\n", them_count, them->
Name().
data());
1080 info +=
"ENEMY KILLED:\t 0\n";
1084 sprintf_s(text,
"ALLIED LOSSES:\t %d %s destroyed", us_count, us->
Name().
data());
1087 info +=
"ALLIED LOSSES:\t 0";
1090 event->SetTitle(title);
1091 event->SetInformation(info);
1131 if (tgt->
Kill(1) > 0)
1138 if (unit->
Kill(1) > 0)
1145 for (
int i = 0; i < 2; i++) {
1147 if (unit->
Kill(1) > 0)
1157 int us_count = unit_count;
1158 int them_count = tgt_count;
1163 info =
Text(
"MISSION: Fleet Action, ") + rgn +
" Sector\n\n";
1167 info =
Text(
"EVENT: ") + rgn +
" Sector\n\n";
1171 us_count = tgt_count;
1172 them_count = unit_count;
1179 info +=
" successfully assaulted ";
1181 info +=
" assault against ";
1183 info +=
" attempted assault on ";
1188 if (!success && !friendly)
1189 info +=
" failed.\n\n";
1197 if (tgt->
Count() > 1) {
1198 sprintf_s(text,
"ENEMY KILLED:\t %d %s destroyed\n", them_count, tgt->
Name().
data());
1200 sprintf_s(text,
"ENEMY KILLED:\t %s destroyed\n", tgt->
Name().
data());
1203 if (unit->
Count() > 1) {
1204 sprintf_s(text,
"ENEMY KILLED:\t %d %s destroyed\n", them_count, unit->
Name().
data());
1206 sprintf_s(text,
"ENEMY KILLED:\t %s destroyed\n", unit->
Name().
data());
1212 info +=
"ENEMY KILLED:\t 0\n";
1217 sprintf_s(text,
"ALLIED LOSSES:\t %s destroyed\n", tgt->
Name().
data());
1219 sprintf_s(text,
"ALLIED LOSSES:\t %s destroyed", unit->
Name().
data());
1223 info +=
"ALLIED LOSSES:\t 0";
1226 event->SetTitle(title);
1227 event->SetInformation(info);
1242 if (player && (player->
GetIFF() == a_team))