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/_player_dlg_8cpp_source.html | 506 ++++++++++++++++++++++++++ 1 file changed, 506 insertions(+) create mode 100644 Doc/doxygen/html/_player_dlg_8cpp_source.html (limited to 'Doc/doxygen/html/_player_dlg_8cpp_source.html') diff --git a/Doc/doxygen/html/_player_dlg_8cpp_source.html b/Doc/doxygen/html/_player_dlg_8cpp_source.html new file mode 100644 index 0000000..924b861 --- /dev/null +++ b/Doc/doxygen/html/_player_dlg_8cpp_source.html @@ -0,0 +1,506 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/Stars45/PlayerDlg.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
PlayerDlg.cpp
+
+
+Go to the documentation of this file.
1 /* Project Starshatter 5.0
+
2  Destroyer Studios LLC
+
3  Copyright © 1997-2007. All Rights Reserved.
+
4 
+
5  SUBSYSTEM: Stars.exe
+
6  FILE: PlayerDlg.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  Main Menu Dialog Active Window class
+
13 */
+
14 
+
15 #include "MemDebug.h"
+
16 #include "PlayerDlg.h"
+
17 #include "AwardShowDlg.h"
+
18 #include "ConfirmDlg.h"
+
19 #include "MenuScreen.h"
+
20 #include "Player.h"
+
21 
+
22 #include "FormatUtil.h"
+
23 
+
24 #include "Game.h"
+
25 #include "DataLoader.h"
+
26 #include "Button.h"
+
27 #include "ListBox.h"
+
28 #include "EditBox.h"
+
29 #include "ImageBox.h"
+
30 #include "Slider.h"
+
31 #include "Video.h"
+
32 #include "Keyboard.h"
+
33 #include "MachineInfo.h"
+
34 
+
35 // +--------------------------------------------------------------------+
+
36 // DECLARE MAPPING FUNCTIONS:
+
37 
+
38 DEF_MAP_CLIENT(PlayerDlg, OnApply);
+
39 DEF_MAP_CLIENT(PlayerDlg, OnCancel);
+
40 DEF_MAP_CLIENT(PlayerDlg, OnSelectPlayer);
+ + +
43 DEF_MAP_CLIENT(PlayerDlg, OnDelConfirm);
+
44 DEF_MAP_CLIENT(PlayerDlg, OnRank);
+
45 DEF_MAP_CLIENT(PlayerDlg, OnMedal);
+
46 
+
47 // +--------------------------------------------------------------------+
+
48 
+ +
50 : FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr),
+
51 lst_roster(0), btn_add(0), btn_del(0),
+
52 txt_name(0), txt_password(0), txt_squadron(0), txt_signature(0),
+
53 img_rank(0)
+
54 {
+
55  Init(def);
+
56 }
+
57 
+ +
59 {
+
60 }
+
61 
+
62 // +--------------------------------------------------------------------+
+
63 
+
64 void
+ +
66 {
+
67  lst_roster = (ListBox*) FindControl(200);
+
68  btn_add = (Button*) FindControl(101);
+
69  btn_del = (Button*) FindControl(102);
+
70  txt_name = (EditBox*) FindControl(201);
+ + + +
74 
+ +
76  lbl_rank = FindControl(206);
+ + +
79  lbl_kills = FindControl(209);
+
80  lbl_losses = FindControl(210);
+
81  lbl_points = FindControl(211);
+
82 
+
83  img_rank = (ImageBox*) FindControl(220);
+ +
85 
+
86  for (int i = 0; i < 15; i++) {
+
87  medals[i] = -1;
+
88  img_medals[i] = (ImageBox*) FindControl(230 + i);
+
89  if (img_medals[i])
+ +
91  }
+
92 
+
93  for (int i = 0; i < 10; i++) {
+
94  txt_chat[i] = (EditBox*) FindControl(300 + i);
+
95  }
+
96 
+ + + + +
101 
+
102  apply = (Button*) FindControl(1);
+ +
104 
+
105  cancel = (Button*) FindControl(2);
+ +
107 }
+
108 
+
109 // +--------------------------------------------------------------------+
+
110 
+
111 void
+ +
113 {
+ +
115 
+
116  if (!lst_roster) return;
+ + + +
120 
+
121  int current_index = 0;
+
122 
+
123  List<Player>& roster = Player::GetRoster();
+
124  for (int i = 0; i < roster.size(); i++) {
+
125  Player* p = roster[i];
+
126  lst_roster->AddItem(p->Name());
+
127  if (p == Player::GetCurrentPlayer())
+
128  current_index = i;
+
129  }
+
130 
+
131  lst_roster->SetSelected(current_index);
+
132  ShowPlayer();
+
133 
+
134  apply->SetEnabled(roster.size() > 0);
+
135 }
+
136 
+
137 // +--------------------------------------------------------------------+
+
138 
+
139 void
+ +
141 {
+
142  if (Keyboard::KeyDown(VK_RETURN)) {
+
143  OnApply(0);
+
144  }
+
145 }
+
146 
+
147 // +--------------------------------------------------------------------+
+
148 
+
149 void
+ +
151 {
+ +
153 
+
154  if (p) {
+
155  if (txt_name) txt_name->SetText(p->Name());
+ + + +
159 
+
160  char flight_time[64], missions[16], kills[16], losses[16], points[16];
+
161  FormatTime(flight_time, p->FlightTime());
+
162  sprintf_s(missions, "%d", p->Missions());
+
163  sprintf_s(kills, "%d", p->Kills());
+
164  sprintf_s(losses, "%d", p->Losses());
+
165  sprintf_s(points, "%d", p->Points());
+
166 
+ + +
169  if (lbl_flighttime) lbl_flighttime->SetText(flight_time);
+
170  if (lbl_missions) lbl_missions->SetText(missions);
+
171  if (lbl_kills) lbl_kills->SetText(kills);
+
172  if (lbl_losses) lbl_losses->SetText(losses);
+
173  if (lbl_points) lbl_points->SetText(points);
+
174 
+
175  if (img_rank) {
+ +
177  img_rank->Show();
+
178  }
+
179 
+
180  for (int i = 0; i < 15; i++) {
+
181  if (img_medals[i]) {
+
182  int medal = p->Medal(i);
+
183  if (medal) {
+
184  medals[i] = medal;
+ +
186  img_medals[i]->Show();
+
187  }
+
188  else {
+
189  medals[i] = -1;
+
190  img_medals[i]->Hide();
+
191  }
+
192  }
+
193  }
+
194 
+
195  for (int i = 0; i < 10; i++) {
+
196  if (txt_chat[i])
+
197  txt_chat[i]->SetText(p->ChatMacro(i));
+
198  }
+
199  }
+
200  else {
+
201  if (txt_name) txt_name->SetText("");
+ + + +
205 
+ +
207  if (lbl_rank) lbl_rank->SetText("");
+ + +
210  if (lbl_kills) lbl_kills->SetText("");
+
211  if (lbl_losses) lbl_losses->SetText("");
+
212  if (lbl_points) lbl_points->SetText("");
+
213 
+
214  if (img_rank) img_rank->Hide();
+
215 
+
216  for (int i = 0; i < 15; i++) {
+
217  medals[i] = -1;
+
218  if (img_medals[i])
+
219  img_medals[i]->Hide();
+
220  }
+
221 
+
222  for (int i = 0; i < 10; i++) {
+
223  if (txt_chat[i])
+
224  txt_chat[i]->SetText("");
+
225  }
+
226  }
+
227 }
+
228 
+
229 // +--------------------------------------------------------------------+
+
230 
+
231 void
+ +
233 {
+ +
235 
+
236  if (p) {
+
237  if (txt_name) p->SetName(txt_name->GetText());
+ + + +
241 
+
242  for (int i = 0; i < 10; i++) {
+
243  if (txt_chat[i])
+
244  p->SetChatMacro(i, txt_chat[i]->GetText());
+
245  }
+
246  }
+
247 }
+
248 
+
249 // +--------------------------------------------------------------------+
+
250 
+
251 void
+ +
253 {
+
254  if (!lst_roster) return;
+
255 
+
256  UpdatePlayer();
+
257 
+
258  int index = lst_roster->GetSelection();
+
259 
+
260  List<Player>& roster = Player::GetRoster();
+
261  if (index >= 0 && index < roster.size()) {
+
262  Player::SelectPlayer(roster.at(index));
+
263  }
+
264 
+
265  ShowPlayer();
+
266 
+
267  apply->SetEnabled(roster.size() > 0);
+
268 }
+
269 
+
270 void
+ +
272 {
+
273  Player::Create("Pilot");
+
274  ShowPlayer();
+
275 
+
276  if (!lst_roster) return;
+ +
278 
+
279  List<Player>& roster = Player::GetRoster();
+
280  for (int i = 0; i < roster.size(); i++) {
+
281  Player* p = roster[i];
+
282  lst_roster->AddItem(p->Name());
+ +
284  }
+
285 
+
286  apply->SetEnabled(roster.size() > 0);
+
287 }
+
288 
+
289 void
+ +
291 {
+ +
293  return;
+
294 
+
295  ConfirmDlg* confirm = manager->GetConfirmDlg();
+
296  if (confirm) {
+
297  char msg[256];
+
298  sprintf_s(msg, Game::GetText("PlayerDlg.are-you-sure").data(),
+
299  Player::GetCurrentPlayer()->Name().data());
+
300  confirm->SetMessage(msg);
+
301  confirm->SetTitle(Game::GetText("PlayerDlg.confirm-delete"));
+
302  confirm->SetParentControl(btn_del);
+
303 
+ +
305  }
+
306 
+
307  else {
+
308  OnDelConfirm(event);
+
309  }
+
310 }
+
311 
+
312 void
+ +
314 {
+ +
316  ShowPlayer();
+
317 
+
318  if (!lst_roster) return;
+ +
320 
+
321  List<Player>& roster = Player::GetRoster();
+
322  for (int i = 0; i < roster.size(); i++) {
+
323  Player* p = roster[i];
+
324  lst_roster->AddItem(p->Name());
+ +
326  }
+
327 
+
328  apply->SetEnabled(roster.size() > 0);
+
329 }
+
330 
+
331 // +--------------------------------------------------------------------+
+
332 
+
333 void
+ +
335 {
+ +
337  AwardShowDlg* award_dlg = manager->GetAwardDlg();
+
338 
+
339  if (p && award_dlg) {
+
340  award_dlg->SetRank(p->Rank());
+ +
342  }
+
343 }
+
344 
+
345 void
+ +
347 {
+ +
349  AwardShowDlg* award_dlg = manager->GetAwardDlg();
+
350 
+
351  if (p && award_dlg) {
+
352  int m = -1, i;
+
353 
+
354  for (i = 0; i < 15; i++) {
+
355  if (event->window == img_medals[i]) {
+
356  m = i;
+
357  break;
+
358  }
+
359  }
+
360 
+
361  if (m >= 0) {
+
362  award_dlg->SetMedal(medals[i]);
+ +
364  }
+
365  }
+
366 }
+
367 
+
368 // +--------------------------------------------------------------------+
+
369 
+
370 void
+ +
372 {
+
373  Player* player = Player::GetCurrentPlayer();
+
374  if (player) {
+
375  UpdatePlayer();
+
376  Player::Save();
+
377  }
+
378 
+
379  FlushKeys();
+
380  manager->ShowMenuDlg();
+
381 }
+
382 
+
383 void
+ +
385 {
+
386  Player::Load();
+
387  FlushKeys();
+
388  manager->ShowMenuDlg();
+
389 }
+
+
+ + + + -- cgit v1.1