PlayerSettingsDlg.cpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. // PlayerSettingsDlg.cpp : implementation file
  5. //
  6. #include "stdafx.h"
  7. #include "resource.h"
  8. #include "PlayerSettingsDlg.h"
  9. #include "EditorData.h"
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. /////////////////////////////////////////////////////////////////////////////
  16. // PlayerSettingsDlg dialog
  17. PlayerSettingsDlg::PlayerSettingsDlg(CWnd* pParent /*=NULL*/)
  18. : CDialog(PlayerSettingsDlg::IDD, pParent)
  19. {
  20. //{{AFX_DATA_INIT(PlayerSettingsDlg)
  21. m_playerEdit = 0;
  22. //}}AFX_DATA_INIT
  23. m_oldDefaultTeam = 0;
  24. m_numTeams = 8/*hardcoded*/;
  25. }
  26. void PlayerSettingsDlg::DoDataExchange(CDataExchange* pDX)
  27. {
  28. CDialog::DoDataExchange(pDX);
  29. //{{AFX_DATA_MAP(PlayerSettingsDlg)
  30. DDX_Control(pDX, IDC_PLAYER_SETTINGS_DEFAULT_TEAM_COMBO, m_defaultTeamComboBox);
  31. DDX_Text(pDX, IDC_PLAYER_SETTINGS_PLAYER_EDIT, m_playerEdit);
  32. DDV_MinMaxInt(pDX, m_playerEdit, 1, 8);
  33. //}}AFX_DATA_MAP
  34. m_newDefaultTeam = m_defaultTeamComboBox.GetCurSel();
  35. if (0 >= m_newDefaultTeam) {
  36. m_newDefaultTeam = m_defaultTeamComboBox.GetCurSel();
  37. } else {
  38. m_newDefaultTeam = m_defaultTeamComboBox.GetCurSel();
  39. }
  40. }
  41. BEGIN_MESSAGE_MAP(PlayerSettingsDlg, CDialog)
  42. //{{AFX_MSG_MAP(PlayerSettingsDlg)
  43. //}}AFX_MSG_MAP
  44. END_MESSAGE_MAP()
  45. /////////////////////////////////////////////////////////////////////////////
  46. // PlayerSettingsDlg message handlers
  47. BOOL PlayerSettingsDlg::OnInitDialog()
  48. {
  49. CDialog::OnInitDialog();
  50. m_defaultTeamComboBox.SetCurSel(m_oldDefaultTeam);
  51. if (0 < m_numTeams) {
  52. int i;
  53. for (i = m_defaultTeamComboBox.GetCount() - 1; i >= m_numTeams; i--) {
  54. m_defaultTeamComboBox.DeleteString(i);
  55. }
  56. }
  57. if (EditorData::instance->IsSinglePlayer() && (1 == m_playerEdit)) {
  58. m_defaultTeamComboBox.EnableWindow(FALSE);
  59. } else {
  60. m_defaultTeamComboBox.EnableWindow(TRUE);
  61. }
  62. // TODO: Add extra initialization here
  63. return TRUE; // return TRUE unless you set the focus to a control
  64. // EXCEPTION: OCX Property Pages should return FALSE
  65. }