From 5b9d9f92ea76320e405a1ffef8f1ed295cbd9999 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Tue, 5 Jun 2012 18:53:11 +0000 Subject: Documentation update --- Doc/doxygen/html/_cmp_select_dlg_8cpp_source.html | 677 +++++++++++----------- 1 file changed, 331 insertions(+), 346 deletions(-) (limited to 'Doc/doxygen/html/_cmp_select_dlg_8cpp_source.html') diff --git a/Doc/doxygen/html/_cmp_select_dlg_8cpp_source.html b/Doc/doxygen/html/_cmp_select_dlg_8cpp_source.html index c96ff78..dea5b81 100644 --- a/Doc/doxygen/html/_cmp_select_dlg_8cpp_source.html +++ b/Doc/doxygen/html/_cmp_select_dlg_8cpp_source.html @@ -352,386 +352,371 @@ $(document).ready(function(){initNavTree('_cmp_select_dlg_8cpp.html','');});
248 
249  // if campaign is not available, show the grayed-out image
250 
-
251 #ifdef STARSHATTER_DEMO_RELEASE
-
252  // DEMO VERSION (only one campaign):
-
253  if (c->GetCampaignId() > 2) {
+
251  // FULL GAME CRITERIA (based on player record):
+
252  if (c->GetCampaignId() > 2 && c->GetCampaignId() < 10 &&
+
253  !player->HasCompletedCampaign(c->GetCampaignId()-1)) {
254  images[n]->CopyBitmap(*c->GetImage(2));
255  lst_campaigns->SetItemImage(n, images[n]);
256  }
257 
-
258 #else
-
259  // FULL GAME CRITERIA (based on player record):
-
260  if (c->GetCampaignId() > 2 && c->GetCampaignId() < 10 &&
-
261  !player->HasCompletedCampaign(c->GetCampaignId()-1)) {
-
262  images[n]->CopyBitmap(*c->GetImage(2));
-
263  lst_campaigns->SetItemImage(n, images[n]);
-
264  }
-
265 
-
266  // Two additional sequences of ten campaigns (10-19 and 20-29)
-
267  // for mod authors to use:
-
268  else if (c->GetCampaignId() >= 10 && c->GetCampaignId() < 30 &&
-
269  (c->GetCampaignId() % 10) != 0 &&
-
270  !player->HasCompletedCampaign(c->GetCampaignId()-1)) {
-
271  images[n]->CopyBitmap(*c->GetImage(2));
-
272  lst_campaigns->SetItemImage(n, images[n]);
-
273  }
+
258  // Two additional sequences of ten campaigns (10-19 and 20-29)
+
259  // for mod authors to use:
+
260  else if (c->GetCampaignId() >= 10 && c->GetCampaignId() < 30 &&
+
261  (c->GetCampaignId() % 10) != 0 &&
+
262  !player->HasCompletedCampaign(c->GetCampaignId()-1)) {
+
263  images[n]->CopyBitmap(*c->GetImage(2));
+
264  lst_campaigns->SetItemImage(n, images[n]);
+
265  }
+
266 
+
267  // NOTE: Campaigns 10, 20, and 30-99 are always enabled if they exist!
+
268  }
+
269  }
+
270  }
+
271 
+
272  if (description)
+
273  description->SetText(select_msg);
274 
-
275  // NOTE: Campaigns 10, 20, and 30-99 are always enabled if they exist!
-
276 #endif
-
277  }
-
278  }
-
279  }
+
275  if (btn_accept)
+
276  btn_accept->SetEnabled(false);
+
277 
+
278  show_saved = false;
+
279 }
280 
-
281  if (description)
-
282  description->SetText(select_msg);
-
283 
-
284  if (btn_accept)
-
285  btn_accept->SetEnabled(false);
-
286 
-
287  show_saved = false;
-
288 }
-
289 
-
290 // +--------------------------------------------------------------------+
-
291 
-
292 void
-
293 CmpSelectDlg::ShowSavedCampaigns()
-
294 {
-
295  AutoThreadSync a(sync);
+
281 // +--------------------------------------------------------------------+
+
282 
+
283 void
+
284 CmpSelectDlg::ShowSavedCampaigns()
+
285 {
+
286  AutoThreadSync a(sync);
+
287 
+
288  if (loading && description) {
+
289  description->SetText(Game::GetText("CmpSelectDlg.already-loading"));
+
290  Button::PlaySound(Button::SND_REJECT);
+
291  return;
+
292  }
+
293 
+
294  if (btn_new)
+
295  btn_new->SetButtonState(0);
296 
-
297  if (loading && description) {
-
298  description->SetText(Game::GetText("CmpSelectDlg.already-loading"));
-
299  Button::PlaySound(Button::SND_REJECT);
-
300  return;
-
301  }
+
297  if (btn_saved)
+
298  btn_saved->SetButtonState(1);
+
299 
+
300  if (btn_delete)
+
301  btn_delete->SetEnabled(false);
302 
-
303  if (btn_new)
-
304  btn_new->SetButtonState(0);
-
305 
-
306  if (btn_saved)
-
307  btn_saved->SetButtonState(1);
+
303  if (lst_campaigns) {
+
304  lst_campaigns->SetSelectedStyle(ListBox::LIST_ITEM_STYLE_FILLED_BOX);
+
305  lst_campaigns->SetLeading(4);
+
306  lst_campaigns->ClearItems();
+
307  lst_campaigns->SetLineHeight(12);
308 
-
309  if (btn_delete)
-
310  btn_delete->SetEnabled(false);
-
311 
-
312  if (lst_campaigns) {
-
313  lst_campaigns->SetSelectedStyle(ListBox::LIST_ITEM_STYLE_FILLED_BOX);
-
314  lst_campaigns->SetLeading(4);
-
315  lst_campaigns->ClearItems();
-
316  lst_campaigns->SetLineHeight(12);
-
317 
-
318  List<Text> save_list;
+
309  List<Text> save_list;
+
310 
+
311  CampaignSaveGame::GetSaveGameList(save_list);
+
312  save_list.sort();
+
313 
+
314  for (int i = 0; i < save_list.size(); i++)
+
315  lst_campaigns->AddItem(*save_list[i]);
+
316 
+
317  save_list.destroy();
+
318  }
319 
-
320  CampaignSaveGame::GetSaveGameList(save_list);
-
321  save_list.sort();
+
320  if (description)
+
321  description->SetText(select_msg);
322 
-
323  for (int i = 0; i < save_list.size(); i++)
-
324  lst_campaigns->AddItem(*save_list[i]);
+
323  if (btn_accept)
+
324  btn_accept->SetEnabled(false);
325 
-
326  save_list.destroy();
-
327  }
+
326  show_saved = true;
+
327 }
328 
-
329  if (description)
-
330  description->SetText(select_msg);
-
331 
-
332  if (btn_accept)
-
333  btn_accept->SetEnabled(false);
-
334 
-
335  show_saved = true;
-
336 }
-
337 
-
338 // +--------------------------------------------------------------------+
-
339 
-
340 void
-
341 CmpSelectDlg::OnCampaignSelect(AWEvent* event)
-
342 {
-
343  if (description && lst_campaigns) {
-
344  AutoThreadSync a(sync);
+
329 // +--------------------------------------------------------------------+
+
330 
+
331 void
+
332 CmpSelectDlg::OnCampaignSelect(AWEvent* event)
+
333 {
+
334  if (description && lst_campaigns) {
+
335  AutoThreadSync a(sync);
+
336 
+
337  if (loading) {
+
338  description->SetText(Game::GetText("CmpSelectDlg.already-loading"));
+
339  Button::PlaySound(Button::SND_REJECT);
+
340  return;
+
341  }
+
342 
+
343  load_index = -1;
+
344  load_file = "";
345 
-
346  if (loading) {
-
347  description->SetText(Game::GetText("CmpSelectDlg.already-loading"));
-
348  Button::PlaySound(Button::SND_REJECT);
-
349  return;
-
350  }
-
351 
-
352  load_index = -1;
-
353  load_file = "";
-
354 
-
355  Player* player = Player::GetCurrentPlayer();
-
356  if (!player) return;
-
357 
-
358  // NEW CAMPAIGN:
-
359  if (btn_new && btn_new->GetButtonState()) {
-
360  List<Campaign>& list = Campaign::GetAllCampaigns();
+
346  Player* player = Player::GetCurrentPlayer();
+
347  if (!player) return;
+
348 
+
349  // NEW CAMPAIGN:
+
350  if (btn_new && btn_new->GetButtonState()) {
+
351  List<Campaign>& list = Campaign::GetAllCampaigns();
+
352 
+
353  for (int i = 0; i < lst_campaigns->NumItems(); i++) {
+
354  Campaign* c = list[i];
+
355 
+
356  // is campaign available?
+
357  // FULL GAME CRITERIA (based on player record):
+
358  if (c->GetCampaignId() <= 2 ||
+
359  player->HasCompletedCampaign(c->GetCampaignId()-1))
+
360  {
361 
-
362  for (int i = 0; i < lst_campaigns->NumItems(); i++) {
-
363  Campaign* c = list[i];
-
364 
-
365  // is campaign available?
-
366 
-
367 #ifdef STARSHATTER_DEMO_RELEASE
-
368  // DEMO VERSION (only one campaign):
-
369  if (c->GetCampaignId() <= 2)
-
370 #else
-
371  // FULL GAME CRITERIA (based on player record):
-
372  if (c->GetCampaignId() <= 2 ||
-
373  player->HasCompletedCampaign(c->GetCampaignId()-1))
-
374 #endif
-
375  {
-
376 
-
377  if (lst_campaigns->IsSelected(i)) {
-
378  images[i]->CopyBitmap(*c->GetImage(1));
-
379  lst_campaigns->SetItemImage(i, images[i]);
-
380 
-
381  AutoThreadSync a(sync);
-
382  load_index = i;
-
383  }
-
384  else {
-
385  images[i]->CopyBitmap(*c->GetImage(0));
-
386  lst_campaigns->SetItemImage(i, images[i]);
-
387  }
-
388  }
-
389 
-
390  // if not, then don't select
-
391  else {
-
392  images[i]->CopyBitmap(*c->GetImage(2));
-
393  lst_campaigns->SetItemImage(i, images[i]);
+
362  if (lst_campaigns->IsSelected(i)) {
+
363  images[i]->CopyBitmap(*c->GetImage(1));
+
364  lst_campaigns->SetItemImage(i, images[i]);
+
365 
+
366  AutoThreadSync a(sync);
+
367  load_index = i;
+
368  }
+
369  else {
+
370  images[i]->CopyBitmap(*c->GetImage(0));
+
371  lst_campaigns->SetItemImage(i, images[i]);
+
372  }
+
373  }
+
374 
+
375  // if not, then don't select
+
376  else {
+
377  images[i]->CopyBitmap(*c->GetImage(2));
+
378  lst_campaigns->SetItemImage(i, images[i]);
+
379 
+
380  if (lst_campaigns->IsSelected(i)) {
+
381  description->SetText(select_msg);
+
382  }
+
383  }
+
384  }
+
385  }
+
386 
+
387  // SAVED CAMPAIGN:
+
388  else {
+
389  int seln = lst_campaigns->GetSelection();
+
390 
+
391  if (seln < 0) {
+
392  description->SetText(select_msg);
+
393  }
394 
-
395  if (lst_campaigns->IsSelected(i)) {
-
396  description->SetText(select_msg);
-
397  }
-
398  }
-
399  }
-
400  }
-
401 
-
402  // SAVED CAMPAIGN:
-
403  else {
-
404  int seln = lst_campaigns->GetSelection();
-
405 
-
406  if (seln < 0) {
-
407  description->SetText(select_msg);
-
408  }
-
409 
-
410  else {
-
411  load_index = -1;
-
412  load_file = lst_campaigns->GetItemText(seln);
-
413  }
-
414  }
-
415 
-
416  if (btn_accept)
-
417  btn_accept->SetEnabled(false);
-
418  }
-
419 
-
420  if (!loading && (load_index >= 0 || load_file.length() > 0)) {
-
421  if (btn_cancel)
-
422  btn_cancel->SetEnabled(false);
+
395  else {
+
396  load_index = -1;
+
397  load_file = lst_campaigns->GetItemText(seln);
+
398  }
+
399  }
+
400 
+
401  if (btn_accept)
+
402  btn_accept->SetEnabled(false);
+
403  }
+
404 
+
405  if (!loading && (load_index >= 0 || load_file.length() > 0)) {
+
406  if (btn_cancel)
+
407  btn_cancel->SetEnabled(false);
+
408 
+
409  StartLoadProc();
+
410  }
+
411 }
+
412 
+
413 // +--------------------------------------------------------------------+
+
414 
+
415 void
+
416 CmpSelectDlg::Show()
+
417 {
+
418  FormWindow::Show();
+
419  ShowNewCampaigns();
+
420 }
+
421 
+
422 // +--------------------------------------------------------------------+
423 
-
424  StartLoadProc();
-
425  }
-
426 }
-
427 
-
428 // +--------------------------------------------------------------------+
+
424 void
+
425 CmpSelectDlg::OnNew(AWEvent* event)
+
426 {
+
427  ShowNewCampaigns();
+
428 }
429 
430 void
-
431 CmpSelectDlg::Show()
+
431 CmpSelectDlg::OnSaved(AWEvent* event)
432 {
-
433  FormWindow::Show();
-
434  ShowNewCampaigns();
-
435 }
-
436 
-
437 // +--------------------------------------------------------------------+
-
438 
-
439 void
-
440 CmpSelectDlg::OnNew(AWEvent* event)
-
441 {
-
442  ShowNewCampaigns();
-
443 }
-
444 
-
445 void
-
446 CmpSelectDlg::OnSaved(AWEvent* event)
-
447 {
-
448  ShowSavedCampaigns();
-
449 }
-
450 
-
451 void
-
452 CmpSelectDlg::OnDelete(AWEvent* event)
-
453 {
-
454  load_file = "";
-
455 
-
456  if (lst_campaigns) {
-
457  int seln = lst_campaigns->GetSelection();
-
458 
-
459  if (seln < 0) {
-
460  description->SetText(select_msg);
-
461  btn_accept->SetEnabled(false);
-
462  }
-
463 
-
464  else {
-
465  load_index = -1;
-
466  load_file = lst_campaigns->GetItemText(seln);
-
467  }
-
468  }
-
469 
-
470  if (load_file.length()) {
-
471  ConfirmDlg* confirm = manager->GetConfirmDlg();
-
472  if (confirm) {
-
473  char msg[256];
-
474  sprintf_s(msg, Game::GetText("CmpSelectDlg.are-you-sure"), load_file.data());
-
475  confirm->SetMessage(msg);
-
476  confirm->SetTitle(Game::GetText("CmpSelectDlg.confirm"));
-
477 
-
478  manager->ShowConfirmDlg();
-
479  }
+
433  ShowSavedCampaigns();
+
434 }
+
435 
+
436 void
+
437 CmpSelectDlg::OnDelete(AWEvent* event)
+
438 {
+
439  load_file = "";
+
440 
+
441  if (lst_campaigns) {
+
442  int seln = lst_campaigns->GetSelection();
+
443 
+
444  if (seln < 0) {
+
445  description->SetText(select_msg);
+
446  btn_accept->SetEnabled(false);
+
447  }
+
448 
+
449  else {
+
450  load_index = -1;
+
451  load_file = lst_campaigns->GetItemText(seln);
+
452  }
+
453  }
+
454 
+
455  if (load_file.length()) {
+
456  ConfirmDlg* confirm = manager->GetConfirmDlg();
+
457  if (confirm) {
+
458  char msg[256];
+
459  sprintf_s(msg, Game::GetText("CmpSelectDlg.are-you-sure"), load_file.data());
+
460  confirm->SetMessage(msg);
+
461  confirm->SetTitle(Game::GetText("CmpSelectDlg.confirm"));
+
462 
+
463  manager->ShowConfirmDlg();
+
464  }
+
465 
+
466  else {
+
467  OnConfirmDelete(event);
+
468  }
+
469  }
+
470 
+
471  ShowSavedCampaigns();
+
472 }
+
473 
+
474 void
+
475 CmpSelectDlg::OnConfirmDelete(AWEvent* event)
+
476 {
+
477  if (load_file.length()) {
+
478  CampaignSaveGame::Delete(load_file);
+
479  }
480 
-
481  else {
-
482  OnConfirmDelete(event);
-
483  }
-
484  }
+
481  ShowSavedCampaigns();
+
482 }
+
483 
+
484 // +--------------------------------------------------------------------+
485 
-
486  ShowSavedCampaigns();
-
487 }
-
488 
-
489 void
-
490 CmpSelectDlg::OnConfirmDelete(AWEvent* event)
-
491 {
-
492  if (load_file.length()) {
-
493  CampaignSaveGame::Delete(load_file);
-
494  }
-
495 
-
496  ShowSavedCampaigns();
-
497 }
-
498 
-
499 // +--------------------------------------------------------------------+
+
486 void
+
487 CmpSelectDlg::OnAccept(AWEvent* event)
+
488 {
+
489  AutoThreadSync a(sync);
+
490 
+
491  if (loading)
+
492  return;
+
493 
+
494  // if this is to be a new campaign,
+
495  // re-instaniate the campaign object
+
496  if (btn_new->GetButtonState())
+
497  Campaign::GetCampaign()->Load();
+
498  else
+
499  Game::ResetGameTime();
500 
-
501 void
-
502 CmpSelectDlg::OnAccept(AWEvent* event)
-
503 {
-
504  AutoThreadSync a(sync);
-
505 
-
506  if (loading)
-
507  return;
-
508 
-
509  // if this is to be a new campaign,
-
510  // re-instaniate the campaign object
-
511  if (btn_new->GetButtonState())
-
512  Campaign::GetCampaign()->Load();
-
513  else
-
514  Game::ResetGameTime();
-
515 
-
516  Mouse::Show(false);
-
517  stars->SetGameMode(Starshatter::CLOD_MODE);
-
518 }
-
519 
-
520 void
-
521 CmpSelectDlg::OnCancel(AWEvent* event)
-
522 {
-
523  manager->ShowMenuDlg();
-
524 }
-
525 
-
526 // +--------------------------------------------------------------------+
-
527 
-
528 DWORD WINAPI CmpSelectDlgLoadProc(LPVOID link);
-
529 
-
530 void
-
531 CmpSelectDlg::StartLoadProc()
-
532 {
-
533  if (hproc != 0) {
-
534  DWORD result = 0;
-
535  GetExitCodeThread(hproc, &result);
-
536 
-
537  if (result != STILL_ACTIVE) {
-
538  CloseHandle(hproc);
-
539  hproc = 0;
-
540  }
-
541  else {
-
542  return;
-
543  }
-
544  }
-
545 
-
546  if (hproc == 0) {
-
547  campaign = 0;
-
548  loading = true;
-
549  loaded = false;
-
550 
-
551  if (description)
-
552  description->SetText(Game::GetText("CmpSelectDlg.loading"));
-
553 
-
554  DWORD thread_id = 0;
-
555  hproc = CreateThread(0, 4096, CmpSelectDlgLoadProc, (LPVOID) this, 0, &thread_id);
-
556 
-
557  if (hproc == 0) {
-
558  static int report = 10;
-
559  if (report > 0) {
-
560  ::Print("WARNING: CmpSelectDlg() failed to create thread (err=%08x)\n", GetLastError());
-
561  report--;
-
562 
-
563  if (report == 0)
-
564  ::Print(" Further warnings of this type will be supressed.\n");
-
565  }
-
566  }
-
567  }
-
568 }
-
569 
-
570 void
-
571 CmpSelectDlg::StopLoadProc()
-
572 {
-
573  if (hproc != 0) {
-
574  WaitForSingleObject(hproc, 2500);
-
575  CloseHandle(hproc);
-
576  hproc = 0;
-
577  }
-
578 }
+
501  Mouse::Show(false);
+
502  stars->SetGameMode(Starshatter::CLOD_MODE);
+
503 }
+
504 
+
505 void
+
506 CmpSelectDlg::OnCancel(AWEvent* event)
+
507 {
+
508  manager->ShowMenuDlg();
+
509 }
+
510 
+
511 // +--------------------------------------------------------------------+
+
512 
+
513 DWORD WINAPI CmpSelectDlgLoadProc(LPVOID link);
+
514 
+
515 void
+
516 CmpSelectDlg::StartLoadProc()
+
517 {
+
518  if (hproc != 0) {
+
519  DWORD result = 0;
+
520  GetExitCodeThread(hproc, &result);
+
521 
+
522  if (result != STILL_ACTIVE) {
+
523  CloseHandle(hproc);
+
524  hproc = 0;
+
525  }
+
526  else {
+
527  return;
+
528  }
+
529  }
+
530 
+
531  if (hproc == 0) {
+
532  campaign = 0;
+
533  loading = true;
+
534  loaded = false;
+
535 
+
536  if (description)
+
537  description->SetText(Game::GetText("CmpSelectDlg.loading"));
+
538 
+
539  DWORD thread_id = 0;
+
540  hproc = CreateThread(0, 4096, CmpSelectDlgLoadProc, (LPVOID) this, 0, &thread_id);
+
541 
+
542  if (hproc == 0) {
+
543  static int report = 10;
+
544  if (report > 0) {
+
545  ::Print("WARNING: CmpSelectDlg() failed to create thread (err=%08x)\n", GetLastError());
+
546  report--;
+
547 
+
548  if (report == 0)
+
549  ::Print(" Further warnings of this type will be supressed.\n");
+
550  }
+
551  }
+
552  }
+
553 }
+
554 
+
555 void
+
556 CmpSelectDlg::StopLoadProc()
+
557 {
+
558  if (hproc != 0) {
+
559  WaitForSingleObject(hproc, 2500);
+
560  CloseHandle(hproc);
+
561  hproc = 0;
+
562  }
+
563 }
+
564 
+
565 DWORD WINAPI CmpSelectDlgLoadProc(LPVOID link)
+
566 {
+
567  CmpSelectDlg* dlg = (CmpSelectDlg*) link;
+
568 
+
569  if (dlg)
+
570  return dlg->LoadProc();
+
571 
+
572  return (DWORD) E_POINTER;
+
573 }
+
574 
+
575 DWORD
+
576 CmpSelectDlg::LoadProc()
+
577 {
+
578  Campaign* c = 0;
579 
-
580 DWORD WINAPI CmpSelectDlgLoadProc(LPVOID link)
-
581 {
-
582  CmpSelectDlg* dlg = (CmpSelectDlg*) link;
+
580  // NEW CAMPAIGN:
+
581  if (load_index >= 0) {
+
582  List<Campaign>& list = Campaign::GetAllCampaigns();
583 
-
584  if (dlg)
-
585  return dlg->LoadProc();
-
586 
-
587  return (DWORD) E_POINTER;
-
588 }
+
584  if (load_index < list.size()) {
+
585  c = list[load_index];
+
586  c->Load();
+
587  }
+
588  }
589 
-
590 DWORD
-
591 CmpSelectDlg::LoadProc()
-
592 {
-
593  Campaign* c = 0;
-
594 
-
595  // NEW CAMPAIGN:
-
596  if (load_index >= 0) {
-
597  List<Campaign>& list = Campaign::GetAllCampaigns();
+
590  // SAVED CAMPAIGN:
+
591  else {
+
592  CampaignSaveGame savegame;
+
593  savegame.Load(load_file);
+
594  c = savegame.GetCampaign();
+
595  }
+
596 
+
597  sync.acquire();
598 
-
599  if (load_index < list.size()) {
-
600  c = list[load_index];
-
601  c->Load();
-
602  }
-
603  }
+
599  loading = false;
+
600  loaded = true;
+
601  campaign = c;
+
602 
+
603  sync.release();
604 
-
605  // SAVED CAMPAIGN:
-
606  else {
-
607  CampaignSaveGame savegame;
-
608  savegame.Load(load_file);
-
609  c = savegame.GetCampaign();
-
610  }
-
611 
-
612  sync.acquire();
-
613 
-
614  loading = false;
-
615  loaded = true;
-
616  campaign = c;
-
617 
-
618  sync.release();
-
619 
-
620  return 0;
-
621 }
-
622 
-
623 // +--------------------------------------------------------------------+
+
605  return 0;
+
606 }
+
607 
+
608 // +--------------------------------------------------------------------+