NewMapCreateNewDlg.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. FinalSun/FinalAlert 2 Mission Editor
  3. Copyright (C) 1999-2024 Electronic Arts, Inc.
  4. Authored by Matthias Wagner
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. */
  16. // NewMapCreateNewDlg.cpp: Implementierungsdatei
  17. //
  18. #include "stdafx.h"
  19. #include "finalsun.h"
  20. #include "NewMapCreateNewDlg.h"
  21. #include "variables.h"
  22. #ifdef _DEBUG
  23. #define new DEBUG_NEW
  24. #undef THIS_FILE
  25. static char THIS_FILE[] = __FILE__;
  26. #endif
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Dialogfeld CNewMapCreateNewDlg
  29. CNewMapCreateNewDlg::CNewMapCreateNewDlg(CWnd* pParent /*=NULL*/)
  30. : CDialog(CNewMapCreateNewDlg::IDD, pParent)
  31. {
  32. //{{AFX_DATA_INIT(CNewMapCreateNewDlg)
  33. m_Height = 0;
  34. m_Width = 0;
  35. m_StartingHeight = -1;
  36. m_Theater = -1;
  37. //}}AFX_DATA_INIT
  38. }
  39. void CNewMapCreateNewDlg::DoDataExchange(CDataExchange* pDX)
  40. {
  41. CDialog::DoDataExchange(pDX);
  42. //{{AFX_DATA_MAP(CNewMapCreateNewDlg)
  43. DDX_Text(pDX, IDC_HEIGHT, m_Height);
  44. DDX_Text(pDX, IDC_WIDTH, m_Width);
  45. DDX_CBIndex(pDX, IDC_STARTINGHEIGHT, m_StartingHeight);
  46. DDX_CBIndex(pDX, IDC_THEATER, m_Theater);
  47. //}}AFX_DATA_MAP
  48. }
  49. BEGIN_MESSAGE_MAP(CNewMapCreateNewDlg, CDialog)
  50. //{{AFX_MSG_MAP(CNewMapCreateNewDlg)
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. // Behandlungsroutinen für Nachrichten CNewMapCreateNewDlg
  55. BOOL CNewMapCreateNewDlg::OnInitDialog()
  56. {
  57. CDialog::OnInitDialog();
  58. CComboBox& theater=*((CComboBox*)GetDlgItem(IDC_THEATER));
  59. theater.AddString(THEATER0);
  60. theater.AddString(THEATER1);
  61. #ifdef RA2_MODE
  62. theater.AddString(THEATER2);
  63. if(yuri_mode) // MW YR support
  64. {
  65. theater.AddString(THEATER3);
  66. theater.AddString(THEATER4);
  67. theater.AddString(THEATER5);
  68. }
  69. #endif
  70. m_Theater=0;
  71. m_Width=50;
  72. m_Height=50;
  73. m_StartingHeight=0;
  74. UpdateData(FALSE);
  75. return TRUE; // return TRUE unless you set the focus to a control
  76. // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
  77. }
  78. void CNewMapCreateNewDlg::OnOK()
  79. {
  80. UpdateData(TRUE);
  81. if(m_Width>400 || m_Height>400 || m_Width<16 || m_Height<16 || (m_Width + m_Height) > 512)
  82. {
  83. MessageBox("Width and Height must both be between 16 and 400 and both added must be less than 512.","Error");
  84. return;
  85. }
  86. if(m_Width+m_Height>256)
  87. {
  88. #ifdef RA2_MODE
  89. int res=MessageBox("Width + height is bigger than 256, this may cause problems in RA2. Continue?","Warning",MB_YESNO);
  90. #else
  91. int res=MessageBox("Width + height is bigger than 256, this may cause problems in TS. Continue?","Warning",MB_YESNO);
  92. #endif
  93. if(res==IDNO) return;
  94. }
  95. CDialog::OnOK();
  96. }