From b829170121d3657369904ec62d8065606777a9ce Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 1 Oct 2021 18:54:04 +0200 Subject: Removed doxygen generated docs They can be rebuild anytime and are considered a build artifact/binary. --- Doc/doxygen/html/_msn_wep_dlg_8cpp_source.html | 634 ------------------------- 1 file changed, 634 deletions(-) delete mode 100644 Doc/doxygen/html/_msn_wep_dlg_8cpp_source.html (limited to 'Doc/doxygen/html/_msn_wep_dlg_8cpp_source.html') diff --git a/Doc/doxygen/html/_msn_wep_dlg_8cpp_source.html b/Doc/doxygen/html/_msn_wep_dlg_8cpp_source.html deleted file mode 100644 index a4fadb3..0000000 --- a/Doc/doxygen/html/_msn_wep_dlg_8cpp_source.html +++ /dev/null @@ -1,634 +0,0 @@ - - - - - -Starshatter_Open: D:/SRC/StarshatterSVN/Stars45/MsnWepDlg.cpp Source File - - - - - - - - - - - - - -
-
- - - - - - -
-
Starshatter_Open -
-
Open source Starshatter engine
-
-
- - - - - -
-
- -
-
-
- -
- - - - -
- -
- -
-
-
MsnWepDlg.cpp
-
-
-Go to the documentation of this file.
1 /* Project Starshatter 4.5
-
2  Destroyer Studios LLC
-
3  Copyright (C) 1997-2004. All Rights Reserved.
-
4 
-
5  SUBSYSTEM: Stars.exe
-
6  FILE: MsnWepDlg.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 "MsnWepDlg.h"
-
17 #include "PlanScreen.h"
-
18 #include "Starshatter.h"
-
19 #include "Campaign.h"
-
20 #include "Mission.h"
-
21 #include "Ship.h"
-
22 #include "ShipDesign.h"
-
23 #include "WeaponDesign.h"
-
24 #include "HardPoint.h"
-
25 #include "StarSystem.h"
-
26 #include "FormatUtil.h"
-
27 
-
28 #include "Game.h"
-
29 #include "Mouse.h"
-
30 #include "Button.h"
-
31 #include "ListBox.h"
-
32 #include "Slider.h"
-
33 #include "ParseUtil.h"
-
34 #include "Keyboard.h"
-
35 
-
36 // +--------------------------------------------------------------------+
-
37 // DECLARE MAPPING FUNCTIONS:
-
38 DEF_MAP_CLIENT(MsnWepDlg, OnCommit);
-
39 DEF_MAP_CLIENT(MsnWepDlg, OnCancel);
-
40 DEF_MAP_CLIENT(MsnWepDlg, OnTabButton);
-
41 DEF_MAP_CLIENT(MsnWepDlg, OnMount);
-
42 DEF_MAP_CLIENT(MsnWepDlg, OnLoadout);
-
43 
-
44 // +--------------------------------------------------------------------+
-
45 
- -
47 : FormWindow(s, 0, 0, s->Width(), s->Height()), MsnDlg(mgr),
-
48 elem(0), first_station(0), beauty(0), player_desc(0)
-
49 {
- -
51 
-
52  if (campaign)
- -
54 
-
55  ZeroMemory(designs, sizeof(designs));
-
56  ZeroMemory(mounts, sizeof(mounts));
-
57  Init(def);
-
58 }
-
59 
- -
61 {
-
62 }
-
63 
-
64 // +--------------------------------------------------------------------+
-
65 
-
66 void
- -
68 {
-
69  lbl_element = FindControl(601);
-
70  lbl_type = FindControl(602);
-
71  lbl_weight = FindControl(603);
- -
73  beauty = (ImageBox*) FindControl(300);
-
74  player_desc = FindControl(301);
-
75 
-
76  if (loadout_list)
- -
78 
-
79  for (int i = 0; i < 8; i++) {
-
80  lbl_desc[i] = FindControl(500 + i*10);
-
81  lbl_station[i] = FindControl(401 + i);
-
82 
-
83  for (int n = 0; n < 8; n++) {
-
84  btn_load[i][n] = (Button*) FindControl(500 + i*10 + n + 1);
-
85 
-
86  if (btn_load[i][n]) {
-
87  if (i == 0) {
-
88  if (n == 0)
-
89  btn_load[i][n]->GetPicture(led_off);
-
90  else if (n == 1)
-
91  btn_load[i][n]->GetPicture(led_on);
-
92  }
-
93 
-
94  btn_load[i][n]->SetPicture(led_off);
-
95  btn_load[i][n]->SetPictureLocation(4); // centered
- -
97  }
-
98  }
-
99  }
-
100 
-
101  RegisterMsnControls(this);
-
102 
-
103  if (commit)
- -
105 
-
106  if (cancel)
- -
108 
-
109  if (sit_button)
- -
111 
-
112  if (pkg_button)
- -
114 
-
115  if (nav_button)
- -
117 
-
118  if (wep_button)
- -
120 }
-
121 
-
122 // +--------------------------------------------------------------------+
-
123 
-
124 void
- -
126 {
- -
128  ShowMsnDlg();
-
129 
-
130  if (mission) {
-
131  for (int i = 0; i < mission->GetElements().size(); i++) {
- -
133  if (e->Player()) {
-
134  elem = e;
-
135  break;
-
136  }
-
137  }
-
138  }
-
139 
-
140  if (elem) {
-
141  SetupControls();
-
142  }
-
143 }
-
144 
-
145 // +--------------------------------------------------------------------+
-
146 
-
147 void
- -
149 {
-
150  ShipDesign* design = (ShipDesign*) elem->GetDesign();
-
151 
-
152  if (lbl_element)
- -
154 
-
155  if (lbl_type)
-
156  lbl_type->SetText(design->name);
-
157 
-
158  BuildLists();
-
159 
-
160  for (int i = 0; i < 8; i++) {
-
161  if (!lbl_desc[i]) continue;
-
162 
-
163  if (designs[i]) {
-
164  lbl_desc[i]->Show();
-
165  lbl_desc[i]->SetText(designs[i]->group + " " + designs[i]->name);
-
166 
-
167  for (int n = 0; n < 8; n++) {
-
168  if (mounts[i][n]) {
-
169  btn_load[i][n]->Show();
-
170  btn_load[i][n]->SetPicture((loads[n]==i) ? led_on : led_off);
-
171  }
-
172  else {
-
173  btn_load[i][n]->Hide();
-
174  }
-
175  }
-
176  }
-
177  else {
-
178  lbl_desc[i]->Hide();
-
179 
-
180  for (int n = 0; n < 8; n++) {
-
181  btn_load[i][n]->Hide();
-
182  }
-
183  }
-
184  }
-
185 
-
186  double loaded_mass = 0;
-
187  char weight[32];
-
188 
-
189  if (loadout_list) {
- -
191 
-
192  if (design) {
- -
194  while (++sl) {
-
195  ShipLoad* load = sl.value();
-
196  int item = loadout_list->AddItem(load->name) - 1;
-
197 
-
198  sprintf_s(weight, "%d kg", (int) ((design->mass + load->mass) * 1000));
-
199  loadout_list->SetItemText(item, 1, weight);
-
200  loadout_list->SetItemData(item, 1, (DWORD) (load->mass * 1000));
-
201 
-
202  if (elem->Loadouts().size() > 0 &&
-
203  elem->Loadouts().at(0)->GetName() == load->name) {
-
204  loadout_list->SetSelected(item, true);
-
205  loaded_mass = design->mass + load->mass;
-
206  }
-
207  }
-
208  }
-
209  }
-
210 
-
211  if (lbl_weight && design) {
-
212  if (loaded_mass < 1)
-
213  loaded_mass = design->mass;
-
214 
-
215  sprintf_s(weight, "%d kg", (int) (loaded_mass * 1000));
-
216  lbl_weight->SetText(weight);
-
217  }
-
218 
-
219  if (beauty && design) {
-
220  beauty->SetPicture(design->beauty);
-
221  }
-
222 
-
223  if (player_desc && design) {
-
224  char txt[256];
-
225 
-
226  if (design->type <= Ship::ATTACK)
-
227  sprintf_s(txt, "%s %s", design->abrv, design->display_name);
-
228  else
-
229  sprintf_s(txt, "%s %s", design->abrv, elem->Name().data());
-
230 
-
231  player_desc->SetText(txt);
-
232  }
-
233 }
-
234 
-
235 // +--------------------------------------------------------------------+
-
236 
-
237 void
- -
239 {
-
240  ZeroMemory(designs, sizeof(designs));
-
241  ZeroMemory(mounts, sizeof(mounts));
-
242 
-
243  if (elem) {
-
244  ShipDesign* d = (ShipDesign*) elem->GetDesign();
-
245  int nstations = d->hard_points.size();
-
246 
-
247  first_station = (8 - nstations) / 2;
-
248 
-
249  int index = 0;
-
250  int station = first_station;
-
251 
-
252  for (int s = 0; s < 8; s++)
-
253  if (lbl_station[s])
-
254  lbl_station[s]->SetText("");
-
255 
- -
257  while (++iter) {
-
258  HardPoint* hp = iter.value();
-
259 
-
260  if (lbl_station[station])
-
261  lbl_station[station]->SetText(hp->GetAbbreviation());
-
262 
-
263  for (int n = 0; n < HardPoint::MAX_DESIGNS; n++) {
-
264  WeaponDesign* wep_dsn = hp->GetWeaponDesign(n);
-
265 
-
266  if (wep_dsn) {
-
267  bool found = false;
-
268 
-
269  for (int i = 0; i < 8 && !found; i++) {
-
270  if (designs[i] == wep_dsn) {
-
271  found = true;
-
272  mounts[i][station] = true;
-
273  }
-
274  }
-
275 
-
276  if (!found) {
-
277  mounts[index][station] = true;
-
278  designs[index++] = wep_dsn;
-
279  }
-
280  }
-
281  }
-
282 
-
283  station++;
-
284  }
-
285 
-
286  if (elem->Loadouts().size()) {
-
287  MissionLoad* msn_load = elem->Loadouts().at(0);
-
288 
-
289  for (int i = 0; i < 8; i++)
-
290  loads[i] = -1;
-
291 
-
292  // map loadout:
-
293  int* loadout = 0;
-
294  if (msn_load->GetName().length()) {
-
295  ListIter<ShipLoad> sl = ((ShipDesign*) elem->GetDesign())->loadouts;
-
296  while (++sl) {
-
297  if (!_stricmp(sl->name, msn_load->GetName()))
-
298  loadout = sl->load;
-
299  }
-
300  }
-
301  else {
-
302  loadout = msn_load->GetStations();
-
303  }
-
304 
-
305  for (int i = 0; i < nstations; i++) {
-
306  loads[i + first_station] = loadout[i];
-
307  }
-
308  }
-
309  }
-
310 }
-
311 
-
312 // +--------------------------------------------------------------------+
-
313 
-
314 void
- -
316 {
-
317  if (Keyboard::KeyDown(VK_RETURN)) {
-
318  OnCommit(0);
-
319  }
-
320 }
-
321 
-
322 // +--------------------------------------------------------------------+
-
323 
-
324 int
- -
326 {
-
327  int nn = n + first_station;
-
328 
-
329  if (!elem || nn < 0 || nn >= 8 || loads[nn] == -1)
-
330  return -1;
-
331 
-
332  int index = -1;
-
333  WeaponDesign* wep_design = designs[ loads[nn] ];
-
334  ShipDesign* design = (ShipDesign*) elem->GetDesign();
-
335  HardPoint* hard_point = design->hard_points[n];
-
336 
-
337  for (int i = 0; i < 8 && index < 0; i++) {
-
338  if (hard_point->GetWeaponDesign(i) == wep_design) {
-
339  index = i;
-
340  }
-
341  }
-
342 
-
343  return index;
-
344 }
-
345 
-
346 int
- -
348 {
-
349  int nn = n + first_station;
-
350 
-
351  if (!elem || nn < 0 || nn >= 8)
-
352  return -1;
-
353 
-
354  int result = -1;
-
355  ShipDesign* design = (ShipDesign*) elem->GetDesign();
-
356  HardPoint* hard_point = design->hard_points[n];
-
357  WeaponDesign* wep_design = hard_point->GetWeaponDesign(index);
-
358 
-
359  for (int i = 0; i < 8 && result < 0; i++) {
-
360  if (designs[i] == wep_design) {
-
361  result = i;
-
362  }
-
363  }
-
364 
-
365  return result;
-
366 }
-
367 
-
368 // +--------------------------------------------------------------------+
-
369 
-
370 void
- -
372 {
-
373  int station = -1;
-
374  int item = -1;
-
375 
-
376  for (int i = 0; i < 8 && item < 0; i++) {
-
377  for (int n = 0; n < 8 && station < 0; n++) {
-
378  if (btn_load[i][n] == event->window) {
-
379  station = n;
-
380  item = i;
-
381  }
-
382  }
-
383  }
-
384 
-
385  if (item >= 0 && station >= 0) {
-
386  if (loads[station] == item)
-
387  item = -1;
-
388 
-
389  loads[station] = item;
-
390 
-
391  for (int n = 0; n < 8; n++) {
-
392  btn_load[n][station]->SetPicture(n == item ? led_on : led_off);
-
393  }
-
394 
-
395  if (elem) {
-
396  int nstations = elem->GetDesign()->hard_points.size();
-
397 
-
398  if (elem->Loadouts().size() < 1) {
-
399  MissionLoad* l = new(__FILE__,__LINE__) MissionLoad;
-
400  elem->Loadouts().append(l);
-
401 
-
402  for (int n = 0; n < nstations; n++)
-
403  l->SetStation(n, LoadToPointIndex(n));
-
404  }
-
405  else {
- -
407  while (++l) {
-
408  // if the player customizes the loadout,
-
409  // tell the sim loader not to use a named
-
410  // loadout from the ship design:
-
411  l->SetName("");
-
412 
-
413  for (int n = 0; n < nstations; n++)
-
414  l->SetStation(n, LoadToPointIndex(n));
-
415  }
-
416  }
-
417  }
-
418  }
-
419 
-
420  if (loadout_list)
- -
422 
-
423  if (lbl_weight && elem) {
-
424  ShipDesign* d = (ShipDesign*) elem->GetDesign();
-
425  int nstations = d->hard_points.size();
-
426  double mass = d->mass;
-
427 
-
428  for (int n = 0; n < nstations; n++) {
-
429  int item = loads[n+first_station];
-
430  mass += d->hard_points[n]->GetCarryMass(item);
-
431  }
-
432 
-
433  char weight[32];
-
434  sprintf_s(weight, "%d kg", (int) (mass * 1000));
-
435  lbl_weight->SetText(weight);
-
436  }
-
437 }
-
438 
-
439 // +--------------------------------------------------------------------+
-
440 
-
441 void
- -
443 {
-
444  if (!elem) return;
-
445 
-
446  ShipDesign* design = (ShipDesign*) elem->GetDesign();
-
447  ShipLoad* shipload = 0;
-
448 
-
449  if (loadout_list && design) {
-
450  int index = loadout_list->GetListIndex();
-
451  Text loadname = loadout_list->GetItemText(index);
-
452 
- -
454  while (++sl) {
-
455  if (sl->name == loadname) {
-
456  shipload = sl.value();
-
457  }
-
458  }
-
459 
-
460  if (!shipload) return;
-
461 
-
462  if (lbl_weight) {
-
463  char weight[32];
-
464  sprintf_s(weight, "%d kg", (int) ((design->mass + shipload->mass) * 1000));
-
465  lbl_weight->SetText(weight);
-
466  }
-
467 
-
468  if (elem->Loadouts().size() < 1) {
-
469  MissionLoad* l = new(__FILE__,__LINE__) MissionLoad(-1, shipload->name);
-
470  elem->Loadouts().append(l);
-
471  }
-
472  else {
- -
474  while (++l) {
-
475  // if the player chooses a std loadout,
-
476  // tell the sim loader to use a named
-
477  // loadout from the ship design:
-
478  l->SetName(shipload->name);
-
479  }
-
480  }
-
481 
-
482  int nstations = design->hard_points.size();
-
483  int* loadout = shipload->load;
-
484 
-
485  for (int i = 0; i < 8; i++)
-
486  loads[i] = -1;
-
487 
-
488  for (int i = 0; i < nstations; i++)
-
489  loads[i + first_station] = PointIndexToLoad(i, loadout[i]);
-
490 
-
491  for (int i = 0; i < 8; i++) {
-
492  for (int n = 0; n < 8; n++) {
-
493  btn_load[i][n]->SetPicture(i == loads[n] ? led_on: led_off);
-
494  }
-
495  }
-
496  }
-
497 }
-
498 
-
499 // +--------------------------------------------------------------------+
-
500 
-
501 void
- -
503 {
-
504  MsnDlg::OnCommit(event);
-
505 }
-
506 
-
507 void
- -
509 {
-
510  MsnDlg::OnCancel(event);
-
511 }
-
512 
-
513 void
- -
515 {
-
516  MsnDlg::OnTabButton(event);
-
517 }
-
-
- - - - -- cgit v1.1