From 8898ad9b25fca6afe2374d293a981db02a83d7e9 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Thu, 31 May 2012 14:46:27 +0000 Subject: Committing the documentation to svn to have it accessible online --- .../_campaign_situation_report_8cpp_source.html | 533 +++++++++++++++++++++ 1 file changed, 533 insertions(+) create mode 100644 Doc/doxygen/html/_campaign_situation_report_8cpp_source.html (limited to 'Doc/doxygen/html/_campaign_situation_report_8cpp_source.html') diff --git a/Doc/doxygen/html/_campaign_situation_report_8cpp_source.html b/Doc/doxygen/html/_campaign_situation_report_8cpp_source.html new file mode 100644 index 0000000..bcabab4 --- /dev/null +++ b/Doc/doxygen/html/_campaign_situation_report_8cpp_source.html @@ -0,0 +1,533 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/Stars45/CampaignSituationReport.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
CampaignSituationReport.cpp
+
+
+Go to the documentation of this file.
1 /* Project Starshatter 4.5
+
2  Destroyer Studios LLC
+
3  Copyright © 1997-2004. All Rights Reserved.
+
4 
+
5  SUBSYSTEM: Stars.exe
+
6  FILE: CampaignSituationReport.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  CampaignSituationReport generates the situation report
+
13  portion of the briefing for a dynamically generated
+
14  mission in a dynamic campaign.
+
15 */
+
16 
+
17 #include "MemDebug.h"
+ +
19 #include "Campaign.h"
+
20 #include "Combatant.h"
+
21 #include "CombatAssignment.h"
+
22 #include "CombatGroup.h"
+
23 #include "CombatUnit.h"
+
24 #include "CombatZone.h"
+
25 #include "Callsign.h"
+
26 #include "Mission.h"
+
27 #include "Instruction.h"
+
28 #include "Ship.h"
+
29 #include "ShipDesign.h"
+
30 #include "StarSystem.h"
+
31 #include "Random.h"
+
32 #include "Player.h"
+
33 
+
34 // +--------------------------------------------------------------------+
+
35 
+ +
37 : campaign(c), mission(m)
+
38 {}
+
39 
+ +
41 
+
42 // +--------------------------------------------------------------------+
+
43 
+
44 void
+ +
46 {
+
47  if (!campaign || !mission)
+
48  return;
+
49 
+
50  sitrep = Text();
+
51 
+ + +
54 
+ +
56 }
+
57 
+
58 // +--------------------------------------------------------------------+
+
59 
+
60 static const char* outlooks[4] = { "good", "fluid", "poor", "bleak" };
+
61 
+
62 void
+ +
64 {
+
65  if (campaign->GetTime() < 40 * 3600)
+
66  sitrep = Text(campaign->Name()) + Text(" is still in its early stages and the situation is ");
+
67  else
+
68  sitrep = Text("The overall outlook for ") + Text(campaign->Name()) + Text(" is ");
+
69 
+
70  int score = campaign->GetPlayerTeamScore();
+
71 
+
72  if (score > 1000)
+
73  sitrep += outlooks[0];
+
74  else if (score > -1000)
+
75  sitrep += outlooks[1];
+
76  else if (score > -2000)
+
77  sitrep += outlooks[2];
+
78  else
+
79  sitrep += outlooks[3];
+
80 
+
81  sitrep += ". ";
+
82 
+
83  Text strat_dir;
+
84 
+ +
86 
+
87  if (pg)
+
88  strat_dir = pg->GetStrategicDirection();
+
89 
+
90  if (strat_dir.length())
+
91  sitrep += strat_dir;
+
92  else
+
93  sitrep += Text("Establishing and maintaining military control of the ") +
+
94  mission->GetStarSystem()->Name() + " System remains a key priority.";
+
95 }
+
96 
+
97 // +--------------------------------------------------------------------+
+
98 
+
99 void
+ +
101 {
+
102  if (mission) {
+
103  MissionElement* player = mission->GetPlayer();
+
104  MissionElement* target = mission->GetTarget();
+
105  MissionElement* ward = mission->GetWard();
+
106  MissionElement* escort = FindEscort(player);
+
107  Text threat = GetThreatInfo();
+
108  Text sector = mission->GetRegion();
+
109 
+
110  sector += " sector.";
+
111 
+
112  switch (mission->Type()) {
+
113  case Mission::PATROL:
+
114  case Mission::AIR_PATROL:
+
115  sitrep += "\n\nThis mission is a routine patrol of the ";
+
116  sitrep += sector;
+
117  break;
+
118 
+
119  case Mission::SWEEP:
+
120  case Mission::AIR_SWEEP:
+
121  sitrep += "\n\nFor this mission, you will be performing a fighter sweep of the ";
+
122  sitrep += sector;
+
123  break;
+
124 
+
125  case Mission::INTERCEPT:
+ +
127  sitrep += "\n\nWe have detected hostile elements inbound. ";
+
128  sitrep += "Your mission is to intercept them before they are able to engage their targets.";
+
129  break;
+
130 
+
131 
+
132  case Mission::STRIKE:
+
133  sitrep += "\n\nThe goal of this mission is to perform a strike on preplanned targets in the ";
+
134  sitrep += sector;
+
135 
+
136  if (target) {
+
137  sitrep += " Your package has been assigned to strike the ";
+
138 
+
139  if (target->GetCombatGroup())
+
140  sitrep += target->GetCombatGroup()->GetDescription();
+
141  else
+
142  sitrep += target->Name();
+
143 
+
144  sitrep += ".";
+
145  }
+
146  break;
+
147 
+
148  case Mission::ASSAULT:
+
149  sitrep += "\n\nThis mission is to assault preplanned targets in the ";
+
150  sitrep += sector;
+
151 
+
152  if (target) {
+
153  sitrep += " Your package has been assigned to strike the ";
+
154 
+
155  if (target->GetCombatGroup())
+
156  sitrep += target->GetCombatGroup()->GetDescription();
+
157  else
+
158  sitrep += target->Name();
+
159 
+
160  sitrep += ".";
+
161  }
+
162  break;
+
163 
+
164  case Mission::DEFEND:
+
165  if (ward) {
+
166  sitrep += "\n\nFor this mission, you will need to defend ";
+
167  sitrep += ward->Name();
+
168  sitrep += " in the ";
+
169  sitrep += sector;
+
170  }
+
171  else {
+
172  sitrep += "\n\nThis is a defensive patrol mission in the ";
+
173  sitrep += sector;
+
174  }
+
175  break;
+
176 
+
177  case Mission::ESCORT:
+
178  if (ward) {
+
179  sitrep += "\n\nFor this mission, you will need to escort the ";
+
180  sitrep += ward->Name();
+
181  sitrep += " in the ";
+
182  sitrep += sector;
+
183  }
+
184  else {
+
185  sitrep += "\n\nThis is an escort mission in the ";
+
186  sitrep += sector;
+
187  }
+
188  break;
+
189 
+ +
191  if (ward) {
+
192  sitrep += "\n\nFor this mission, you will need to escort the freighter ";
+
193  sitrep += ward->Name();
+
194  sitrep += ".";
+
195  }
+
196  else {
+
197  sitrep += "\n\nThis is a freight escort mission in the ";
+
198  sitrep += sector;
+
199  }
+
200  break;
+
201 
+ +
203  if (ward) {
+
204  sitrep += "\n\nFor this mission, you will need to escort the shuttle ";
+
205  sitrep += ward->Name();
+
206  sitrep += ".";
+
207  }
+
208  else {
+
209  sitrep += "\n\nThis is a shuttle escort mission in the ";
+
210  sitrep += sector;
+
211  }
+
212  break;
+
213 
+ +
215  if (ward) {
+
216  sitrep += "\n\nFor this mission, you will need to protect the ";
+
217  sitrep += ward->Name();
+
218  sitrep += " strike package from hostile interceptors.";
+
219  }
+
220  else {
+
221  sitrep += "\n\nFor this mission, you will be responsible for strike escort duty.";
+
222  }
+
223  break;
+
224 
+
225  case Mission::INTEL:
+
226  case Mission::SCOUT:
+
227  case Mission::RECON:
+
228  sitrep += "\n\nThis is an intelligence gathering mission in the ";
+
229  sitrep += sector;
+
230  break;
+
231 
+
232  case Mission::BLOCKADE:
+
233  sitrep += "\n\nThis mission is part of the blockade operation in the ";
+
234  sitrep += sector;
+
235  break;
+
236 
+
237  case Mission::FLEET:
+
238  sitrep += "\n\nThis mission is a routine fleet patrol of the ";
+
239  sitrep += sector;
+
240  break;
+
241 
+ +
243  sitrep += "\n\nOur goal for this mission is to engage and destroy preplanned targets in the ";
+
244  sitrep += sector;
+
245  break;
+
246 
+
247  case Mission::FLIGHT_OPS:
+
248  sitrep += "\n\nFor this mission, the ";
+
249  sitrep += player->Name();
+
250  sitrep += " will be conducting combat flight operations in the ";
+
251  sitrep += sector;
+
252  break;
+
253 
+
254  case Mission::TRAINING:
+
255  sitrep += "\n\nThis will be a training mission.";
+
256  break;
+
257 
+
258  case Mission::TRANSPORT:
+
259  case Mission::CARGO:
+
260  case Mission::OTHER:
+
261  default:
+
262  break;
+
263  }
+
264 
+
265  if (threat.length()) {
+
266  sitrep += " ";
+
267  sitrep += threat;
+
268  sitrep += "\n\n";
+
269  }
+
270  }
+
271  else {
+
272  sitrep += "\n\n";
+
273  }
+
274 
+
275  Text rank;
+
276  Text name;
+
277 
+ +
279 
+
280  if (p) {
+
281  if (p->Rank() > 6)
+
282  rank = ", Admiral";
+
283  else
+
284  rank = Text(", ") + Player::RankName(p->Rank());
+
285 
+
286  name = Text(", ") + p->Name();
+
287  }
+
288 
+
289  sitrep += "You have a mission to perform. ";
+
290 
+
291  switch (RandomIndex()) {
+
292  case 0: sitrep += "You'd better go get to it!"; break;
+
293  case 1: sitrep += "And let's be careful out there!"; break;
+
294  case 2: sitrep += "Good luck, sir!"; break;
+
295  case 3: sitrep += "Let's keep up the good work out there."; break;
+
296  case 4: sitrep += "Don't lose your focus."; break;
+
297  case 5: sitrep += "Good luck out there."; break;
+
298  case 6: sitrep += "What are you waiting for, cocktail hour?"; break;
+
299  case 7: sitrep += Text("Godspeed") + rank + "!"; break;
+
300  case 8: sitrep += Text("Good luck") + rank + "!"; break;
+
301  case 9: sitrep += Text("Good luck") + name + "!"; break;
+
302  case 10: sitrep += "If everything is clear, get your team ready and get underway.";
+
303  break;
+
304  case 11: sitrep += Text("Go get to it") + rank + "!"; break;
+
305  case 12: sitrep += "The clock is ticking, so let's move it!"; break;
+
306  case 13: sitrep += "Stay sharp out there!"; break;
+
307  case 14: sitrep += Text("Go get 'em") + rank + "!"; break;
+
308  case 15: sitrep += "Now get out of here and get to work!"; break;
+
309  }
+
310 }
+
311 
+
312 // +--------------------------------------------------------------------+
+
313 
+ + +
316 {
+
317  MissionElement* escort = 0;
+
318 
+
319  if (!mission || !player) return escort;
+
320 
+ +
322  while (++iter) {
+
323  MissionElement* elem = iter.value();
+
324 
+
325  }
+
326 
+
327  return escort;
+
328 }
+
329 
+
330 // +--------------------------------------------------------------------+
+
331 
+
332 Text
+ +
334 {
+
335  Text threat_info;
+
336 
+
337  int enemy_fighters = 0;
+
338  int enemy_starships = 0;
+
339  int enemy_sites = 0;
+
340 
+
341  if (mission && mission->GetPlayer()) {
+
342  MissionElement* player = mission->GetPlayer();
+
343  Text rgn0 = player->Region();
+
344  Text rgn1;
+
345  int iff = player->GetIFF();
+
346 
+
347  ListIter<Instruction> nav = player->NavList();
+
348  while (++nav) {
+
349  if (rgn0 != nav->RegionName())
+
350  rgn1 = nav->RegionName();
+
351  }
+
352 
+ +
354  while (++elem) {
+
355  if (elem->GetIFF() > 0 && elem->GetIFF() != iff && elem->IntelLevel() > Intel::SECRET) {
+
356  if (elem->IsGroundUnit()) {
+
357  if (!elem->GetDesign() ||
+
358  elem->GetDesign()->type != Ship::SAM)
+
359  continue;
+
360 
+
361  if (elem->Region() != rgn0 &&
+
362  elem->Region() != rgn1)
+
363  continue;
+
364  }
+
365 
+
366  int mission_role = elem->MissionRole();
+
367 
+
368  if (mission_role == Mission::STRIKE ||
+
369  mission_role == Mission::INTEL ||
+
370  mission_role == Mission::CARGO ||
+
371  mission_role == Mission::TRANSPORT)
+
372  continue;
+
373 
+
374  if (elem->GetDesign()->type >= Ship::MINE && elem->GetDesign()->type <= Ship::SWACS)
+
375  enemy_sites += elem->Count();
+
376 
+
377  else if (elem->IsDropship())
+
378  enemy_fighters += elem->Count();
+
379 
+
380  else if (elem->IsStarship())
+
381  enemy_starships += elem->Count();
+
382 
+
383  else if (elem->IsGroundUnit())
+
384  enemy_sites += elem->Count();
+
385  }
+
386  }
+
387  }
+
388 
+
389  if (enemy_starships > 0) {
+
390  threat_info = "We have reports of several enemy starships in the vicinity.";
+
391 
+
392  if (enemy_fighters > 0) {
+
393  threat_info += " Also be advised that enemy fighters may be operating nearby.";
+
394  }
+
395 
+
396  else if (enemy_sites > 0) {
+
397  threat_info += " And be on the lookout for mines and defense satellites.";
+
398  }
+
399  }
+
400 
+
401  else if (enemy_fighters > 0) {
+
402  threat_info = "We have reports of several enemy fighters in your operating area.";
+
403  }
+
404 
+
405  else if (enemy_sites > 0) {
+ +
407  threat_info = "Remember to check air-to-ground sensors for SAM and AAA sites.";
+
408  else
+
409  threat_info = "Be on the lookout for mines and defense satellites.";
+
410  }
+
411  else {
+
412  threat_info = "We have no reliable information on threats in your operating area.";
+
413  }
+
414 
+
415  return threat_info;
+
416 }
+
+
+ + + + -- cgit v1.1