WaypointID.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. // WaypointID.cpp: Implementierungsdatei
  17. //
  18. #include "stdafx.h"
  19. #include "FinalSun.h"
  20. #include "WaypointID.h"
  21. #include "mapdata.h"
  22. #include "variables.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. /////////////////////////////////////////////////////////////////////////////
  29. // Dialogfeld CWaypointID
  30. CWaypointID::CWaypointID(CWnd* pParent /*=NULL*/)
  31. : CDialog(CWaypointID::IDD, pParent)
  32. {
  33. //{{AFX_DATA_INIT(CWaypointID)
  34. // HINWEIS: Der Klassen-Assistent fügt hier Elementinitialisierung ein
  35. //}}AFX_DATA_INIT
  36. }
  37. void CWaypointID::DoDataExchange(CDataExchange* pDX)
  38. {
  39. CDialog::DoDataExchange(pDX);
  40. //{{AFX_DATA_MAP(CWaypointID)
  41. DDX_Control(pDX, IDC_ID, m_id);
  42. //}}AFX_DATA_MAP
  43. }
  44. BEGIN_MESSAGE_MAP(CWaypointID, CDialog)
  45. //{{AFX_MSG_MAP(CWaypointID)
  46. ON_BN_CLICKED(IDC_FREE, OnFree)
  47. //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49. /////////////////////////////////////////////////////////////////////////////
  50. // Behandlungsroutinen für Nachrichten CWaypointID
  51. void CWaypointID::OnFree()
  52. {
  53. CIniFile& ini=Map->GetIniFile();
  54. int i;
  55. CString freen;
  56. for(i=0;i>-1;i++)
  57. {
  58. char d[50];
  59. itoa(i,d,10);
  60. if(ini.sections["Waypoints"].values.find(d)==ini.sections["Waypoints"].values.end())
  61. {
  62. freen=d;
  63. break;
  64. }
  65. }
  66. m_id.SetWindowText(freen);
  67. }
  68. void CWaypointID::OnOK()
  69. {
  70. CString h;
  71. m_id.GetWindowText(h);
  72. if(h.GetLength()<1)
  73. {
  74. return;
  75. }
  76. m_value=atoi(h);
  77. CDialog::OnOK();
  78. }
  79. BOOL CWaypointID::OnInitDialog()
  80. {
  81. CDialog::OnInitDialog();
  82. OnFree();
  83. return TRUE; // return TRUE unless you set the focus to a control
  84. // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
  85. }