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 --- Doc/doxygen/html/_msn_dlg_8cpp_source.html | 420 +++++++++++++++++++++++++++++ 1 file changed, 420 insertions(+) create mode 100644 Doc/doxygen/html/_msn_dlg_8cpp_source.html (limited to 'Doc/doxygen/html/_msn_dlg_8cpp_source.html') diff --git a/Doc/doxygen/html/_msn_dlg_8cpp_source.html b/Doc/doxygen/html/_msn_dlg_8cpp_source.html new file mode 100644 index 0000000..636ad5a --- /dev/null +++ b/Doc/doxygen/html/_msn_dlg_8cpp_source.html @@ -0,0 +1,420 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/Stars45/MsnDlg.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
MsnDlg.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: MsnDlg.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  Mission Briefing Dialog Active Window class
+
13 */
+
14 
+
15 #include "MemDebug.h"
+
16 #include "MsnDlg.h"
+
17 #include "PlanScreen.h"
+
18 #include "Starshatter.h"
+
19 #include "Campaign.h"
+
20 #include "Mission.h"
+
21 #include "Instruction.h"
+
22 #include "Ship.h"
+
23 #include "ShipDesign.h"
+
24 #include "StarSystem.h"
+
25 
+
26 #include "NetLobby.h"
+
27 
+
28 #include "Game.h"
+
29 #include "FormWindow.h"
+
30 #include "FormatUtil.h"
+
31 #include "Keyboard.h"
+
32 #include "Mouse.h"
+
33 #include "Button.h"
+
34 #include "ListBox.h"
+
35 #include "Slider.h"
+
36 #include "ParseUtil.h"
+
37 
+
38 // +--------------------------------------------------------------------+
+
39 
+ +
41 : plan_screen(mgr),
+
42 commit(0), cancel(0), campaign(0), mission(0),
+
43 pkg_index(-1), info(0)
+
44 {
+ +
46 
+
47  if (campaign)
+ +
49 
+
50  mission_name = 0;
+
51  mission_system = 0;
+
52  mission_sector = 0;
+ + + +
56 
+
57  sit_button = 0;
+
58  pkg_button = 0;
+
59  nav_button = 0;
+
60  wep_button = 0;
+
61  commit = 0;
+
62  cancel = 0;
+
63 }
+
64 
+ +
66 {
+
67 }
+
68 
+
69 // +--------------------------------------------------------------------+
+
70 
+
71 void
+ +
73 {
+
74  mission_name = win->FindControl(200);
+
75  mission_system = win->FindControl(202);
+
76  mission_sector = win->FindControl(204);
+
77  mission_time_start = win->FindControl(206);
+
78  mission_time_target = win->FindControl(208);
+ +
80 
+
81  sit_button = (Button*) win->FindControl(900);
+
82  pkg_button = (Button*) win->FindControl(901);
+
83  nav_button = (Button*) win->FindControl(902);
+
84  wep_button = (Button*) win->FindControl(903);
+
85  commit = (Button*) win->FindControl(1);
+
86  cancel = (Button*) win->FindControl(2);
+
87 }
+
88 
+
89 // +--------------------------------------------------------------------+
+
90 
+
91 void
+ +
93 {
+ +
95 
+
96  mission = 0;
+
97  pkg_index = -1;
+
98 
+
99  if (campaign) {
+ +
101 
+
102  if (!mission)
+
103  ::Print("ERROR - MsnDlg::Show() no mission.\n");
+
104  else
+
105  ::Print("MsnDlg::Show() mission id = %d name = '%s'\n",
+
106  mission->Identity(),
+
107  mission->Name());
+
108  }
+
109  else {
+
110  ::Print("ERROR - MsnDlg::Show() no campaign.\n");
+
111  }
+
112 
+
113  if (mission_name) {
+
114  if (mission)
+ +
116  else
+
117  mission_name->SetText(Game::GetText("MsnDlg.no-mission"));
+
118  }
+
119 
+
120  if (mission_system) {
+
121  mission_system->SetText("");
+
122 
+
123  if (mission) {
+
124  StarSystem* sys = mission->GetStarSystem();
+
125 
+
126  if (sys)
+
127  mission_system->SetText(sys->Name());
+
128  }
+
129  }
+
130 
+
131  if (mission_sector) {
+
132  mission_sector->SetText("");
+
133 
+
134  if (mission) {
+ +
136  }
+
137  }
+
138 
+
139  if (mission_time_start) {
+
140  if (mission) {
+
141  char txt[32];
+
142  FormatDayTime(txt, mission->Start());
+ +
144  }
+
145  }
+
146 
+
147  if (mission_time_target) {
+
148  int time_on_target = CalcTimeOnTarget();
+
149 
+
150  if (time_on_target) {
+
151  char txt[32];
+
152  FormatDayTime(txt, time_on_target);
+ + +
155  }
+
156  else {
+ + +
159  }
+
160  }
+
161 
+
162 
+
163  if (sit_button) {
+ +
165  sit_button->SetEnabled(true);
+
166  }
+
167 
+
168  if (pkg_button) {
+ +
170  pkg_button->SetEnabled(true);
+
171  }
+
172 
+
173  if (nav_button) {
+ +
175  nav_button->SetEnabled(true);
+
176  }
+
177 
+
178  if (wep_button) {
+ +
180  wep_button->SetEnabled(true);
+
181  }
+
182 
+
183  bool mission_ok = true;
+
184 
+
185  if (!mission || !mission->IsOK()) {
+
186  mission_ok = false;
+
187 
+
188  if (sit_button) sit_button->SetEnabled(false);
+
189  if (pkg_button) pkg_button->SetEnabled(false);
+
190  if (nav_button) nav_button->SetEnabled(false);
+
191  if (wep_button) wep_button->SetEnabled(false);
+
192  }
+
193  else {
+
194  MissionElement* player_elem = mission->GetPlayer();
+
195 
+
196  if (wep_button && player_elem)
+
197  wep_button->SetEnabled(player_elem->Loadouts().size() > 0);
+
198  }
+
199 
+ +
201  wep_button->SetEnabled(false);
+
202 
+
203  commit->SetEnabled(mission_ok);
+
204  cancel->SetEnabled(true);
+
205 }
+
206 
+
207 // +--------------------------------------------------------------------+
+
208 
+
209 int
+ +
211 {
+
212  if (mission) {
+
213  MissionElement* element = mission->GetElements()[0];
+
214  if (element) {
+
215  Point loc = element->Location();
+
216  loc.SwapYZ(); // navpts use Z for altitude, element loc uses Y for altitude.
+
217 
+
218  int mission_time = mission->Start();
+
219 
+
220  int i = 0;
+
221  ListIter<Instruction> navpt = element->NavList();
+
222  while (++navpt) {
+
223  int action = navpt->Action();
+
224 
+
225  double dist = Point(loc - navpt->Location()).length();
+
226 
+
227  int etr = 0;
+
228 
+
229  if (navpt->Speed() > 0)
+
230  etr = (int) (dist / navpt->Speed());
+
231  else
+
232  etr = (int) (dist / 500);
+
233 
+
234  mission_time += etr;
+
235 
+
236  loc = navpt->Location();
+
237  i++;
+
238 
+
239  if (action >= Instruction::ESCORT) { // this is the target!
+
240  return mission_time;
+
241  }
+
242  }
+
243  }
+
244  }
+
245 
+
246  return 0;
+
247 }
+
248 
+
249 // +--------------------------------------------------------------------+
+
250 
+
251 void
+ +
253 {
+
254  if (event->window == sit_button) {
+ +
256  }
+
257 
+
258  if (event->window == pkg_button) {
+ +
260  }
+
261 
+
262  if (event->window == nav_button) {
+ +
264  }
+
265 
+
266  if (event->window == wep_button) {
+ +
268  }
+
269 }
+
270 
+
271 // +--------------------------------------------------------------------+
+
272 
+
273 void
+ +
275 {
+ +
277 
+
278  if (stars) {
+
279  Mouse::Show(false);
+ +
281  }
+
282 
+
283  else
+
284  Game::Panic("MsnDlg::OnCommit() - Game instance not found");
+
285 }
+
286 
+
287 void
+ +
289 {
+ +
291 
+
292  if (stars) {
+
293  Mouse::Show(false);
+
294 
+
295  if (campaign && (campaign->IsDynamic() || campaign->IsTraining()))
+ +
297  else
+ +
299  }
+
300 
+
301  else
+
302  Game::Panic("MsnDlg::OnCancel() - Game instance not found");
+
303 }
+
+
+ + + + -- cgit v1.1